测试使用 Active database duplicate在不同机器不同数据库实例复制数据库

环境:

Target DB:

IP:10.131.119.118 

HOSTNAME:CS-SI-DG01

ORACLE_SID:orcl


Auxiliary DB:

IP:10.131.119.119

HOSTNAME:CS-SI-DG02

ORACLE_SID:orclaux


1.将Target DB库的参数文件和密码文件scp到Auxiliary DB库

[oracle@CS-SI-DG01 dbs]$ pwd

/u2/oracle/product/11.2.0/dbhome_1/dbs

[oracle@CS-SI-DG01 dbs]$ scp initorcl.ora 10.131.119.119:/u2/oracle/product/11.2.0/dbhome_1/dbs

oracle@10.131.119.119's password: 

Permission denied, please try again.

oracle@10.131.119.119's password: 

stty: standard input: Invalid argument

spfileorcl.ora                                   100% 3584     3.5KB/s   00:00    

[oracle@CS-SI-DG01 dbs]$ scp orapworcl 10.131.119.119:/u2/oracle/product/11.2.0/dbhome_1/dbs

oracle@10.131.119.119's password: 

stty: standard input: Invalid argument

orapworcl                                        100% 1536     1.5KB/s   00:00    


2.在Auxiliary DB库修改文件名与修改参数文件内容

[oracle@CS-SI-DG02 dbs]$ pwd

/u2/oracle/product/11.2.0/dbhome_1/dbs

[oracle@CS-SI-DG02 dbs]$ mv initorcl.ora initorclaux.ora 

[oracle@CS-SI-DG02 dbs]$ mv orapworcl orapworclaux


[oracle@CS-SI-DG02 dbs]$ cat initorclaux.ora 

*._undo_autotune=TRUE

*.audit_file_dest='/u2/oracle/admin/orclaux/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='/oradata/orclaux/control01.ctl','/oradata/orclaux/control02.ctl'#Restore Controlfile

*.db_block_size=8192

*.db_domain=''

*.db_name='orclaux'

*.db_recovery_file_dest='/u2/oracle/fast_recovery_area'

*.db_recovery_file_dest_size=8589934592

*.diagnostic_dest='/u2/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclauxXDB)'

*.job_queue_processes=1000

*.log_archive_dest_1='location=/oradata/arch/orclaux'

*.log_archive_dest_10=' '

*.memory_max_target=0

*.memory_target=0

*.open_cursors=300

*.pga_aggregate_target=171966464

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.session_cached_cursors=240

*.sga_target=335544320

*.undo_retention=60

*.undo_tablespace='UNDOTBS2'

*.db_file_name_convert=('/oradata/orcl/','/oradata/orclaux/')

*.log_file_name_convert=('/oradata/orcl/','/oradata/orclaux/')


3.在Auxiliary DB库建立必要的目录

[oracle@CS-SI-DG02 dbs]$ mkdir -p /u2/oracle/admin/orclaux/adump

[oracle@CS-SI-DG02 dbs]$ mkdir -p /oradata/orclaux/

[oracle@CS-SI-DG02 dbs]$ mkdir -p /oradata/arch/orclaux


4.在Auxiliary DB库启动到nomount状态


[oracle@CS-SI-DG02 orclaux]$ export ORACLE_SID=orclaux

[oracle@CS-SI-DG02 orclaux]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Sun Jan 24 11:32:47 2016


Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to an idle instance.


SQL> startup nomount

ORACLE instance started.


Total System Global Area  509411328 bytes

Fixed Size                  2229824 bytes

Variable Size             285215168 bytes

Database Buffers          213909504 bytes

Redo Buffers                8056832 bytes


5.在Auxiliary DB库与Target DB库中配置监听与TNS

Target DB:

[oracle@CS-SI-DG01 admin]$ cat listener.ora   --监听配置

# listener.ora Network Configuration File: /u2/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = orcl)

      (ORACLE_HOME = /u2/oracle/product/11.2.0/dbhome_1)

      (SID_NAME = orcl)

    )

  )


LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.131.119.118)(PORT = 1521))

    )

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

  )


ADR_BASE_LISTENER = /u2/oracle


                               

[oracle@CS-SI-DG01 admin]$ cat tnsnames.ora   --TNS配置

# tnsnames.ora Network Configuration File: /u2/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.



orclaux =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.131.119.119)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = orclaux)

    )

  )


[oracle@CS-SI-DG01 admin]$ lsnrctl reload     --重新加载监听

 

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 24-JAN-2016 12:09:50


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.131.119.118)(PORT=1521)))

The command completed successfully


Auxiliary DB


[oracle@CS-SI-DG02 admin]$ vi listener.ora      --监听配置


# listener.ora Network Configuration File: /u2/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = orclaux)

      (ORACLE_HOME = /u2/oracle/product/11.2.0/dbhome_1)

      (SID_NAME = orclaux)

    )

  )


LISTENER =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.131.119.119)(PORT = 1521))

  )


ADR_BASE_LISTENER = /u2/oracle


[oracle@CS-SI-DG02 admin]$ cat tnsnames.ora    --TNS配置

# tnsnames.ora Network Configuration File: /u2/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

ORCL =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.131.119.118)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = orcl)

    )

  )

orclaux =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.131.119.119)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = orclaux)

    )

  )



[oracle@CS-SI-DG02 admin]$ lsnrctl reload        --重新加载监听


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 24-JAN-2016 12:09:57


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

The command completed successfully


5.开始复制数据库


[oracle@CS-SI-DG02 admin]$ export ORACLE_SID=orclaux

[oracle@CS-SI-DG02 admin]$ rman target sys/oracle@orcl auxiliary sys/oracle@orclaux    --连接目标库与辅助库

 

Recovery Manager: Release 11.2.0.3.0 - Production on Sun Jan 24 12:38:54 2016


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (DBID=1414106639)

connected to auxiliary database: ORCLAUX (not mounted)


RMAN> duplicate target database to orclaux from active database;      --复制目标数据库到orclaux实例

注意:如果两个数据库的目录结构一样,需要在末尾加上nofilenamecheck


Starting Duplicate Db at 24-JAN-16

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=134 device type=DISK


contents of Memory Script:

{

   sql clone "create spfile from memory";

}

executing Memory Script


sql statement: create spfile from memory


contents of Memory Script:

{

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script


Oracle instance shut down


connected to auxiliary database (not started)

Oracle instance started


Total System Global Area     509411328 bytes


Fixed Size                     2229824 bytes

Variable Size                289409472 bytes

Database Buffers             209715200 bytes

Redo Buffers                   8056832 bytes


contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''ORCL'' comment=

 ''Modified by RMAN duplicate'' scope=spfile";

   sql clone "alter system set  db_unique_name = 

 ''ORCLAUX'' comment=

 ''Modified by RMAN duplicate'' scope=spfile";

   shutdown clone immediate;

   startup clone force nomount

   backup as copy current controlfile auxiliary format  '/oradata/orclaux/control01.ctl';

   restore clone controlfile to  '/oradata/orclaux/control02.ctl' from 

 '/oradata/orclaux/control01.ctl';

   alter clone database mount;

}

executing Memory Script


sql statement: alter system set  db_name =  ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile


sql statement: alter system set  db_unique_name =  ''ORCLAUX'' comment= ''Modified by RMAN duplicate'' scope=spfile


Oracle instance shut down


Oracle instance started


Total System Global Area     509411328 bytes


Fixed Size                     2229824 bytes

Variable Size                289409472 bytes

Database Buffers             209715200 bytes

Redo Buffers                   8056832 bytes



Starting backup at 24-JAN-16

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=24 device type=DISK

channel ORA_DISK_1: starting datafile copy

copying current control file

output file name=/u2/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f tag=TAG20160124T124047 RECID=22 STAMP=901975250

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

Finished backup at 24-JAN-16


Starting restore at 24-JAN-16

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=136 device type=DISK


channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 24-JAN-16


database mounted


contents of Memory Script:


{

   set newname for datafile  1 to 

 "/oradata/orclaux/system01.dbf";

   set newname for datafile  2 to 

 "/oradata/orclaux/sysaux01.dbf";

   set newname for datafile  3 to 

 "/oradata/orclaux/test01.dbf";

   set newname for datafile  4 to 

 "/oradata/orclaux/users01.dbf";

   set newname for datafile  6 to 

 "/oradata/orclaux/undotbs02.dbf";

   set newname for datafile  7 to 

 "/oradata/orclaux/tbspart01.dbf";

   set newname for datafile  8 to 

 "/oradata/orclaux/tbspart02.dbf";

   set newname for datafile  9 to 

 "/oradata/orclaux/tbspart03.dbf";

   set newname for datafile  11 to 

 "/oradata/orclaux/assm01.dbf";

   set newname for datafile  12 to 

 "/oradata/orclaux/tbspart04.dbf";

   set newname for datafile  13 to 

 "/oradata/orclaux/rman01.dbf";

   set newname for datafile  14 to 

 "/oradata/orclaux/test1.dbf";

   set newname for datafile  15 to 

 "/oradata/orclaux/test2.dbf";

   set newname for datafile  16 to 

 "/oradata/orclaux/linktbs01.dbf";

   set newname for datafile  17 to 

 "/oradata/orclaux/ogg01.dbf";

   set newname for datafile  18 to 

 "/oradata/orclaux/tom101.dbf";

   backup as copy reuse

   datafile  1 auxiliary format 

 "/oradata/orclaux/system01.dbf"   datafile 

 2 auxiliary format 

 "/oradata/orclaux/sysaux01.dbf"   datafile 

 3 auxiliary format 

 "/oradata/orclaux/test01.dbf"   datafile 

 4 auxiliary format 

 "/oradata/orclaux/users01.dbf"   datafile 

 6 auxiliary format 

 "/oradata/orclaux/undotbs02.dbf"   datafile 

 7 auxiliary format 

 "/oradata/orclaux/tbspart01.dbf"   datafile 

 8 auxiliary format 

 "/oradata/orclaux/tbspart02.dbf"   datafile 

 9 auxiliary format 

 "/oradata/orclaux/tbspart03.dbf"   datafile 

 11 auxiliary format 

 "/oradata/orclaux/assm01.dbf"   datafile 

 12 auxiliary format 

 "/oradata/orclaux/tbspart04.dbf"   datafile 

 13 auxiliary format 

 "/oradata/orclaux/rman01.dbf"   datafile 

 14 auxiliary format 

 "/oradata/orclaux/test1.dbf"   datafile 

 15 auxiliary format 

 "/oradata/orclaux/test2.dbf"   datafile 

 16 auxiliary format 

 "/oradata/orclaux/linktbs01.dbf"   datafile 

 17 auxiliary format 

 "/oradata/orclaux/ogg01.dbf"   datafile 

 18 auxiliary format 

 "/oradata/orclaux/tom101.dbf"   ;

   sql 'alter system archive log current';

}


executing Memory Script


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


Starting backup at 24-JAN-16

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00002 name=/oradata/orcl/sysaux01.dbf

output file name=/oradata/orclaux/sysaux01.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:17

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=/oradata/orcl/system01.dbf

output file name=/oradata/orclaux/system01.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:57

channel ORA_DISK_1: starting datafile copy

input datafile file number=00006 name=/oradata/orcl/undotbs02.dbf

output file name=/oradata/orclaux/undotbs02.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting datafile copy

input datafile file number=00003 name=/oradata/orcl/test01.dbf

output file name=/oradata/orclaux/test01.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting datafile copy

input datafile file number=00011 name=/oradata/orcl/assm01.dbf

output file name=/oradata/orclaux/assm01.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

channel ORA_DISK_1: starting datafile copy

input datafile file number=00017 name=/oradata/orcl/ogg01.dbf

output file name=/oradata/orclaux/ogg01.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting datafile copy

input datafile file number=00018 name=/oradata/orcl/tom101.dbf

output file name=/oradata/orclaux/tom101.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

channel ORA_DISK_1: starting datafile copy

input datafile file number=00004 name=/oradata/orcl/users01.dbf

output file name=/oradata/orclaux/users01.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

channel ORA_DISK_1: starting datafile copy

input datafile file number=00007 name=/oradata/orcl/tbspart01.dbf

output file name=/oradata/orclaux/tbspart01.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

channel ORA_DISK_1: starting datafile copy

input datafile file number=00008 name=/oradata/orcl/tbspart02.dbf

output file name=/oradata/orclaux/tbspart02.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting datafile copy

input datafile file number=00009 name=/oradata/orcl/tbspart03.dbf

output file name=/oradata/orclaux/tbspart03.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting datafile copy

input datafile file number=00012 name=/oradata/orcl/tbspart04.dbf

output file name=/oradata/orclaux/tbspart04.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting datafile copy

input datafile file number=00013 name=/oradata/orcl/rman01.dbf

output file name=/oradata/orclaux/rman01.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting datafile copy

input datafile file number=00014 name=/oradata/orcl/test1.dbf

output file name=/oradata/orclaux/test1.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting datafile copy

input datafile file number=00015 name=/oradata/orcl/test2.dbf

output file name=/oradata/orclaux/test2.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting datafile copy

input datafile file number=00016 name=/oradata/orcl/linktbs01.dbf

output file name=/oradata/orclaux/linktbs01.dbf tag=TAG20160124T124107

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 24-JAN-16

sql statement: alter system archive log current


contents of Memory Script:

{

   backup as copy reuse

   archivelog like  "/oradata/arch/orcl/1_154_899286421.dbf" auxiliary format 

 "/oradata/arch/orclaux/1_154_899286421.dbf"   ;

   catalog clone archivelog  "/oradata/arch/orclaux/1_154_899286421.dbf";

   switch clone datafile all;

}

executing Memory Script


Starting backup at 24-JAN-16

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log copy

input archived log thread=1 sequence=154 RECID=631 STAMP=901975481

output file name=/oradata/arch/orclaux/1_154_899286421.dbf RECID=0 STAMP=0

channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01

Finished backup at 24-JAN-16

cataloged archived log

archived log file name=/oradata/arch/orclaux/1_154_899286421.dbf RECID=631 STAMP=901975490


datafile 1 switched to datafile copy

input datafile copy RECID=22 STAMP=901975492 file name=/oradata/orclaux/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=23 STAMP=901975492 file name=/oradata/orclaux/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=24 STAMP=901975492 file name=/oradata/orclaux/test01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=25 STAMP=901975492 file name=/oradata/orclaux/users01.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=26 STAMP=901975492 file name=/oradata/orclaux/undotbs02.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=27 STAMP=901975492 file name=/oradata/orclaux/tbspart01.dbf

datafile 8 switched to datafile copy

input datafile copy RECID=28 STAMP=901975492 file name=/oradata/orclaux/tbspart02.dbf

datafile 9 switched to datafile copy

input datafile copy RECID=29 STAMP=901975492 file name=/oradata/orclaux/tbspart03.dbf

datafile 11 switched to datafile copy

input datafile copy RECID=30 STAMP=901975492 file name=/oradata/orclaux/assm01.dbf

datafile 12 switched to datafile copy

input datafile copy RECID=31 STAMP=901975492 file name=/oradata/orclaux/tbspart04.dbf

datafile 13 switched to datafile copy

input datafile copy RECID=32 STAMP=901975492 file name=/oradata/orclaux/rman01.dbf

datafile 14 switched to datafile copy

input datafile copy RECID=33 STAMP=901975492 file name=/oradata/orclaux/test1.dbf

datafile 15 switched to datafile copy

input datafile copy RECID=34 STAMP=901975493 file name=/oradata/orclaux/test2.dbf

datafile 16 switched to datafile copy

input datafile copy RECID=35 STAMP=901975493 file name=/oradata/orclaux/linktbs01.dbf

datafile 17 switched to datafile copy

input datafile copy RECID=36 STAMP=901975493 file name=/oradata/orclaux/ogg01.dbf

datafile 18 switched to datafile copy

input datafile copy RECID=37 STAMP=901975493 file name=/oradata/orclaux/tom101.dbf

contents of Memory Script:

{

   set until scn  81599807560;

   recover

   clone database

    delete archivelog

   ;

}

executing Memory Script


executing command: SET until clause


Starting recover at 24-JAN-16

using channel ORA_AUX_DISK_1


starting media recovery


archived log for thread 1 with sequence 154 is already on disk as file /oradata/arch/orclaux/1_154_899286421.dbf

archived log file name=/oradata/arch/orclaux/1_154_899286421.dbf thread=1 sequence=154

media recovery complete, elapsed time: 00:00:01

Finished recover at 24-JAN-16

Oracle instance started

Total System Global Area     509411328 bytes


Fixed Size                     2229824 bytes

Variable Size                306186688 bytes

Database Buffers             192937984 bytes

Redo Buffers                   8056832 bytes


contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''ORCLAUX'' comment=

 ''Reset to original value by RMAN'' scope=spfile";

   sql clone "alter system reset  db_unique_name scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script


sql statement: alter system set  db_name =  ''ORCLAUX'' comment= ''Reset to original value by RMAN'' scope=spfile


sql statement: alter system reset  db_unique_name scope=spfile


Oracle instance shut down


connected to auxiliary database (not started)

Oracle instance started

Total System Global Area     509411328 bytes


Fixed Size                     2229824 bytes

Variable Size                306186688 bytes

Database Buffers             192937984 bytes

Redo Buffers                   8056832 bytes

sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCLAUX" RESETLOGS ARCHIVELOG 

  MAXLOGFILES     16

  MAXLOGMEMBERS      3

  MAXDATAFILES      100

  MAXINSTANCES     8

  MAXLOGHISTORY      292

 LOGFILE

  GROUP   1 ( '/oradata/orclaux/redo01.log' ) SIZE 50 M  REUSE,

  GROUP   2 ( '/oradata/orclaux/redo02.log' ) SIZE 50 M  REUSE,

  GROUP   3 ( '/oradata/orclaux/redo03.log' ) SIZE 50 M  REUSE

 DATAFILE

  '/oradata/orclaux/system01.dbf'

 CHARACTER SET AL32UTF8


contents of Memory Script:

{

   set newname for tempfile  1 to 

 "/oradata/orclaux/temp01.dbf";

   switch clone tempfile all;

   catalog clone datafilecopy  "/oradata/orclaux/sysaux01.dbf", 

 "/oradata/orclaux/test01.dbf", 

 "/oradata/orclaux/users01.dbf", 

 "/oradata/orclaux/undotbs02.dbf", 

 "/oradata/orclaux/tbspart01.dbf", 

 "/oradata/orclaux/tbspart02.dbf", 

 "/oradata/orclaux/tbspart03.dbf", 

 "/oradata/orclaux/assm01.dbf", 

 "/oradata/orclaux/tbspart04.dbf", 

 "/oradata/orclaux/rman01.dbf", 

 "/oradata/orclaux/test1.dbf", 

 "/oradata/orclaux/test2.dbf", 

 "/oradata/orclaux/linktbs01.dbf", 

 "/oradata/orclaux/ogg01.dbf", 

 "/oradata/orclaux/tom101.dbf";

   switch clone datafile all;

}

executing Memory Script


executing command: SET NEWNAME


renamed tempfile 1 to /oradata/orclaux/temp01.dbf in control file

cataloged datafile copy

datafile copy file name=/oradata/orclaux/sysaux01.dbf RECID=1 STAMP=901975533

cataloged datafile copy

datafile copy file name=/oradata/orclaux/test01.dbf RECID=2 STAMP=901975533

cataloged datafile copy

datafile copy file name=/oradata/orclaux/users01.dbf RECID=3 STAMP=901975533

cataloged datafile copy

datafile copy file name=/oradata/orclaux/undotbs02.dbf RECID=4 STAMP=901975533

cataloged datafile copy

datafile copy file name=/oradata/orclaux/tbspart01.dbf RECID=5 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/tbspart02.dbf RECID=6 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/tbspart03.dbf RECID=7 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/assm01.dbf RECID=8 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/tbspart04.dbf RECID=9 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/rman01.dbf RECID=10 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/test1.dbf RECID=11 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/test2.dbf RECID=12 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/linktbs01.dbf RECID=13 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/ogg01.dbf RECID=14 STAMP=901975534

cataloged datafile copy

datafile copy file name=/oradata/orclaux/tom101.dbf RECID=15 STAMP=901975534

datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=901975533 file name=/oradata/orclaux/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=901975533 file name=/oradata/orclaux/test01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=901975533 file name=/oradata/orclaux/users01.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=4 STAMP=901975533 file name=/oradata/orclaux/undotbs02.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=5 STAMP=901975534 file name=/oradata/orclaux/tbspart01.dbf

datafile 8 switched to datafile copy

input datafile copy RECID=6 STAMP=901975534 file name=/oradata/orclaux/tbspart02.dbf

datafile 9 switched to datafile copy

input datafile copy RECID=7 STAMP=901975534 file name=/oradata/orclaux/tbspart03.dbf

datafile 11 switched to datafile copy

input datafile copy RECID=8 STAMP=901975534 file name=/oradata/orclaux/assm01.dbf

datafile 12 switched to datafile copy

input datafile copy RECID=9 STAMP=901975534 file name=/oradata/orclaux/tbspart04.dbf

datafile 13 switched to datafile copy

input datafile copy RECID=10 STAMP=901975534 file name=/oradata/orclaux/rman01.dbf

datafile 14 switched to datafile copy

input datafile copy RECID=11 STAMP=901975534 file name=/oradata/orclaux/test1.dbf

datafile 15 switched to datafile copy

input datafile copy RECID=12 STAMP=901975534 file name=/oradata/orclaux/test2.dbf

datafile 16 switched to datafile copy

input datafile copy RECID=13 STAMP=901975534 file name=/oradata/orclaux/linktbs01.dbf

datafile 17 switched to datafile copy

input datafile copy RECID=14 STAMP=901975534 file name=/oradata/orclaux/ogg01.dbf

datafile 18 switched to datafile copy

input datafile copy RECID=15 STAMP=901975534 file name=/oradata/orclaux/tom101.dbf

Reenabling controlfile options for auxiliary database

Executing: alter database add supplemental log data

Executing: alter database force logging

contents of Memory Script:

{

   Alter clone database open resetlogs;

}

executing Memory Script


database opened

Finished Duplicate Db at 24-JAN-16


RMAN> 


6.验证恢复

[oracle@CS-SI-DG02 admin]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Sun Jan 24 12:55:10 2016


Copyright (c) 1982, 2011, Oracle.  All rights reserved.



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select open_mode from v$database;


OPEN_MODE

--------------------

READ WRITE


SQL> show parameter name;


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_file_name_convert                 string      /oradata/orcl/, /oradata/orcla

                                                 ux/

db_name                              string      ORCLAUX

db_unique_name                       string      ORCLAUX

global_names                         boolean     FALSE

instance_name                        string      orclaux

lock_name_space                      string

log_file_name_convert                string      /oradata/orcl/, /oradata/orcla

                                                 ux/

processor_group_name                 string

service_names                        string      ORCLAUX