Find DBID in NOMOUNT Stage

How To Find DBID in NOMOUNT Stage
  Oracle database identifier in short DBID is an internal,unique identifier for an oracle database.
  Database administrator must note down the DBID in safe place,so that any
  miss-happening to the database could be easily identified and recovered.
  In case it is required to recover spfile or control file from autobackup,
  such as disaster recovery,you will need to set DBID.So lets see how to get
  to get DBID in NOMOUNT state.
 Why DBID IS IMPORTANT
=> It is an unique identifier for a database
=> In case of backup and recovery RMAN distinguishes by DBID.
=> When DBID of a database is changed,all previous backups and
    archived logs of the database become unusable.
=> After you change the DBID,you must open the database with the
    RESETLOGS option,which re-creates the online redo logs and resets their log sequence.
First shut down the database using shut immediate command
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
Now startup database in nomount state 
SQL> startup nomount;                   
ORACLE instance started.
Total System Global Area  939495424 bytes
Fixed Size      2258840 bytes
Variable Size    251660392 bytes
Database Buffers   679477248 bytes
Redo Buffers      6098944 bytes
You can also set tracefile identifier for easily identification of tracefile. 
SQL> show parameter tracefile_identifier;
NAME                                   TYPE         VALUE
———————————— ———– ——————————
tracefile_identifier                 string
SQL>
SQL>
SQL> alter session set tracefile_identifier=kumar;
Session altered.
Now, dump first ten block of datafile, because each block header contains dbid information. 
SQL> alter system dump datafile ‘/home/oracle/ram/oradata/data/system.dbf’
  2  block min 1 block max 10;
System altered.
Now find the location of Trace file. 
SQL> show parameter user_dump_dest;
NAME                       TYPE              VALUE
———————-      ———–        ——————————
user_dump_dest        string          /home/oracle/ram/admin/diag/diag/rdbms/ram/ram/trace
search for Db ID inside the trace file
[oracle@OEL ~]$ cd /home/oracle/ram/admin/diag/diag/rdbms/ram/ram/trace/
[oracle@OEL trace]$ pwd
/home/oracle/ram/admin/diag/diag/rdbms/ram/ram/trace
[oracle@OEL trace]$ head -50  ram_ora_5172_KUMAR.trc 
 Start dump data block from file /home/oracle/ram/oradata/data/system.dbf minblk 1 maxblk 10
V10 STYLE FILE HEADER:
Compatibility Vsn = 186646784=0xb200100
Db ID=1478419057=0x581ee271, Db Name=’RAM’
Activation ID=0=0x0
Control Seq=314=0x13a, File size=51200=0xc800
File Number=1, Blksiz=8192, File Type=3 DATA
Dump all the blocks in range:
buffer tsn: 0 rdba: 0x00400002 (1024/4194306)
scn: 0x0000.00032c0f seq: 0x02 flg: 0x04 tail: 0x2c0f1d02
frmt: 0x02 chkval: 0xda65 type: 0x1d=KTFB Bitmapped File Space Header
Hex dump of block: st=0, typ_found=1
you can also get it using v$database:
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
SQL> select name, dbid from v$database;
NAME  DBID
——— ———-
RAM   1478419057
DBID is also displayed by the RMAN client when it starts up and connects to your database.
[oracle@OEL ~]$ export ORACLE_SID=ram
[oracle@OEL ~]$ rman target/
Recovery Manager: Release 12.2.0.1.0 – Production on Fri Nov 1 13:21:14 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: RAM (DBID=1478419057)
  • November 2, 2018 | 16 views
  • Comments