Friday, April 06, 2007

How to remove incarnation records from the recovery catalog

To remove incarnation records from the recovery catalog:
-------------------------------------------------------

1. Allocate a channel of type maintenance:

allocate channel for maintenance type 'disk';

2. Issue change ... delete commands to update unwanted backup pieces,
archived redo logs,
and image copies to deleted status. Issue list commands or query the
recovery catalog
views to obtain primary keys for archived redo logs, backup sets,
control file copies,
or datafile copies.

change backupset 100, 101, 102, 103 delete;

E.g. query RC_BACKUP_SET

rman@CATAPRD6> ;
1* select bs_key,completion_time from rc_backup_set where
db_id=4050733714
rman@CATAPRD6> /

BS_KEY COMPLETION_TIME
---------- --------------------
4762840 01-APR-2007 22:28:15
4762841 01-APR-2007 22:28:55
4762842 01-APR-2007 22:30:29
4762843 01-APR-2007 22:32:18
4762844 01-APR-2007 22:33:53
4762845 01-APR-2007 22:37:20


3. Release the allocated maintenance channel:

release channel;

4. Start a SQL*Plus session and connect to the recovery catalog. This
example connects
to database RCAT as user RMAN:

% sqlplus rman/rman@rcat

5. Obtain the DBINC_KEY values for the incarnations whose records you
want to delete
by querying the RC_DATABASE_INCARNATION recovery catalog view:

SQL> SELECT * FROM rc_database_incarnation;

rman@CATAPRD6> desc rc_database_incarnation;
Name Null? Type
----------------------------------------------------- --------
------------------------------------
DB_KEY NOT NULL NUMBER
DBID NOT NULL NUMBER
DBINC_KEY NOT NULL NUMBER
NAME NOT NULL
VARCHAR2(8)
RESETLOGS_CHANGE# NOT NULL NUMBER
RESETLOGS_TIME NOT NULL DATE
CURRENT_INCARNATION
VARCHAR2(3)
PARENT_DBINC_KEY NUMBER

6. Execute the following DML statement, where key_value is the value of
DBINC_KEY:

SQL> DELETE FROM dbinc WHERE dbinc_key=key_value;

RMAN will remove the specified incarnation records from the recovery
catalog.

rman@CATAPRD6> delete from dbinc where dbinc_key=4750552;

1 row deleted.

rman@CATAPRD6> commit;

RMAN> list incarnation of database GEN3Q
2> ;

RMAN-03022: compiling command: list

List of Database Incarnations
DB Key Inc Key DB Name DB ID CUR Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
4750551 4757334 GEN3Q 4050733714 NO 36172261409 31-MAR-2007
12:19:51
4750551 4760656 GEN3Q 4050733714 YES 36172261409 31-MAR-2007
22:35:06

No comments: