在使用rman维护数据库备份记录的时候,通过delete obsolete命令删除文件的时候发生了ora-19606,具体报错如下:
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Control File Copy 18 26-JUN-2022 18:44:34 /u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of delete command on ORA_DISK_4 channel at 11/01/2022 13:55:45
ORA-19606: Cannot copy or restore to snapshot control file
2、查看rman参数配置,配置如下:
RMAN> show all;
RMAN configuration parameters for database with db_unique_name db1 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
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 '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f'; # default
3、解决办法
3.1、重新设置SNAPSHOT CONTROLFILE路径,设置如下:
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f.xin';
new RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f.xin';
new RMAN configuration parameters are successfully stored
3.2、交叉校验控制文件快照备份,如下:
RMAN> crosscheck controlfilecopy '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f';
released channel: ORA_DISK_1
released channel: ORA_DISK_2
released channel: ORA_DISK_3
released channel: ORA_DISK_4
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1148 instance=db1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=2095 instance=db1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=3044 instance=db1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=1703 instance=db1 device type=DISK
validation failed for control file copy
control file copy file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f RECID=18 STAMP=1108406674
Crosschecked 1 objects
3.3、删除过期的控制文件备份,如下:
RMAN> delete expired controlfilecopy '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f';
released channel: ORA_DISK_1
released channel: ORA_DISK_2
released channel: ORA_DISK_3
released channel: ORA_DISK_4
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1148 instance=db1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=2095 instance=db1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=3044 instance=db1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=1703 instance=db1 device type=DISK
List of Control File Copies
===========================
Key S Completion Time Ckp SCN Ckp Time
------- - -------------------- ---------- --------------------
18 X 26-JUN-2022 18:44:34 16374875748810 26-JUN-2022 18:44:33
Name: /u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f
Tag: TAG20220626T184432
Do you really want to delete the above objects (enter YES or NO)? yes
deleted control file copy
control file copy file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f RECID=18 STAMP=1108406674
Deleted 1 EXPIRED objects
3.4、将控制文件快照路径再设置成原来的参数值,如下:
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f';
old RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f.xin';
new RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_db1.f';
new RMAN configuration parameters are successfully stored
至此,使用rman维护删除过期的备份文件成功。