Home > OCM, Oracle DBA > Find out DBID !!

Find out DBID !!

One can find out dbid of a database through various means :

a) Execute a query, if db is either in mount mode or open

SQL> select dbid from v$database ;

DBID
———-
555044608

b) If the db is is nomount mode but connected to recovery catalog, then you can find out while connected to Recovery Catalog

RMAN> list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
——- ——- ——– —————- — ———- ———-
1       18      PRIMDB   555044608        PARENT  1          09/18/2011 17:33:42
1       19      PRIMDB   555044608        PARENT  787897     05/23/2015 20:01:07
1       20      PRIMDB   555044608        PARENT  1098108    06/10/2015 18:22:30
1       2       PRIMDB   555044608        CURRENT 1115148    06/11/2015 03:44:36

 

c) If autobackup of controlfile is configured, then the controlfile backup piece will also have dbid as part of filename ;

d) if none of the above things works for you because you are unable to mount your db nor you are able to connect to recovery catalog, then you can execute unix strings command and find the same as shown below

UNIX PROMPT> strings /u01/app/oracle/oradata/PRIMDB/datafile/o1_mf_system_bqlljylm_.dbf | grep MAXVALUE

555044608, MAXVALUE,

 

e) You can also find it via diff. method. assuming your db is in nomount mode

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  849530880 bytes
Fixed Size                  1348244 bytes
Variable Size             637537644 bytes
Database Buffers          205520896 bytes
Redo Buffers                5124096 bytes

 

Now set the tracefile identifier so that you can easily locate the file

SQL> alter session set tracefile_identifier=helloworld;

Session altered.

 

Now dump the dbf file to tracefile destination. Make sure to specify the block otherwise with dbf file being so big, it’s going to take a while to dump the content

SQL> alter system dump datafile ‘/u01/app/oracle/oradata/PRIMDB/datafile/o1_mf_system_bqlljylm_.dbf’ block min 1 block max 3;

System altered.

Once above command is executed, go to your diag destination  ( HINT : You can find diag destination that via sql parameter diagnostic_dest )

tracefile location

Now open the trc file and search for string Db as shown in below screenshot. Basically this is your DBID

tracefile_content

 

Advertisements
Categories: OCM, Oracle DBA Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: