Wednesday, 13 August 2014

Oracle: How to Get the DBID in NOMOUNT State

DBID is the most important parameter to restore and recover controlfile using Rman. You can easily find DBID in open state but what you will do in nomount stat.

Steps to find DBID in NOMOUNT state:

First, start the database in nomount state:

SQL>startup nomount;

Now set the label for identification of tracefile that will be generated during this process. 

SQL>alter session set tracefile_identifier =santosh;


Get datafile name and location using v$datafile and dump some blocks of that datafile.

SQL> select name from v$datafile;

NAME
----------------------------------------------------
D:\APP\SANTOSH\ORADATA\TEST11\SYSTEM01.DBF
D:\APP\SANTOSH\ORADATA\TEST11\SYSAUX01.DBF
D:\APP\SANTOSH\ORADATA\TEST11\UNDOTBS01.DBF
D:\APP\SANTOSH\ORADATA\TEST11\USERS01.DBF
D:\APP\SANTOSH\ORADATA\TEST11\USERS02.DBF


SQL> alter system dump datafile 'D:\APP\SANTOSH\ORADATA\TEST11\USERS02.DBF' 
          2  block min 1 block max10;

                System altered.


Now, check trace file using tracefile_identifier(Label) in my case it is santosh. To see the the trace file location we have:

SQL> show parameter user_dump_dest

Now open the trace file and you will get Db ID =XXXXX

 Start dump data block from file D:\APP\SANTOSHTIWARI\ORADATA\TEST11\USERS02.DBF minblk 1 maxblk 10
 V10 STYLE FILE HEADER:
Compatibility Vsn = 186646528=0xb200000
Db ID=3561501508=0xd4483344, Db Name='TEST11'
Activation ID=0=0x0
Control Seq=932=0x3a4, File size=1280=0x500
File Number=5, Blksiz=8192, File Type=3 DATA


Note: Take sufficient backup before dumping blocks because you may loose data, so perform this operation on your own risk.

No comments:

Post a Comment