Monday, January 12, 2009

Unregister a Database From RMAN, 9i

First we start up RMAN with a connection to the catalog and the target, making a note of the DBID in the banner:
C:\>rman catalog=rman/rman@dba1 target=sys/password@w2k1

Recovery Manager: Release 9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: W2K1 (DBID=1487421514)
connected to recovery catalog database

RMAN>
Next we list and delete any backupsets recorded in the repository:
RMAN> LIST BACKUP SUMMARY;
RMAN> DELETE BACKUP DEVICE TYPE SBT;
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/rman@dba1
Connected.
SQL> SELECT db_key, db_id
2 FROM db
3 WHERE db_id = 1487421514;

DB_KEY DB_ID
---------- ----------
1 1487421514

1 row selected.

SQL>
The resulting key and id can then be used to unregister the database:
SQL> EXECUTE dbms_rcvcat.unregisterdatabase(1, 1487421514);

PL/SQL procedure successfully completed.

SQL>

Monday, January 5, 2009

Printing RMAN stored scripts names.

I just wanted to check rman catalog's stored scripts names, so here are my findings:

For 9i:

In 9i you have to use sqlplus to connect with rman catalog and fetch stored scripts name. e.g.

step 1: $sqlplus rman-user/rman-user-password@Catalog-SID

Step 2: sql> select distinct script_name from rc_stored_script;

For 10g:

In 10g you can even query stored scripts name from RMAN prompt. e.g.

LIST SCRIPT NAMES;

If RMAN is not connected to a target database when the LIST SCRIPT NAMES command is run, then RMAN will respond with an error.

To view only global script names, use this form of the command:

LIST GLOBAL SCRIPT NAMES;

To view the names of all scripts stored in the current recovery catalog, including global scripts and local scripts for all target databases registered in the recovery catalog, use this form of the command:

LIST ALL SCRIPT NAMES;

The output will indicate for each script listed which target database the script is defined for (or whether a script is global).


cheers