DBID stands for database identifier which is a unique identifier for each oracle database running in your server. DBID information is found in control files as well as datafile header.
If the database is up and running then DBID can be found from v$database or while connecting to rman target /
1.. If Oracle Database is up and running then connect rman then along with database name you will find DBID of the database or using v$database DBID can be found.
2.. If configure control file auto backup is on and Format %F is set then while taking backup of control file it will print DBID of database.
%F Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name .
3.. Printing DBID in alert log file using package DBMS.SYSTEM
where ksdwrt is used to write messages to the alertlog or trace files.
EXEC DBMS_System.ksdwrt(n, message);
EXEC DBMS_System.ksdwrt(2, ‘DBID’); Where the value of “n” indicates the destination and could be as follows.
a.. trace file
Once procedure is completed successfully grep DBID from alert log.
4.. Dumping DBID to dump file using SYSAUX datafile
Once database is started in nomount mode using alter system dump datafile dump DBID to trace file.
To get information navigate to USER_DUMP_DEST and search for recently created trace file for database and using grep find out DBID of Database.
Note :- Other then SYSAUX datafile other datafile can be also used like users01.dbf
5.. Dumping DBID to dump file using redo log files.
Again start database in nomount mode using any of redo log file dump DB ID to dump file in under trace file directory.
6.. Few Test Cases when DBID is not set and set and restoring control file from autobackup and backup of control file.
6.1.. If DBID is not set while doing restore of control file and control file is restored from autobackup then AUTOBACKUP search with format “%F” will not attempted because DBID was not set.
6.2.. If DBID is set then AUTOBACKUP search with format “%F” is attempted because DBID was set And control file will be restored from autobackup as given below.
6.3.. And if DBID is not set and you are doing restore of control file from backup of control file then it will restore control file from backup of control file only.
Happy Learning !!!!