← All field notes

Oracle myth: You need DBID to restore the controlfile

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:

ora600@lab ~ / text#01
[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
22 LINESTEXT / UTF-8

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:

ora600@lab ~ / text#02

[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
27 LINESTEXT / UTF-8

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

END OF FIELD NOTE / 2014-04-26

Keep asking why. Keep looking deeper.

← Back to the blog