After making sure the recovery catalog database is open, connect RMAN to the target database and recovery catalog database.
% rman TARGET sys/[email protected] CATALOG catalog/[email protected]
If the target database is not mounted, then mount or open it:
RMAN> STARTUP MOUNT;
Register the target database in the connected recovery catalog:
RMAN> REGISTER DATABASE;
RMAN creates rows in the catalog tables to contain information about the target database, then copies all pertinent data about the target database from the control file into the catalog, synchronizing the catalog with the control file.
You can verify that the registration was successful by running REPORT SCHEMA:
RMAN> REPORT SCHEMA;
Unregistering a Target database with RMAN Catalog:
First we start up RMAN with a connection to the catalog and the target, making a note of the DBID
C:\>rman catalog=rman/[email protected] target=HRMS/[email protected]
connected to target database: W2K1 (DBID=691421794)
connected to recovery catalog database
Note the DBID from here.
Next we list and delete any backupsets recorded in the repository:
RMAN> LIST BACKUP SUMMARY;
RMAN> DELETE BACKUP DEVICE TYPE DISK;
Next we connect to the RMAN catalog owner using SQL*Plus and issue the following statement:
SQL> CONNECT rman/[email protected]
Connected.
SQL> SELECT db_key, db_id FROM db
WHERE db_id = 1487421514;
DB_KEY DB_ID
———- ———-
1 691421794
The resulting key and id can then be used to unregister the database:
SQL> EXECUTE dbms_rcvcat.unregisterdatabase(1, 691421794);
PL/SQL procedure successfully completed.
Unregistering a Primary Database and Its Standby Databases:
Consider that primary database prod has associated standby databases dgprod3 and dgprod4. In this example, you connect RMAN to target database prod, whose database name is unique in the recovery catalog, and unregistered it. RMAN removes all metadata about prod, dgprod3, and dgprod4 from the catalog.
RMAN> CONNECT TARGET /
connected to target database: PROD (DBID=1627709917)
RMAN> CONNECT CATALOG [email protected]
recovery catalog database Password: password
connected to recovery catalog database
RMAN> UNREGISTER DATABASE NOPROMPT;
database name is “PROD” and DBID is 1627709917
database unregistered from the recovery catalog
RMAN> LIST DB_UNIQUE_NAME ALL;
RMAN>
Unregistering a Database that is Not Unique in Catalog:
Consider that two databases registered in a recovery catalog have the name prod. Your goal is to unregister the prod database that has the DBID 28014364. Because of multiple databases called prod are registered in the recovery catalog you have to SET DBID before unregister Database.
RMAN> CONNECT CATALOG catalog/[email protected]
RMAN> SET DBID 28014364;
executing command: SET DBID
database name is “PROD” and DBID is 28014364
RMAN> UNREGISTER DATABASE;
Do you really want to unregister the database (enter YES or NO)? YES
database unregistered from the recovery catalog
Unregistering a Standby Database:
Consider that primary database prod has associated standby databases dgprod3 and dgprod4. You want to unregisterdgprod4, but not remove the metadata for backups taken on this database because these backups are still usable by other databases in the environment.
RMAN> CONNECT CATALOG catalog/[email protected]
RMAN> SET DBID 1627367554;
executing command: SET DBID
database name is “PROD” and DBID is 1627367554
RMAN> UNREGISTER DB_UNIQUE_NAME dgprod4;
database db_unique_name is “dgprod4”, db_name is “PROD” and DBID is 1627367554
Want to unregister the database with target db_unique_name (enter YES or NO)? YES
database with db_unique_name dgprod4 unregistered from the recovery catalog
Restrictions and Usage Notes:
- Connect RMAN to the target database
- Provide the database_name argument to identify the database to unregister, if the database name is unique;
- Use SET DBID to identify the database if RMAN is not connected to the target database and the database_name is not unique in the recovery catalog.