Unregister target database from RMAN recovery catalog

We have two methods to unregister database from RMAN recovery catalog.

Method 1st:

Unregister target database with the help of “Unregister database” RMAN command.

Consider following hands-on, ORCL database is currently registered with the recovery catalog, ensure this with the help of “list incarnation” & “report schema” RMAN command:
Note:
ORCL is the target database & catalogdb is the catalog database.

 

[oracle@oracle ~]$ export ORACLE_SID=orcl

[oracle@oracle ~]$ rman target / catalog recoveryman/recoveryman@catalogdb
Recovery Manager: Release 11.2.0.1.0 – Production on Thu Jan 9 12:59:30 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1363580714)
connected to recovery catalog database

RMAN> list incarnation;

List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
——- ——- ——– —————- — ———- ———-
913 926 ORCL 1363580714 PARENT 1 15-AUG-09
913 914 ORCL 1363580714 CURRENT 945184 02-JAN-14
2 20 CATALOGD 2196388840 PARENT 1 15-AUG-09
2 4 CATALOGD 2196388840 CURRENT 945184 03-JAN-14

OR

RMAN> report schema;

Report of database schema for database with db_unique_name ORCL
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
—- ——– ——————– ——- ————————
1 680 SYSTEM YES /home/oracle/app/oracle/oradata/orcl/system01.dbf
2 570 SYSAUX NO /home/oracle/app/oracle/oradata/orcl/sysaux01.dbf
3 30 UNDOTBS1 YES /home/oracle/app/oracle/oradata/orcl/undotbs01.dbf
4 5 USERS NO /home/oracle/app/oracle/oradata/orcl/users01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
—- ——– ——————– ———– ——————–
1 22 TEMP 32767 /home/oracle/app/oracle/oradata/orcl/temp01.dbf

 

Now, to unregister target database ( ORCL ), connect to RMAN prompt and issue the “unregister database” command:

[oracle@oracle ~]$ export ORACLE_SID=orcl

[oracle@oracle ~]$ rman target / catalog recoveryman/recoveryman@catalogdb

Recovery Manager: Release 11.2.0.1.0 – Production on Thu Jan 9 13:11:10 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1363580714)
connected to recovery catalog database

RMAN> unregister database;

database name is “ORCL” and DBID is 1363580714
Do you really want to unregister the database (enter YES or NO)? yes
database unregistered from the recovery catalog
Target database ( ORCL ) has been unregistered successfully, ensure this with the help of “list incarnation” & “report schema” RMAN command:

[oracle@oracle ~]$ export ORACLE_SID=orcl

[oracle@oracle ~]$ rman target / catalog recoveryman/recoveryman@catalogdb

Recovery Manager: Release 11.2.0.1.0 – Production on Thu Jan 9 12:56:02 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1363580714)
connected to recovery catalog database

RMAN> list incarnation;

List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
——- ——- ——– —————- — ———- ———-
2 20 CATALOGD 2196388840 PARENT 1 15-AUG-09
2 4 CATALOGD 2196388840 CURRENT 945184 03-JAN-14

OR

RMAN> report schema;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of report command at 01/09/2014 13:06:30
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog
Method 2nd:

Unregister target database with the help of “dbms_rcvcat.unregisterdatabase” procedure:

Consider following hands-on.
ORCL database is currently registered with the recovery catalog, ensure this with the help of “list incarnation” & “report schema” RMAN command as mentioned in method 1st.

 

Now, to unregister target database ( ORCL ), connect to the RMAN recovery catalog database with recovery manager owner & issue the following query to get database key and database id:

[oracle@oracle ~]$ export ORACLE_SID=catalogdb

[oracle@oracle ~]$ sqlplus “recoveryman/recoveryman”
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 9 12:48:48 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select db_key,dbid,name from rc_database;

DB_KEY DBID NAME
———- ———- ——–
653 1363580714 ORCL
2 2196388840 CATALOGD

Now, Execute dbms_rcvcat.unregisterdatabase procedure ( from the recovery catalog owner ) to unregister the database from the recovery catalog:

Note:
This procedure gets DB_KEY & DB_ID that we just retrive with the help of above query.

Syntax: dbms_rcvcat.unregisterdatabase(db_key,db_id);

SQL> execute dbms_rcvcat.unregisterdatabase(653,1363580714);

PL/SQL procedure successfully completed.

 

Target database ( ORCL ) has been unregistered successfully, ensure this with the help of “list incarnation” & “report schema” RMAN command as mentioned in method 1st.
***********************************************************************
Note: Please don’t hesitate to revert in case of any query OR feedback.

Thanking you.

Have a easy life ahead.

Leave a Reply