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:

[oracle@rico ~]$ ls /backup1/26042014/control_26042014.10.15.07p6mjbr_1_1
/backup1/26042014/control_26042014.10.15.07p6mjbr_1_1
[oracle@rico ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Sat Apr 26 10:20:43 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (not mounted)
RMAN>restore controlfile from '/backup1/26042014/control_26042014.10.15.07p6mjbr_1_1';

Starting restore at 26-APR-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
output file name=+DATA/orcl/controlfile/current.260.845893267
output file name=+DATA/orcl/controlfile/current.261.845893267
Finished restore at 26-APR-14
RMAN> alter database mount;

database mounted

released 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:


[oracle@rico 26042014]$ rman auxiliary /
Recovery Manager: Release 11.2.0.3.0 - Production on Sat Apr 26 10:42:40 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to auxiliary database: ORCL (not mounted)
RMAN>duplicate database to orcl backup location='/backup1/26042014';

Starting Duplicate Db at 26-APR-14

contents of Memory Script:
{
sql clone "alter system set  control_files =
''+DATA/orcl/controlfile/current.260.845894567'', ''+DATA/orcl/controlfile/current.261.845894567'' comment=
''Set by RMAN'' scope=spfile";
sql clone "alter system set  db_name =
''ORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set  db_unique_name =
''ORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile from  '/backup1/26042014/0ip6mk8d_1_1';
alter clone database mount;
}
executing 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

Search:


Kontakt

Database Whisperers sp. z o. o. sp. k.
Al. Jerozolimskie 200
Wejście B, III piętro/ pokój 342
02-486 Warszawa
NIP: 5272744987
REGON:362524978
+48 508 943 051
+48 661 966 009
info@ora-600.pl

Newsletter zapisz się żeby być na bieżąco