RMAN ORA-19504、ORA-27038错误解决方法

一客户目前正在上IBM TSM的项目,现在要求临时用RMAN将生产库的数据备份到本地, rman常规备份很简单,给了客户如下的脚本:
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup full tag ‘dbfull’ format ‘/oracle/app/backup/full%Y_%M_%t_A’ database;
sql ‘alter system archive log current’;
backup filesperset 3 format ‘/oracle/app/backup/arch%Y_%M_%t_A’ archivelog all;
release channel c1;
release channel c2;
}

但昨天收到客户电话说备份有点问题,出错信息如下:
released channel: c1
released channel: c2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571:
===========================================================
RMAN-03002: failure of release command at 08/01/2009 17:12:44
RMAN-06012: channel: c2 not allocated

系统提示没有分配channel c2,报要创建的文件已经存在,我在虚拟机分别在9i、10g的环境中测试也有类似的错误:
9i:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on c1 channel at 08/04/2009 09:27:03
ORA-19504: failed to create file “/home/oracle/backup/arch2009_08_693998821″
ORA-27038: skgfrcre: file exists

10g:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on c1 channel at 08/04/2009 08:34:43
ORA-19504: failed to create file “/home/oracle/backup/full2009_08_A”
ORA-27038: created file already exists

这个问题第一次在客户的测试机上执行是成功的,第二次报错,在我自己测试的时候,全新安装的ORACLE也有这样的问题,为什么会出现这样的问题,请看下面的分析:
1.错误中指定要创建的文件已经,而实际上是并不存在,也没有用先前的备份的数据恢复过数据库。考虑是不是在OS层面删除过备份文件,而没有在RMAN中更新,试着更新RMAN:
RMAN>crosscheck archivelog all;
RMAN>delete expired archivelog all;
RMAN>crosscheck backup;
RMAN>delete expired backup;

做了更新之后,问题依旧。
2.会不会是目录(/home/oracle/backup)权限的问题,修改目录权限:
#chmod –R 775 /home/oracle/backup
再执行备份,问题仍旧。
3.试着让oracle自动分配通道,但配置RMAN的并行度为2
RMAN>configure device type disk parallelism2;
尝试着再次备份,问题仍然是channel c2没有分配通道。
此时,伟大的google对此问题已经搜不到有用的信息,没办法,只能找metalink了,在Doc ID: 1082911.6
上找到答案,原文如下:
    Solution Description:
    =====================
    Insert a %U into the format portion of the backup script in order to ensure a unique backup file name.
    Problem Explanation:
    ====================
    These errors occur because a backup file name already exists by the name specified in you backup script. For instance, if you are using the line “allocate channel c1 type disk format
    ‘/oracle/database/rman/backup/df_%d_%p_%c’;”, df_%d_%p_%c formats the backupstring like so;
    df_ is simply a name. This could be any set of characters. In this case it means
    database full.
    %d_ is the database sid.
    %p_is the backup piece number within the backup set.
    %c_ specifies the copy number of the backup piece within a set of duplexed backup pieces.
    There needs to be a %U added to the format string.
    %U_ specifies a convenient shorthand that guarantees uniqueness in generated backup filenames. So, if the string were “db_%d_%U_%p_%c a unique name would be generated and it would not be necessary to either rename or move the backup file name prior to the next backup.
    If the format is changed to include the %U, for instance;
    allocate channel c1 type disk format ‘/oracle/database/rman/backup/df_%d_%U_%p_%c’;
    The backup file will automatically have a unique name generated like;
    df_JTG_0eblfm65_1_1_1_1
    The next one would look like;
    df_JTG_0fblfm76_1_1_1_1
增加%U参数后再次尝试备份:
RMAN> run{
2>  allocate channel c1 type disk;
3>  allocate channel c2 type disk;
4>  backup full tag ‘dbfull’ format ‘/home/oracle/backup/full%Y_%M_%U_A’ database;
5>  sql ‘alter system archive log current’;
6>  backup filesperset 3  format ‘/home/oracle/backup/arch%Y_%M_%U_A’ archivelog all;
7>  release channel c1;
8>  release channel c2;
9>  }

released channel: ORA_DISK_1
released channel: ORA_DISK_2
allocated channel: c1
channel c1: sid=144 devtype=DISK
allocated channel: c2
channel c2: sid=146 devtype=DISK
……
……
channel c1: starting piece 1 at 04-AUG-09
channel c1: finished piece 1 at 04-AUG-09
piece handle=/home/oracle/backup/arch2009_08_3pklr29q_1_1_A tag=TAG20090804T083659 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
Finished backup at 04-AUG-09
released channel: c1
released channel: c2
RMAN>

至此,备份成功问题得到解决。
-The End-


参考至:http://www.ochef.net/tag/rmanora-19504ora-27038

如有错误,欢迎指正

邮箱:[email protected]

你可能感兴趣的:(rman)