【Oracle】RMAN备份失败报错RMAN-03002,RMAN-06091

RMAN备份脚本执行失败,报错如下:
RMAN-03002: failure of delete command at 12/30/2013 13:51:36
RMAN-06091: no channel allocated for maintenance (of an appropriate type)

或者是:
RMAN-03002: failure of crosscheck command at 12/30/2013 13:51:36
RMAN-06091: no channel allocated for maintenance (of an appropriate type)

查看错误代码解释:
[oracle@rhel75 ~]$ oerr rman 06091
6091, 1, “no channel allocated for maintenance (of an appropriate type)”
// *Cause: A command was entered that requires a maintenance channel, and no
// maintenance channel is allocated, or none of the appropriate type.
// *Action: Use ALLOCATE CHANNEL FOR MAINTENANCE before deleting backup
// pieces, or using the CROSSCHECK or DELETE EXPIRED commands.
// Proxy copies require a non-DISK channel.

查看原脚本写法:

RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
send 'NB_ORA_POLICY=XXX, NB_ORA_SERV=XXX,NB_ORA_CLIENT=XXX';
BACKUP
   filesperset 20
   FORMAT 'al_%s_%p_%t'
   ARCHIVELOG ALL;
   delete noprompt archivelog all completed before 'sysdate-3';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
send 'NB_ORA_POLICY=XXX, NB_ORA_SERV=XXX,NB_ORA_CLIENT=XXX';
BACKUP
    # recommended format
    FORMAT 'cntrl_%s_%p_%t'
    CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}

看报错代码描述,删除备份片或执行crosscheck或delete expired时需要分配维护通道,则改写脚本如下:

RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
send 'NB_ORA_POLICY=XXX, NB_ORA_SERV=XXX,NB_ORA_CLIENT=XXX';
BACKUP
    $BACKUP_TYPE
    SKIP INACCESSIBLE
    TAG hot_db_bk_level0
    FILESPERSET 5
    FORMAT 'bk_%s_%p_%t'
    DATABASE;
    sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
ALLOCATE CHANNEL ch00  TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01  TYPE 'SBT_TAPE';
send 'NB_ORA_POLICY=XXX, NB_ORA_SERV=XXX,NB_ORA_CLIENT=XXX';
BACKUP
   filesperset 20
   FORMAT 'al_%s_%p_%t'
   ARCHIVELOG ALL;
   #crosscheck archivelog all;
   #delete noprompt archivelog all completed before 'sysdate-3';

RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;

ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
send 'NB_ORA_POLICY=XXX, NB_ORA_SERV=XXX,NB_ORA_CLIENT=XXX';
BACKUP
    FORMAT 'cntrl_%s_%p_%t'
    CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}

allocate channel for maintenance device type disk;
crosscheck archivelog all;
delete noprompt archivelog all completed before 'sysdate-3';
RELEASE CHANNEL;

===================
关于ALLOCATE CHANNEL FOR MAINTENANCE可见官方文档:
https://docs.oracle.com/cd/B28359_01/backup.111/b28273/rcmsynta005.htm#RCMRF103

Purpose:
Use the ALLOCATE CHANNEL FOR MAINTENANCE command to manually allocate a channel in preparation for issuing a CHANGE, DELETE, or CROSSCHECK command. You can use the RELEASE CHANNEL command to unallocate the channel.

Note:
If you CONFIGURE at least one channel for each device type in your configuration, then you do not need to use ALLOCATE CHANNEL FOR MAINTENANCE. It is recommended that you use configured channels instead of maintenance channels. You can use configured channels for all RMAN I/O to the specified device, not just the maintenance tasks supported by maintenance channels. The configured channels persist across RMAN sessions.

Prerequisites:
Execute this command only at the RMAN prompt, not within a RUN block. The target instance must be started. You cannot allocate a maintenance channel to a shared session.

Usage Notes

As a rule, you should allocate one maintenance channel for each device. Manually allocated channels and automatic channels are never mixed. In general, you should allocate multiple maintenance channels for a single job only in these situations:

To enable crosschecking or deletion of all backup pieces or proxy copies, both on disk and tape, with a single command (see Example 2-11)

To make crosschecking and deleting work correctly in an Oracle RAC configuration in which each backup piece or proxy copy exists only on one node (see Example 2-12)

RMAN uses the following convention for naming of maintenance channels: ORA_MAINT_devicetype_n, where devicetype refers to DISK or sbt and n refers to the channel number. For example, RMAN uses these names for two manually allocated disk channels:

ORA_MAINT_DISK_1
ORA_MAINT_DISK_2

总结如下:
(1)用CHANGE, DELETE, or CROSSCHECK命令时需要使用它。
(2)如果用CONFIGURE命令为每个设备类型分配至少一个通道,则不需要使用ALLOCATE CHANNEL FOR MAINTENANCE,而且建议使用CONFIGURE而不是维护通道。
(3)这种分配维护通道的命令需要放到run{}外面
(4)通常应为每个设备分配一个维护通道,手动分配通道和自动分配通道永远不会混合,只有在以下情况下才需要分配多个通道:
To enable crosschecking or deletion of all backup pieces or proxy copies, both on disk and tape, with a single command (see Example 2-11)

To make crosschecking and deleting work correctly in an Oracle RAC configuration in which each backup piece or proxy copy exists only on one node (see Example 2-12)
(5)维护通道命令规则: ORA_MAINT_devicetype_n
(6)以上报错case中,type应该是disk,而不是sbt,因为要删除的是本地磁盘上的归档文件,而不是带库上的归档文件。

  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值