RMAN-20039: 设置双工模式时格式中需要有 %c

在执行数据库双路径备份时遇到RMAN-20039错误,通过调整RMAN配置和备份脚本,成功实现将备份复制到两个不同路径。错误解决方案包括在格式设置中加入%c占位符,确保正确执行双工备份,最终实现了备份的完整性和双副本目标。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

应客户需求,对数据库进行备份,数据库每天备份,备份到两个路径下,之前试过备份一次,出现一定的报错

以下为数据库的日常备份脚本

run
{
    Allocate channel c1 type disk;
    Allocate channel c2 type disk;
    crosscheck archivelog all;
        delete noprompt archivelog until time 'sysdate-3';
    delete noprompt expired archivelog all;
    report obsolete;
    delete noprompt obsolete;
    backup filesperset=3 format='D:\rman\%T_%d_%s_%p.bus','D:\7dayrman\%T_%d_%s_%p.bus' as compressed backupset database;
    backup filesperset=10 format='D:\rman\%T_%d_%s_%p.arc','D:\7dayrman\%T_%d_%s_%p.bus' as compressed backupset archivelog all;
    backup format='D:\rman\%T_%d_%s_%p.ctl','D:\7dayrman\%T_%d_%s_%p.bus' current controlfile;    
    Release channel c1;
    Release channel c2;
}


#查看rman配置

show all;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   'D:\rman', 'D:\7dayrman';


#修改为,此处备份的路径

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'D:\2019-5-13';

#开始备份

run
{
    Allocate channel c1 type disk;
    Allocate channel c2 type disk;
    backup filesperset=3 format='D:\2019-5-13\%T_%d_%s_%p.bus' as compressed backupset database;
    backup filesperset=10 format='D:\2019-5-13\%T_%d_%s_%p.arc' as compressed backupset archivelog all;
    backup format='D:\2019-5-13\%T_%d_%s_%p.ctl' current controlfile;    
    Release channel c1;
    Release channel c2;
}

#出现报错
RMAN-20039: 设置双工模式时格式中需要有 %c

#根据报错修改RMAN配置为

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'D:\2019-5-13\%T_%d_%s_%p_%c';

#并修改备份脚本

run
{
    Allocate channel c1 type disk;
    Allocate channel c2 type disk;
    backup filesperset=3 format='D:\2019-5-13\%T_%d_%s_%p_%c.bus' as compressed backupset database;
    backup filesperset=10 format='D:\2019-5-13\%T_%d_%s_%p_%c.arc' as compressed backupset archivelog all;
    backup format='D:\2019-5-13\%T_%d_%s_%p_%c.ctl' current controlfile;    
    Release channel c1;
    Release channel c2;
}


#查看备份情况

alter session set NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss';
set line 200 pages 1000
select start_time,end_time,output_device_type,status,elapsed_seconds,compression_ratio,OUTPUT_BYTES/1024/1024/1024 GB 
from v$rman_backup_job_details order by start_time;

#修改RMAN的配置

show all 
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   'D:\rman', 'D:\7dayrman';


#后续发现备份目录下备份有两份,仔细研究发现rman还有以下配置

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2;


#正确的备份思路应该是修改RMAN配置为
 

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'D:\2019-5-13';
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;

#备份完成后再修改为

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   'D:\rman', 'D:\7dayrman';
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值