Monday, December 20, 2021

Unregister a Database from RMAN Recovery Catalog

Use UNREGISTER command to remove the metadata from RMAN recovery catalog. You can unregister one or more databases and but note that physical backups are not deleted by this command. You need to use DELETE BACKUP/ DELETE EXPIRED BACKUP commands to remove physical backups

Before you unregister, make sure you connect to recovery catalog and verify the backups. If the backups no longer needed then you can proceed

The below command provides the summary of all backups taken for a Database using RMAN

RMAN> LIST BACKUP;
RMAN> LIST BACKUP SUMMARY;

You can specify EXPIRED keyword to identify backups not found during a crosscheck
SQL> LIST EXPIRED BACKUP;

You can use below command to delete expired backups
SQL> DELETE EXPIRED BACKUP;

You can use below command to delete all the existing backups going to DEVICE TYPE DISK
RMAN> DELETE BACKUP DEVICE TYPE DISK;

Method 1: In this method, we are connecting to target database and recovery catalog database to unregister. On a primary/standby databases scenario, it removes all metadata associated to primary as well standby.

$ rman
 
RMAN>connect target /
Connected to target database: TEST (DBID=87658657577)

RMAN> CONNECT CATALOG rcat/xxxxxx@RMANDB
connected to recovery catalog database

RMAN> UNREGISTER DATABASE NOPROMPT;
database name is "TEST" and DBID is 87658657577
database unregistered from the recovery catalog


or

RMAN> UNREGISTER DATABASE;
Do you really want to unregister the database (enter YES or NO)? YES
database unregistered from the recovery catalog


When using NOPROMPT, it doesn't ask for confirmation before UNREGISTER.

Method 2: In this method, we are connecting only recovery catalog database to unregister.

RMAN> CONNECT CATALOG rcat/xxxxxx@RMANDB
connected to recovery catalog database


RMAN> UNREGISTER DATABASE TEST NOPROMPT;

In case if there is more than one DB in the recovery catalog database then you need to use DBID to unregister.

If you want to unregister backups associated with Standby only then you can use this method to unregister Standby database by setting DBID. In this case, the backups are still usable by other primary or standby databases

RMAN> SET DBID 87658657577;
executing command: SET DBID
database name is "TEST" and DBID is 87658657577

RMAN> UNREGISTER DATABASE TEST NOPROMPT;
database name is "TEST" and DBID is 87658657577
database unregistered from the recovery catalog


Method 3: In this method, we are unresigering the database dbms_rcvcat Package. When using this package you need to provide DB_KEY and DBID.

You can get the DBID, DB_KEY from RC_DATEABASE
SQL> SELECT db_key, dbid FROM rc_database WHERE name = ‘TEST’;

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(3422 , 87658657577);
PL/SQL procedure successfully completed.

This UNREGISTER command cannot be used when target database configured with ZERO data loss recovery appliance. You can use DBMS_RA.DELETE_DB procedure to unregister a database from Recovery Appliance.

Thanks & Regards,
http://oracleracexpert.com, Oracle ACE

1 comment:

  1. The Bangladesh government Minister of Secondary Education is going to announce the JSC Result 2022 in student wise for division Junior School Certificate Result 2022 students in education board wise, and the result documents will be submitted to the Prime Minister of the country after then the result with mark sheet will be announced to public to check the individual result.

    ReplyDelete