Delete from catalogue

-- ################################################
-- # Creator: Vincent Fenoll, Arnaud Michel
-- # Compatible: Oracle 8i 9i 10g
-- #
-- ################################################
-- #
-- # Delete an Oracle database from the RMAN catalogue
-- #
-- ################################################

In RMAN database:
sqlplus rman/****@rman


-- PART I: Unregister One Database

SQL> SELECT db_key, db_id FROM db WHERE db_id = 1231274694;
This query should return exactly one row.
DB_KEY DB_ID
---------- ----------
1 1237603294
1 row selected.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(db_key, db_id)


-- PART II: Unregister several databases with a PL*SQL Loop

set serveroutput on
exec dbms_output.enable(1000000);
DECLARE 
CURSOR C_DBKEY IS
  SELECT db_key, db_id FROM db WHERE db_id in (838734099,2567483700,4125117868,2420232503);

BEGIN
 For Cur IN C_DBKEY Loop
     dbms_rcvcat.unregisterdatabase(cur.db_key, cur.db_id);
     -- dbms_output.put_line( 'exec dbms_rcvcat.unregisterdatabase(' || To_char( Cur.db_key ) || ' , ' || Cur.db_id  || ');' ) ;
 End loop ;
END;
/

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.