DELETE OBSOLETE: ORA-19606: Cannot copy or restore to snapshot control file
Problem:
When trying to delete obsolete backups, rman includes the snapshot control file, and it is unable to delete it.
RMAN> delete noprompt obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 7 days
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1353 device type=DISK
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Control File Copy 1 14-OCT-13 /mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f
Backup Set 16413 17-OCT-13
Backup Piece 16413 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16462_p1_2eomjh5d
Backup Set 16416 17-OCT-13
Backup Piece 16416 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16464_p1_2gomk9fb
Backup Set 16417 17-OCT-13
Backup Piece 16417 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16465_p1_2homk9fc
Backup Set 16415 17-OCT-13
Backup Piece 16415 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16466_p1_2iomk9fc
Backup Set 16419 17-OCT-13
Backup Piece 16419 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16468_p1_2komkd01
Backup Set 16421 17-OCT-13
Backup Piece 16421 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16470_p1_2momkggs
Backup Set 16423 17-OCT-13
Backup Piece 16423 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16472_p1_2oomkk0u
Backup Set 16425 17-OCT-13
Backup Piece 16425 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16474_p1_2qomknhg
Backup Set 16427 17-OCT-13
Backup Piece 16427 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16476_p1_2somkr1v
Backup Set 16429 17-OCT-13
Backup Piece 16429 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16478_p1_2uomkuio
Backup Set 16431 17-OCT-13
Backup Piece 16431 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16480_p1_30oml22v
Backup Set 16433 17-OCT-13
Backup Piece 16433 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16482_p1_32oml5je
Backup Set 16435 17-OCT-13
Backup Piece 16435 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16484_p1_34oml949
Backup Set 16437 17-OCT-13
Backup Piece 16437 17-OCT-13 /backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16486_p1_36omlckg
Backup Set 16452 18-OCT-13
Backup Piece 16452 18-OCT-13 /backups/RMAN_HOT/TRCPRD/db/TRCPRD_LVL1_20131018_s16500_p1_3komlusu
Backup Set 16453 18-OCT-13
Backup Piece 16453 18-OCT-13 /backups/RMAN_HOT/TRCPRD/db/TRCPRD_LVL1_20131018_s16501_p1_3lomlut0
Backup Set 16450 18-OCT-13
Backup Piece 16450 18-OCT-13 /backups/RMAN_HOT/TRCPRD/db/TRCPRD_LVL1_20131018_s16504_p1_3oomlutc
Backup Set 16451 18-OCT-13
Backup Piece 16451 18-OCT-13 /backups/RMAN_HOT/TRCPRD/db/TRCPRD_LVL1_20131018_s16505_p1_3pomlute
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16462_p1_2eomjh5d RECID=16413 STAMP=829015213
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16464_p1_2gomk9fb RECID=16416 STAMP=829040108
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16465_p1_2homk9fc RECID=16417 STAMP=829040108
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16466_p1_2iomk9fc RECID=16415 STAMP=829040108
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16468_p1_2komkd01 RECID=16419 STAMP=829043713
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16470_p1_2momkggs RECID=16421 STAMP=829047324
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16472_p1_2oomkk0u RECID=16423 STAMP=829050910
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16474_p1_2qomknhg RECID=16425 STAMP=829054512
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16476_p1_2somkr1v RECID=16427 STAMP=829058111
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16478_p1_2uomkuio RECID=16429 STAMP=829061720
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16480_p1_30oml22v RECID=16431 STAMP=829065311
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16482_p1_32oml5je RECID=16433 STAMP=829068910
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16484_p1_34oml949 RECID=16435 STAMP=829072521
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/rman_arch/TRCPRD_ARCH_20131017_s16486_p1_36omlckg RECID=16437 STAMP=829076112
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/db/TRCPRD_LVL1_20131018_s16500_p1_3komlusu RECID=16452 STAMP=829094819
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/db/TRCPRD_LVL1_20131018_s16501_p1_3lomlut0 RECID=16453 STAMP=829094824
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/db/TRCPRD_LVL1_20131018_s16504_p1_3oomlutc RECID=16450 STAMP=829094863
deleted backup piece
backup piece handle=/backups/RMAN_HOT/TRCPRD/db/TRCPRD_LVL1_20131018_s16505_p1_3pomlute RECID=16451 STAMP=829094863
Deleted 18 objects
RMAN-06207: WARNING: 1 objects could not be deleted for DISK channel(s) due
RMAN-06208: to mismatched status. Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects
RMAN-06211: ==========================
RMAN-06212: Object Type Filename/Handle
RMAN-06213: --------------- ---------------------------------------------------
RMAN-06214: Datafile Copy /mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f
Cause:
The snapshot controlfile is cataloged as a controlfile coy and is now obsolete. RMAN cannot delete this file as it is used by rman.
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TRCPRD are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backups/RMAN_HOT/TRCPRD/db/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f'; # default
Solution:
• Set new name (or location) for RMAN to use for snapshot controlfile:
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/tmp/snapcf_TRCPRD.f';
new RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/tmp/snapcf_TRCPRD.f';
new RMAN configuration parameters are successfully stored
• Crosscheck and delete the file from RMAN:
RMAN> crosscheck controlfilecopy "/mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f";
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1353 device type=DISK
validation failed for control file copy
control file copy file name=/mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f RECID=1 STAMP=828773553
Crosschecked 1 objects
RMAN> delete expired controlfilecopy "/mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f";
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1353 device type=DISK
List of Control File Copies
===========================
Key S Completion Time Ckp SCN Ckp Time
------- - --------------- ---------- ---------------
1 X 14-OCT-13 32121181196 14-OCT-13
Name: /mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f
Tag: TAG20131014T065231
Do you really want to delete the above objects (enter YES or NO)? YES
deleted control file copy
control file copy file name=/mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f RECID=1 STAMP=828773553
Deleted 1 EXPIRED objects
• Now try deleting the obsolete backups
RMAN> delete noprompt obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 7 days
using channel ORA_DISK_1
no obsolete backups found
• Set the snapshot controlfile name (or location) to original:
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f';
old RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/tmp/snapcf_TRCPRD.f';
new RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/mnt/PRDapps/oracle/trcprddb/11.2.0/dbhome_1/dbs/snapcf_TRCPRD.f';