RMAN-07518: Reason: Foreign database file DBID: 18023747 Database Name: TEST

Very recently I have encountered this issue while cataloging the backup pieces in order to sync the standby server.

Well this is all about that database DBID is different from the source (primary) database where you cannot/rman cannot see those backups relevant to this destination database. very obvious thing.

This db in the issue has been built long back and in sync, whilst I was doing a roll forward standby recovery and trying to catalog found this issue.

Now, how to change the DBID to the desired or the original one,

we all know NID (new id) utility can only do database name change and NID change, but we cannot retrospect or keep the DBID we want to.

But wait, there is a packages  ( I believe this package is there since 9i) called dbms_backup_restore

Note : If you do not have this package you can run this{ORACLE_HOME}/rdbms/admin/dbmsbkrs.sql

which has following procedures (there’s lot of interesting stuff with this package) of interest for this issue. 

 

  • dbms_backup_restore.nidbegin
  • dbms_backup_restore.nidprocesscf
  • dbms_backup_restore.nidprocessdf
  • dbms_backup_restore.nidend;

Steps:-

1) Open database in readonly

2) Use the script below or use your own to change your ID

a) You should start with nidbegin

b) Change the controlfile first using dbms_backup_restore.nidprocesscf

c) change the datafiles using dbms_backup_restore.nidprocessdf , one by one or using a for loop to v$datafile

d) change the tempfiles using dbms_backup_restore.nidprocesscf, one by one or using a for loop to v$tempfile

e) End with dbms_backup_restore.nidbegin

 

May be undocumented usage of this package , please have proper backup before perform this activity

 

References:- http://psoug.org/reference/dbms_backup_restore.html

Simple Script:- http://www.pythian.com/news/1491/how-to-choose-your-oracle-database-id-dbid/

-Thanks

Suresh


Rs. 150 .Com at GoDaddy.com!

Leave a Reply