Kevin Kempf's Blog

June 30, 2009

Don’t Delete those Standby Controlfiles!

Filed under: Oracle, RMAN — Tags: , — kkempf @ 11:55 am

As I stated earlier, I started using RMAN to run disk-based backups on my ERP systems. I hit this warning at the end of my production backups:

RMAN> delete noprompt obsolete device type disk;
RMAN> retention policy will be applied to the command
RMAN> retention policy is set to recovery window of 31 days
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
——————– —— —————— ——————–
Control File Copy 3 22-MAY-09 /tmp/cntrl01.dbf
Control File Copy 4 26-MAY-09 /scratch/oracle/dba/sbcnt.dbf

RMAN-06207: WARNING: 2 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 /tmp/cntrl01.dbf
RMAN-06214: Datafile Copy /scratch/oracle/dba/sbcnt.dbf

I’d created these standby control files in a “junk” directory because I was rebuilding my dataguard environment in an attempt to reproduce the Advanced Compression/Dataguard bug I am hitting. Never thought that deleting the files when I was done with them would cause me grief later. Well, turns out RMAN policy would have just cleaned them up for me… if I’d left them there…

Typical Oracle, it tells you to run crosscheck, which in reality just spits out the error shown above. What you really need to do is get rid of the references in the repository/controlfile to these files. Took me a few tries, but the syntax to fix this is below:

Recovery Manager: Release 11.1.0.7.0 – Production on Tue Jun 30 10:53:05 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: PROD (DBID=4098162468)
connected to recovery catalog database

RMAN> delete force noprompt obsolete device type disk;

RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 31 days
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1029 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=870 device type=DISK
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
——————– —— —————— ——————–
Control File Copy 1736660 22-MAY-09 /tmp/cntrl01.dbf
Control File Copy 1754731 26-MAY-09 /scratch/oracle/dba/sbcnt.dbf
deleted control file copy
control file copy file name=/tmp/cntrl01.dbf RECID=3 STAMP=687543221
deleted control file copy
control file copy file name=/scratch/oracle/dba/sbcnt.dbf RECID=4 STAMP=687890578
Deleted 2 objects

Advertisements

Create a free website or blog at WordPress.com.