有很多迁移的情况都是要将文件系统上的数据文件拷贝到asm上面,所以做了个测试。
1,配置两个库的密码文件$ORACLE_HOME/dbs
2,源库mount目标库nomount
3,使用单个文件的方式拷贝
cnsz130664:um2 > rman
RMAN> connect target sys/sys
connected to target database: UM2 (DBID=1036225299)
using target database control file instead of recovery catalog
RMAN> connect auxiliary sys/sys@hd01um2
connected to auxiliary database: HD01UM2 (not mounted)
RMAN> backup as copy reuse datafile 1 auxiliary format '+DATA_DG';
Starting backup at 2012-05-28 19:34:39
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=72 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/data02/impdp_temp/hd01um2/system.309.779387751
output file name=+DATA_DG/hd01um2/datafile/system.369.784496083 tag=TAG20120528T193440
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:56
Finished backup at 2012-05-28 19:35:36
RMAN> exit
或者可以使用全库拷贝的方式,将所有的数据文件都拷贝到asm磁盘中
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
backup as copy database auxiliary format '+STG_DATA_DG';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
注意: 11g的target不能使用connect target /这种方式连接,否则会出现用户名或者密码错误。
cnsz081044: > rman
Recovery Manager: Release 11.2.0.2.0 - Production on Sat Feb 8 20:02:52 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN> connect target /
connected to target database: INVESTDW (DBID=3901563815, not open)
RMAN> connect AUXILIARY sys/paic1234@stginvdw
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-04006: error from auxiliary database: ORA-01017: invalid username/password; logon denied
RMAN> connect AUXILIARY sys/Paic1234@stginvdw
connected to auxiliary database: STGINVDW (DBID=3901563815)
RMAN> backup as copy reuse datafile 15 auxiliary format '+DATA_DG';
Starting backup at 2014-02-08 20:03:26
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=570 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00015 name=/paic/hq/bk/restore/data/oradata/investdw/irplogtmpidx.269.791812405
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 02/08/2014 20:03:28
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-01017: invalid username/password; logon denied
ORA-17629: Cannot connect to the remote database server
另外必须保证asm磁盘空间足够,否则会出现一部分拷贝成功一部分拷贝失败!
channel c4: starting datafile copy
input datafile file number=00002 name=/paic/hq/bk/restore/data/oradata/investdw/sysaux.263.791812311
RMAN-03009: failure of backup command on c4 channel at 02/08/2014 06:25:00
ORA-17628: Oracle error 19505 returned by remote Oracle server
continuing other job steps, job failed will not be re-run
channel c4: starting datafile copy
input datafile file number=00001 name=/paic/hq/bk/restore/data/oradata/investdw/system.264.791812321
output file name=+DATA2_DG/stginvdw/datafile/invbidata.782.838960677 tag=TAG20140207T230158
channel c3: datafile copy complete, elapsed time: 01:49:58
channel c3: starting datafile copy
input datafile file number=00018 name=/paic/hq/bk/restore/data/oradata/investdw/agrdata.328.797471577
output file name=+DATA2_DG/stginvdw/datafile/system.619.838967101 tag=TAG20140207T230158
channel c4: datafile copy complete, elapsed time: 00:05:30
released channel: c1
released channel: c2
released channel: c3
released channel: c4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on c4 channel at 02/08/2014 06:25:00
ORA-17628: Oracle error 19505 returned by remote Oracle server
RMAN-03009: failure of backup command on c4 channel at 02/08/2014 05:29:18
ORA-17628: Oracle error 19505 returned by remote Oracle server