【排故篇】_RMAN-06091报错备记: no channel allocated for maintenance

【引言】
邮件今天告警,有一Oracle数据库出现备份告警。备份脚本在执行delete noprompt obsolete;时报RMAN-06091: no channel allocated for maintenance (of an appropriate type)错误,经过查询可能是因为在之前的备份过程中,因为手动发起过备份,且采用了不同设备类型备份导致,故不能正常删除过期的备份,本文记录下分析解决过程。

备份脚本使用tsm远程带库的方式进行,备份前,会执行如下命令删除过期的备份集(见如下标粗处)。
RMAN> allocate channel for maintenance type disk;
2> change archivelog all validate;
3> release channel;
4> report obsolete;
5> allocate channel for maintenance device type ‘sbt_tape’ parms
6> ‘ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)’;
7> delete noprompt obsolete;

8> RUN {
9> allocate channel t1 type ‘sbt_tape’ parms
10> ‘ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)’;
11> backup incremental level 0 database include current controlfile format ‘df_%t_%s_%p’ filesperset=10;
12> sql ‘alter system archive log current’;
13> backup filesperset 20 format ‘al_t%t_s%s_p%p’ (archivelog all delete input);
14> RELEASE CHANNEL t1;
15> }
16> exit;

报错信息如下:
allocated channel: ORA_MAINT_SBT_TAPE_1
channel ORA_MAINT_SBT_TAPE_1: SID=2627 device type=SBT_TAPE
channel ORA_MAINT_SBT_TAPE_1: Data Protection for Oracle: version 5.5.2.0

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle


Backup Set 2682445 10-NOV-19
Backup Piece 2682449 10-NOV-19 df_1023991215_215_1
Backup Set 2682446 10-NOV-19
Backup Piece 2682450 10-NOV-19 df_1023991470_216_1
Backup Set 2682499 10-NOV-19
Backup Piece 2682501 10-NOV-19 al_t1023991654_s219_p1
Backup Set 2695904 11-NOV-19
Backup Piece 2695913 11-NOV-19 c-1250661851-20191111-01
Backup Set 2705870 12-NOV-19
Backup Piece 2705872 12-NOV-19
/oradata/group/fast_recovery_area/group_fra/GROUP/autobackup/2019_11_12/o1_mf_n_1024135029_gwn4cong_.bkp
Backup Set 2705884 12-NOV-19
Backup Piece 2705888 12-NOV-19 df_1024164411_230_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 12/01/2019 18:00:12
RMAN-06091: no channel allocated for maintenance (of an appropriate type)

Recovery Manager complete.
Backup End

原因分析:
原因很简单,因为在之前的备份过程中采用了不同设备类型备份,导致不能正常删除过期的备份。从上面报错提示,可以判断之前的备份一部分是直接备份在硬盘disk上(标粗处),另一部分是通过tsm备份在磁带SBT_TAPE上。出现上述错误是因为有磁带上的备份集,但是未申请磁带类型的channel造成的。

这里介绍下CROSSCHECK命令的作用:
RMAN always maintains metadata about backups in the control file of every target database on which it performs operations. If you use RMAN with a recovery catalog, then RMAN also maintains the metadata from every registered database in the recovery catalog.
If a backup is on disk, then CROSSCHECK determines whether the header of the file is valid. If a backup is on tape, then RMAN queries the RMAN repository for the names and locations of the backup pieces to be checked. RMAN sends this metadata to the target database server, which queries the media management software about the backups. The media management software then checks its media catalog and reports back to the server with the status of the backups.
EXPIRED and AVAILABLE Status
You can view the status of backup sets and copies recorded in the RMAN repository through LIST, V$ views, or recovery catalog views (if you use RMAN with a catalog). Table 2-4 describes the meaning of each status.
The CROSSCHECK command only processes files created on the same device type as the channels used for the crosscheck. The CROSSCHECK command checks only objects marked AVAILABLE or EXPIRED in the repository by examining the files on disk for DISKchannels or by querying the media manager for sbt channels.

通常,
当archivelog或backup被手工删除后,需要运行crosscheck以确保recovery catalog或是控制文件中记录的数据与硬盘上的文件一致。对于找不到的文件,CROSSCHECK会把它的状态标为EXPIRED。然后使用DELETE EXPIRED命令把rman repository中的相关记录和硬盘上的文件删除。如果文件被错误地标为EXPIRED,在确认文件存在后,再一次使用CROSSCHECK BACKUP可以将这些文件置为AVAILABLE。

对于已经超过retention policy的备份,用DELETE OBSOLETE从硬盘和磁带设备上删除,并从RMAN中把记录删除。

解决方案:
手动分别删除下磁带库SBT_TAPE的备份集和硬盘disk的备份集即可。
步骤如下:

1. 使用crosscheck命令扫描一遍备份集合
RMAN> allocate channel for maintenance device type ‘sbt_tape’ parms ‘ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)’;
RMAN> crosscheck backup;
RMAN> allocate channel for maintenance type disk;
RMAN> crosscheck backup;

2.删除SBT_TAPE的备份集和硬盘disk的备份集
RMAN> allocate channel for maintenance device type ‘sbt_tape’ parms ‘ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)’;
RMAN> delete obsolete;

RMAN> allocate channel for maintenance type disk;
RMAN> delete obsolete;

3.再行执行全备命令

Rman> RUN {
2> allocate channel t1 type ‘sbt_tape’ parms
3> ‘ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)’;
4> backup incremental level 0 database include current controlfile format ‘df_%t_%s_%p’ filesperset=10;
5> sql ‘alter system archive log current’;
6> backup filesperset 20 format ‘al_t%t_s%s_p%p’ (archivelog all delete input);
7> RELEASE CHANNEL t1;
8> }

Starting Control File Autobackup at 05-DEC-19
piece handle=c-1250661851-20191205-01 comment=API Version 2.0,MMS Version 5.5.2.0
Finished Control File Autobackup at 05-DEC-19

released channel: t1

Recovery Manager complete.
Backup End
Thu Dec 5 18:07:44 CST 2019
Thu Dec 5 18:07:44 CST 2019
Backup Starting
Thu Dec 5 21:00:01 CST 2019
Backup End
Thu Dec 5 21:00:01 CST 2019

备份正常完成。

以下是个人微信公众号“一森咖记”,欢迎关注
在这里插入图片描述

发布了54 篇原创文章 · 获赞 3 · 访问量 5504

猜你喜欢

转载自blog.csdn.net/db_murphy/article/details/103414478