How to Unregister a Database from RMAN Repository

Target Database is Still Available

You connect to the target database TEST and then unregister it:

rman TARGET SYS/Passwd@TEST CATALOG rman/rman@catdb

RMAN> UNREGISTER DATABASE NOPROMPT;

Unregistering a Database That is Not Unique in Catalog or Target Database is Unvailable

The following UNIX shell script unregisters database testdb from the recovery catalog. Because multiple databases called testdb are registered in the recovery catalog, and because RMAN is not connected to the target database (which has already been deleted from the file system), you must run SET DBID:

Show DBID of a database:

RMAN >  list incarnation of database testdb;
rman CATALOG rman/rman@catdb
RMAN> RUN
{  
  SET DBID 1334531173;   # specifies test database by DBID
  UNREGISTER DATABASE testdb NOPROMPT;
}

List all Registered Database

RMAN > LIST DB_UNIQUE_NAME ALL;

How to Find DBID from OEM Repository

A client has drooped an Oracle database, and client wants to know DBID of the dropped database.

From OEM repository, we can query some tables or views to get DBID for a specific database. for example :

 SQL> select HOST_NAME,TARGET_NAME,TARGET_TYPE,TARGET_GUID,DBID,VERSION        from  MGMT$DB_CPU_USAGE where upper(TARGET_NAME)='DB_NAME';

RMAN command to list dbid of the database:

$ rman catalog rman@rmancatalog
RMAN> list incarnation of database TESTDB;