[20160329]backup as copy问题.txt

[20160329]backup as copy问题.txt

--别人问的一个问题,想通过dg建立测试库,我建议他停止日志应用,然后使用拷贝的方式建立测试库,只要路径一样,生成一个新的控
--制文件就ok了。本来一个很简单通过nfs mount文件系统,cp就ok了。没有选择cp而使用rman的backup as copy命令方式,遇到一点点
--小问题,自己重复测试看看:

1.环境:
SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.我仅仅拷贝system表空间数据文件(copy database也一样):

RMAN> backup as copy datafile 1 format '/home/oracle/backup/%b' ;

Starting backup at 2016-03-29 09:24:24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=123 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
output file name=/home/oracle/backup/system01.dbf tag=TAG20160329T092425 RECID=3 STAMP=907752267
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
copying current control file
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/29/2016 09:24:28
ORA-19715: invalid format b for generated name
ORA-27302: failure occurred at: slgpn
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2016-03-29 09:24:29
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/29/2016 09:24:29
ORA-19715: invalid format b for generated name
ORA-27302: failure occurred at: slgpn

$ ls -l /home/oracle/backup/
total 789264
-rw-r----- 1 oracle oinstall 807411712 2016-03-29 09:24:26 system01.dbf

--实际上文件系统拷贝成功,由于使用%b格式(保留原文件名),因为拷贝system文件,会触发oracle自动备份spfile以及控制文件
--产生触发错误。
--实际上使用没有问题。

3.我看一些文档,好像还真的无法规避这个问题:
--可以使用DB_FILE_NAME_CONVERT来实现,不过很奇怪的是database必须放在最后。

BACKUP AS COPY DB_FILE_NAME_CONVERT=('/mnt/ramdisk/book/','/home/oracle/backup/') FORMAT='/home/oracle/backup/spfile_and_control_%U' database;

RMAN> BACKUP AS COPY DB_FILE_NAME_CONVERT=('/mnt/ramdisk/book/','/home/oracle/backup/') FORMAT='/home/oracle/backup/spfile_and_control_%U' datafile 1;
Starting backup at 2016-03-29 10:03:47
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
output file name=/home/oracle/backup/system01.dbf tag=TAG20160329T100347 RECID=31 STAMP=907754629
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/home/oracle/backup/spfile_and_control_cf_D-BOOK_id-1337401710_4pr1mf46 tag=TAG20160329T100347 RECID=32 STAMP=907754631
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2016-03-29 10:03:52
channel ORA_DISK_1: finished piece 1 at 2016-03-29 10:03:53
piece handle=/home/oracle/backup/spfile_and_control_4qr1mf48_1_1 tag=TAG20160329T100347 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2016-03-29 10:03:53

上一篇:解决生产环境too man open files的问题


下一篇:cocoscreator2.4 jsb自动绑定