How Do I Know DBID of a Database

  • by
Different database has their own DBID that can make recovery catalog distinguish which is which, but in the same data guard infrastructure, the database, either primary or standby shares one DBID.

It's especially convenient for restoring primary or standby database through catalog with the same DBID, no matter what the backup sets were coming from which database.

That is to say, you can always perform a full backup on standby database instead of the primary. The recovery catalog knows how to use the backup from the standby to restore the primary.

In another case, you might want to duplicate a database through catalog, then you have to fake the source database to get the backup records from the recovery catalog.

Question 1: How could one database fake the other to make catalog know which database that you want to restore?

It's SET DBID clause. For example:
[oracle@test ~]$ rman target / catalog owner/password@catdb
RMAN> run
2> {
3>    set dbid 3402520347;
4>    set until scn 26593982035;
5>    restore database;
6>    recover database;
7>    alter database open resetlogs;
8> }

Question 2: How do I know the DBID of the source database?

On the source database, you can query a dynamic view to know it.
SQL> select dbid, open_mode from v$database;

---------- ----------
3402520347 MOUNTED

You can also login RMAN to know current DBID.
[oracle@test ~]$ rman target /
connected to target database: ORCL (DBID=3402520347)

Leave a Reply

Your email address will not be published. Required fields are marked *