Oracle myth: You need DBID to restore the controlfile


26.04.2014
by Kamil Stawiarski

My experience shows that you don’t have to know the DBID now for restoring contorlfile from backup. If I know the name of backup piece, that contains controlfile I can do the following scenario:

1[oracle@rico ~]$ ls /backup1/26042014/control_26042014.10.15.07p6mjbr_1_1
2/backup1/26042014/control_26042014.10.15.07p6mjbr_1_1
3[oracle@rico ~]$ rman target /
4Recovery Manager: Release 11.2.0.3.0 - Production on Sat Apr 26 10:20:43 2014
5Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
6connected to target database: ORCL (not mounted)
7RMAN>restore controlfile from '/backup1/26042014/control_26042014.10.15.07p6mjbr_1_1';
8 
9Starting restore at 26-APR-14
10using target database control file instead of recovery catalog
11allocated channel: ORA_DISK_1
12channel ORA_DISK_1: SID=63 device type=DISK
13channel ORA_DISK_1: restoring control file
14channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
15output file name=+DATA/orcl/controlfile/current.260.845893267
16output file name=+DATA/orcl/controlfile/current.261.845893267
17Finished restore at 26-APR-14
18RMAN> alter database mount;
19 
20database mounted
21 
22released channel: ORA_DISK_1

If I don’t know the name of the backup piece and there is a lot of strangely named files in a directory I can use the following duplicate trick:

1[oracle@rico 26042014]$ rman auxiliary /
2Recovery Manager: Release 11.2.0.3.0 - Production on Sat Apr 26 10:42:40 2014
3Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
4connected to auxiliary database: ORCL (not mounted)
5RMAN>duplicate database to orcl backup location='/backup1/26042014';
6 
7Starting Duplicate Db at 26-APR-14
8 
9contents of Memory Script:
10{
11sql clone "alter system set  control_files =
12''+DATA/orcl/controlfile/current.260.845894567'', ''+DATA/orcl/controlfile/current.261.845894567'' comment=
13''Set by RMAN'' scope=spfile";
14sql clone "alter system set  db_name =
15''ORCL'' comment=
16''Modified by RMAN duplicate'' scope=spfile";
17sql clone "alter system set  db_unique_name =
18''ORCL'' comment=
19''Modified by RMAN duplicate'' scope=spfile";
20shutdown clone immediate;
21startup clone force nomount
22restore clone primary controlfile from  '/backup1/26042014/0ip6mk8d_1_1';
23alter clone database mount;
24}
25executing Memory Script

So basically – you don’t have to know the DBID, to restore a database when the controlfile is lost when backup sets are located on disk.

Of course you will need the DBID to restore controlfile from autobackup – in such case you would like to get familiar with post written by Arup Nanda: http://arup.blogspot.com/2014/04/how-to-get-dbid-when-instance-in-in.html

Update:
Recently I was honored by Arup Nanda, who mentioned about my simple trick in his blog (thank you Arup!)
http://arup.blogspot.com/2014/04/restoring-controlfile-when-autobackup.html


Contact us

Database Whisperers sp. z o. o. sp. k.
al. Jerozolimskie 200, 3rd floor, room 342
02-486 Warszawa
NIP: 5272744987
REGON:362524978
+48 508 943 051
+48 661 966 009
info@ora-600.pl

Newsletter Sign up to be updated