Thursday, July 05, 2007

RMAN: How to delete backup of archivelog in catalog after deleting by OS command

========================================================================
==
How to delete backup of archivelog in catalog after deleting by OS
command
========================================================================
==
Environment: Oracle 8i

1. Resync catalog if necessary

2. Query RC_BACKUP_SET
2.1 Log into catalog db as catalog user:
sqlplus rman/xxx@catp92a

2.2 Generate RMAN command to crosscheck backupset of archivelog for next

step. (dbid represents GENB database)
------------------------------------------------------------------------
--
select 'change backupset ' || bs_key || ' crosscheck;' || ' # ' ||
completion_time
from rc_backup_set
where db_id=3427423174
and completion_time > sysdate - 7
and completion_time < sysdate - 1
and backup_type='L'
/

Sample Output:

change backupset 19565786 crosscheck; # 28-JUN-2007 19:56:06
change backupset 19565787 crosscheck; # 28-JUN-2007 19:56:06
change backupset 19676247 crosscheck; # 03-JUL-2007 21:02:26
change backupset 19676248 crosscheck; # 03-JUL-2007 21:04:26
change backupset 19676249 crosscheck; # 03-JUL-2007 21:06:04
change backupset 19676250 crosscheck; # 03-JUL-2007 21:07:43
change backupset 19676251 crosscheck; # 03-JUL-2007 21:09:02
change backupset 19676252 crosscheck; # 03-JUL-2007 21:10:18
change backupset 19676253 crosscheck; # 03-JUL-2007 21:11:32
change backupset 19676254 crosscheck; # 03-JUL-2007 21:12:44
change backupset 19676259 crosscheck; # 04-JUL-2007 21:00:52


3. Cross check the backupset of archivelog
rman target / catalog rman/xxx@catp92a
allocate channel for maintenance type disk;
execute the command obtained in step 2

4. Delete expired backup of archivelog;
rman target / catalog rman/xxx@catp92a

Example syntax to delete expired backup of archivelog
-----------------------------------------------------
delete expired backup of archivelog from time '28-JUN-2007' until
time '04-JUL-2007';

Note: If it just hang there for more than 10 min, ctrl-c then take
following action:

Action:
~~~~~~
4.1 Connect without catalog:
rman target / nocatalog
then issue:
RMAN> allocate channel for maintenance type disk;
RMAN> delete expired backup of archivelog from time '28-JUN-2007'
until
time '04-JUL-2007';
4.2 Connect to target and catalog databases issue:
RMAN> resync catalog;

No comments: