Oracle 11gR2使用RMAN duplicate from active database复制数据库(二)
1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl2)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl2)
)
)
6. 开始RMAN duplicate from active database:
注意:如果target 和 Auxiliary库的目录结构相同,记得加上nofilenamecheck参数,不然会报如下错误:
RMAN-05001: auxiliary file name /u01/app/oracle/oradata/orcl/users01.dbf conflicts with a file used by the target database
如果目录不同,在pfile里加如下2个参数进行转换:
db_file_name_convert
log_file_name_convert.
[oracle@rhel5 dbs]$ rman target / auxiliary sys/oracle@orcl2_au
Recovery Manager: Release 11.2.0.1.0 - Production on Mon Oct 21 21:33:44 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL2 (DBID=810247392)
connected to auxiliary database: ORCL2 (not mounted)
RMAN> run {
2> allocate channel prmy1 type disk;
3> allocate channel prmy2 type disk;
4> allocate channel prmy3 type disk;
5> allocate auxiliary channel stby1 type disk;
6> duplicate target database to orcl2 from active database nofilenamecheck spfile;
7> }
using target database control file instead of recovery catalog
allocated channel: prmy1
channel prmy1: SID=31 device type=DISK
allocated channel: prmy2
channel prmy2: SID=36 device type=DISK
allocated channel: prmy3
channel prmy3: SID=40 device type=DISK
allocated channel: stby1
channel stby1: SID=20 device type=DISK
Starting Duplicate Db at 21-OCT-13
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl2.ora' auxiliary format
'/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl2.ora' ;
sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl2.ora''";
}
executing Memory Script
Starting backup at 21-OCT-13
Finished backup at 21-OCT-13
sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl2.ora''
contents of Memory Script:
{
sql clone "alter system set db_name =
''ORCL2'' comment=
''duplicate'' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''ORCL2'' comment= ''duplicate'' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 637537872 bytes
Database Buffers 205520896 bytes
Redo Buffers 5132288 bytes
allocated channel: stby1
channel stby1: SID=19 device type=DISK
contents of Memory Script:
{
sql clone "alter system set db_name =
''ORCL2'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''ORCL2'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/oradata/orcl2/datafiles/control01.ctl';
restore clone controlfile to '/oradata/orcl2/datafiles/control02.ctl' from
'/oradata/orcl2/datafiles/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''ORCL2'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''OR