RMAN-20002: Target Database Already Registered In Recovery Catalog

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarKiran Dalvi
  • 01 Dec, 2023
  • 0 Comments
  • 3 Mins Read

RMAN-20002: Target Database Already Registered In Recovery Catalog

PROBLEM:

While registering database to rman catalog, getting below error.

RMAN> register database;

RMAN-00571: ================================================
RMAN-00569: ========== ERROR MESSAGE STACK FOLLOWS ==========
RMAN-00571: ================================================
RMAN-03009: failure of register command on default channel at 12/08/2023 13:03:21
RMAN-20002: target database already registered in recovery catalog

Solution :

  1. Check dbid of the database.
    SQL> select dbid from v$database;
    
    DBID
    ----------
    2017723764
    
    
2. Connect to catalog and check whether same db is present or not
sqlplus catalog_user/rman@catdb

SQL*Plus: Release 12.1.0.2.0 Production on Sun Feb 12 13:50:57 2023

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

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

SQL> select DB_KEY,DBID,NAME from rc_database where dbid=2023723764;

DB_KEY DBID NAME
---------- ---------- --------
29531 2023723764 CONTEST

We can see another database CONTEST is already present in the catalog with the same dbid.  so adding new database to catalog with same DBid is failing.

So fix it, we have two options now.


OPTION – 1: ( UNREGISTER EXISTING DBID ENTRY). If the database, for which same dbid exists in the catalog repository, it not in use , then we can remove the entry and try to register.
sqlplus catalog_user/rman@catdb


SQL> select DB_KEY,DBID,NAME from rc_database where dbid=2023723764;

DB_KEY DBID NAME
---------- ---------- --------
29531 2023723764 CONTEST

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(29531, 2023723764);

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

OPTION 2 (CHANGE THE DBID of the database) : 

Use nid utility to change the dbid and try to register.

START DATABASE IN MOUNT STAGE :

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1.1107E+10 bytes
Fixed Size 7644464 bytes
Variable Size 9294584528 bytes
Database Buffers 1711276032 bytes
Redo Buffers 93011968 bytes
Database mounted.

NID TOOL TO CHANGE DBID:
nid target=sys/oracle@DBATEST

DBNEWID: Release 12.1.0.2.0 - Production on Sun Feb 12 14:03:42 2023

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

Connected to database DBATEST (DBID=2023723764)

Connected to server version 12.1.0

Control Files in database:
/archive/NONPLUG/NONCDB/control01.ctl
/archive/NONPLUG/NONCDB/control02.ctl

Change database ID of database NONCDB? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 1742085976 to 1753637695
Control File /archive/NONPLUG/NONCDB/control01.ctl - modified
Control File /archive/NONPLUG/NONCDB/control02.ctl - modified
Datafile /archive/NONPLUG/NONCDB/system01.db - dbid changed
Datafile /archive/NONPLUG/NONCDB/sysaux01.db - dbid changed
Datafile /archive/NONPLUG/NONCDB/NONCDB/datafile/o1_mf_prim_d9v1bqq3_.db - dbid changed
Datafile /archive/NONPLUG/NONCDB/PLUG/prim01.db - dbid changed
Datafile /archive/NONPLUG/NONCDB/NONCDB/datafile/o1_mf_prim_d9v1fq7k_.db - dbid changed
Datafile /archive/NONPLUG/NONCDB/PLUG/undo_new01.db - dbid changed
Control File /archive/NONPLUG/NONCDB/control01.ctl - dbid changed
Control File /archive/NONPLUG/NONCDB/control02.ctl - dbid changed
Instance shut down

Database ID for database DBATEST changed to 1753637695.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.

OPEN DATABASE IN RESETLOGS:
 
SQL> startup mount
ORACLE instance started.

Total System Global Area 1.1107E+10 bytes
Fixed Size 7644464 bytes
Variable Size 9294584528 bytes
Database Buffers 1711276032 bytes
Redo Buffers 93011968 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

Now try to register:

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete


Hope It Helps!