共计 4822 个字符,预计需要花费 13 分钟才能阅读完成。
问题描述:AIX 平台 Oracle 10G, 今天发现数据库归档空间满了,就通过 crosscheck 后,执行 delete force obsolete 时报 no channel allocated for maintenance(of an appropriate type) 错误,
原因分析: 经过查询可能是因为在之前的备份过程中采用了不同设备类型备份导致不能正常删除过期的备份
解决方案:
先摘录一段对 CROSSCHECK 的描述
当 archivelog 或是 backup 被手工删除后,需要运行 crosscheck. 该命令确保 recovery catalog 或是控制文件中记录的数据与硬盘上的文件一致。
对于找不到的文件,CROSSCHECK 会把它的状态标为 EXPIRED. 然后,你运行 DELETE EXPIRED 命令就可以把 rman repository 中的相关记录和硬盘上的文件删除。
如果有些文件被错误地标为 EXPIRED, 那么在确认文件存在时,再次运行 CROSSCHECK BACKUP 可以将这些文件重置为 AVAILABLE 状态。
也就是说,对于硬盘上已经不存在的文件,用 DELETE EXPIRED 在 RMAN 中删除相关记录。对于已经超过 retention policy 的备份,用 DELETE OBSOLETE 从硬盘和磁带设备上删除, 并从 RMAN 中把记录删除。
在执行完
Crosscheck backup;
Crossscheck backuppiece;
Crosscheck archivelog all;
Delete obsolete; 报 RMAN-06091: no channel allocated for maintenance (of an appropriate type)
研究了一下,之前的备份一部分是直接备份在硬盘上, 另一部分是通过 DP 备份在磁带上的。出现这样的错误是因为有磁带上的数据,但是未申请磁带类型的 channel 造成的。
RMAN> allocate channel for maintenance type disk;
allocated channel: ORA_MAINT_DISK_6
channel ORA_MAINT_DISK_6: sid=137 devtype=DISK
RMAN> delete expired archivelog all;
specification does not match any archive log in the recovery catalog
这个应该是正常的,没有发现 expired log.
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
——————– —— —————— ——————–
Backup Set 2499 2011-11-24 11:39:28
Backup Piece 2511 2011-11-24 11:39:28 swt-oracle-full<gz_7:768051562:1>.dbf
…
Backup Set 2564 2011-11-26 21:18:57
Backup Piece 2567 2011-11-26 21:18:57 /backup/arc0dmsld1e
…
Backup Set 2950 2011-12-14 14:45:40
Backup Piece 2955 2011-12-14 14:45:40 /u01/oracle/flash_recovery_area/GZ/backupset/2011_12_14/o1_mf_annnn_TAG20111214T144526_7gjkjly0_.bkp
…
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 12/15/2011 17:05:42
RMAN-06091: no channel allocated for maintenance (of an appropriate type)
这里出错了
解决的办法是分别删除硬盘上与磁带上的过期备份数据。
RMAN>delete obsolete device type disk;– 指定设备类型,这样就可以删除指定的设备中的数据
删除硬盘上的过期备份
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
——————– —— —————— ——————–
Backup Set 2509 2011-11-24 14:28:32
Backup Piece 2521 2011-11-24 14:28:32 /backup/sp
Backup Set 2564 2011-11-26 21:18:57
Backup Piece 2567 2011-11-26 21:18:57 /backup/arc0dmsld1e
Backup Set 2565 2011-11-26 21:19:20
Backup Piece 2568 2011-11-26 21:19:20 /backup/arc0emsld29
Control File Copy 2709 2011-11-26 21:42:33 /var/opt/omni/tmp/ctrl_gz.dbf
Backup Set 2885 2011-11-27 20:44:15
Backup Piece 2888 2011-11-27 20:44:15 /backup/db_full_31.1
Control File Copy 2898 2011-11-27 20:43:57 /backup/bj.ctl
Backup Set 2886 2011-11-27 20:44:21
Backup Piece 2889 2011-11-27 20:44:21 /backup/db_full_32.1
Backup Set 2950 2011-12-14 14:45:40
Backup Piece 2955 2011-12-14 14:45:40 /u01/oracle/flash_recovery_area/GZ/backupset/2011_12_14/o1_mf_annnn_TAG20111214T144526_7gjkjly0_.bkp
Backup Set 2951 2011-12-14 14:45:46
…
Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/backup/db_full_31.1 recid=31 stamp=768343384
deleted control file copy
control file copy filename=/backup/bj.ctl recid=4 stamp=768343437
deleted backup piece
backup piece handle=/backup/db_full_32.1 recid=32 stamp=768343461
deleted backup piece
backup piece handle=/u01/oracle/flash_recovery_area/GZ/backupset/2011_12_14/o1_mf_annnn_TAG20111214T144526_7gjkjly0_.bkp recid=38 stamp=769877137
deleted backup piece
…
Deleted 17 objects
deleted backup piece
backup piece handle=/backup/sp recid=11 stamp=768061712
deleted backup piece
backup piece handle=/backup/arc0dmsld1e recid=13 stamp=768259119
deleted backup piece
backup piece handle=/backup/arc0emsld29 recid=14 stamp=768259146
Deleted 3 objects
这回成功了
RMAN> allocate channel for maintenance device type ‘sbt_tape’ PARMS ‘ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=gz,OB2BARLIST=swt-oracle-full)’;
这里 PARMS 后面的参数与备份时 RMAN 脚本中的参数相同
allocated channel: ORA_MAINT_SBT_TAPE_7
channel ORA_MAINT_SBT_TAPE_7: sid=136 devtype=SBT_TAPE
channel ORA_MAINT_SBT_TAPE_7: Data Protector A.06.11/243
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
——————– —— —————— ——————–
Backup Set 2499 2011-11-24 11:39:28
Backup Piece 2511 2011-11-24 11:39:28 swt-oracle-full<gz_7:768051562:1>.dbf
…
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=swt-oracle-full<gz_7:768051562:1>.dbf recid=1 stamp=768051562
…
Deleted 26 objects
这样就成功了
更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-10/147421.htm