Wednesday, November 7, 2018

RMAN Catalog de-register unused database

Below are the steps of one method that you can use to remove old db entries from RMAN catalog database.

+++++++++++++++++++++++++++++
oracle@target2300:~> sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 5 02:09:26 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> -- connect to RMAN Catalog user
SQL> connect rman/backup
Connected.
SQL> SELECT db_key, dbid, name FROM rc_database WHERE name = 'TestingDBA';

    DB_KEY       DBID NAME
---------- ---------- --------
   1450377 1874538921 TestingDBA
   3256317 1885700034 TestingDBA
  28091447 1903574000 TestingDBA
  28805999 1903892800 TestingDBA

SQL>  SELECT db_key, dbid, name FROM rc_database WHERE name like 'TestingDB%';

    DB_KEY       DBID NAME
---------- ---------- --------
  41927688  826894727 TestingDBBETA
   1450377 1874538921 TestingDBA
   3256317 1885700034 TestingDBA
  28091447 1903574000 TestingDBA
  34396606 3955608007 TestingDBALFA
  34400693 1392119613 TestingDBBETA
  28805999 1903892800 TestingDBA

7 rows selected.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(1450377,1874538921);

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(3256317,1885700034);

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(28091447,1903574000);

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(28805999,1903892800);

PL/SQL procedure successfully completed.

SQL> SELECT db_key, dbid, name FROM rc_database WHERE name like 'TestingDB%';

    DB_KEY       DBID NAME
---------- ---------- --------
  41927688  826894727 TestingDBBETA
  34396606 3955608007 TestingDBALFA
  34400693 1392119613 TestingDBBETA

No comments:

Post a Comment