HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Why is important to write down the DBID in Oracle DB?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
whythewritedownimportantdbidoracle

Problem

I've always heard that one of the first things you should do in Oracle DB is to write down the DBID, so in case you lost the controlfile you'll need to set it in RMAN, and then you will be able to restore from autobackup. (Just like documentation said)

RMAN> SET DBID 320066378;
RMAN> RUN {
    SET CONTROLFILE AUTOBACKUP FORMAT 
          FOR DEVICE TYPE DISK TO 'autobackup_format';
    RESTORE CONTROLFILE FROM AUTOBACKUP;
    }


But then I've realized that some weeks ago, when we had to do an emergency DB restore in a different server at work, I didn't use the DBID at all. Even more, I've realized that I've never use the DBID.

All our backups are controlfile based, with CONTROLFILE AUTOBACKUP ON, and we do not use the "Flash/Fast Recovery Area" for them.
When I restore a controlfile I do it with RESTORE CONTROLFILE FROM '/file/name';, whitout setting up any DBID.

Here is a simple example where I add a datafile, move controlfiles physically, truncate a table and insert a row, commit it, shutdown abort, restore controlfile from the last autobackup, recover db and open:

```
[oracle@localhost rman]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Mié Nov 27 11:39:03 2013

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select file_name from dba_data_files where tablespace_name = 'TS_PRUEBA';

FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/data/ts_prueba.dbf

SQL> alter tablespace ts_prueba add datafile '/u01/app/oracle/oradata/data/ts_prueba02.dbf' size 10M;

Tablespace altered.

SQL> show parameter control_files;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string

Solution

If you use global RMAN catalog and some backup SW like TSM or NetBackup. Then DBID is the unique database identifier. This is needed especially to cross-site (DR) restores.

If each database uses it's own disk backup directory then importance of DBID is not so visible.

PS: it is also handy to keep output of REPORT SCHEMA rman command. This will tell you expected sizes of the datafiles after restore. And also their locations. This will help you to prepare storage for database when being cloned.

Context

StackExchange Database Administrators Q#54036, answer score: 2

Revisions (0)

No revisions yet.