ORA-19504与ORA-27038

来源:互联网 发布:手机淘宝触屏版登陆 编辑:程序博客网 时间:2024/05/22 03:20

 问题报错:

ORA-19504: failed to create file "/home/oracle/rman_test/119.                               cp"
ORA-27038: created file already exists

 

报错过程:

RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK                                TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKU                               PSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #                                default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;                                # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/produ                               ct/10.2.0/db_1/dbs/snapcf_pacs2.f'; # default

RMAN>
RUN {
ALLOCATE CHANNEL d1 TYPE disk;
set limit channel d1 kbytes=10000;
backup datafile 4 FORMAT '/home/oracle/rman_test/119.cp' ;}
RMAN> 2> 3> 4>

released channel: ORA_DISK_1
allocated channel: d1
channel d1: sid=146 devtype=DISK


Starting backup at 29-DEC-12
channel d1: starting full datafile backupset
channel d1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/app/oracle/oradata/pacs2/u                               sers01.dbf
channel d1: starting piece 1 at 29-DEC-12
channel d1: finished piece 1 at 29-DEC-12
piece handle=/home/oracle/rman_test/119.cp tag=TAG20121229T16                               5316 comment=NONE
channel d1: starting piece 2 at 29-DEC-12
released channel: d1
RMAN-00571: =================================================                               ==========
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =====                               ==========
RMAN-00571: =================================================                               ==========
RMAN-03009: failure of backup command on d1 channel at 12/29/                               2012 16:53:20
ORA-19504: failed to create file "/home/oracle/rman_test/119.                               cp"
ORA-27038: created file already exists
Additional information: 1

 


login as: root
root@192.168.174.10's password:
Last login: Sat Dec 29 14:36:51 2012 from 192.168.174.100
[root@STPACS ~]#
[root@STPACS ~]#
[root@STPACS ~]#
[root@STPACS ~]#
[root@STPACS ~]# su - oracle
[oracle@STPACS ~]$ cd /home/oracle
[oracle@STPACS ~]$ ls
archive_log_test     dump_test  rman_test  test_expall.dmp
dbapp_hrexample.dmp  f5.cp      sqldr
[oracle@STPACS ~]$ cd rman_test

[oracle@STPACS rman_test]$ ls -al
total 8
drwxr-xr-x  2 oracle oinstall 4096 Dec 29 16:53 .
drwx------  8 oracle oinstall 4096 Dec 29 14:39 ..
[oracle@STPACS rman_test]$ cd ..
[oracle@STPACS ~]$ ls -al
total 188428
drwx------  8 oracle oinstall      4096 Dec 29 14:39 .
drwxr-xr-x  4 root   root          4096 Oct 27 11:59 ..

 

 

问题解决过程:


比较诡异,开始上网搜索,网上已经有网友遇到过这个问题,我上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


原来是rman要求我们增加%U参数,添加参数到脚本中后再次尝试备份,就正常备份了,过程如下:


RMAN> RUN {
ALLOCATE CHANNEL d1 TYPE disk;
set limit channel d1 kbytes=10000;
backup datafile 4 FORMAT '/home/oracle/rman_test/119.cp%U' ;}2> 3> 4>

allocated channel: d1
channel d1: sid=146 devtype=DISK


Starting backup at 29-DEC-12
channel d1: starting full datafile backupset
channel d1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/app/oracle/oradata/pacs2/users01.dbf
channel d1: starting piece 1 at 29-DEC-12
channel d1: finished piece 1 at 29-DEC-12
piece handle=/home/oracle/rman_test/119.cp0unu3e5l_1_1 tag=TAG20121229T170037 comment=NONE
channel d1: starting piece 2 at 29-DEC-12
channel d1: finished piece 2 at 29-DEC-12
piece handle=/home/oracle/rman_test/119.cp0unu3e5l_2_1 tag=TAG20121229T170037 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:02
Finished backup at 29-DEC-12
released channel: d1


[oracle@STPACS rman_test]$ pwd
/home/oracle/rman_test


[oracle@STPACS rman_test]$ ls -al
total 15676
drwxr-xr-x  2 oracle oinstall     4096 Dec 29 17:00 .
drwx------  8 oracle oinstall     4096 Dec 29 14:39 ..
-rw-r-----  1 oracle oinstall 10240000 Dec 29 17:00 119.cp0unu3e5l_1_1
-rw-r-----  1 oracle oinstall  5775360 Dec 29 17:00 119.cp0unu3e5l_2_1

 

总结:

这个问题在全新安装的ORACLE也同样遇到过这样的问题,所以备份集命名时最好直接加上%U参数,免得报错。

 

___________________________________________________________________________________

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

Author:   laven54 (lurou)

Email:    laven54@163.com

Blog:      http://blog.csdn.net/laven54


 

原创粉丝点击