• 博客访问: 5856726
  • 博文数量: 495
  • 用 户 组: 普通用户
  • 注册时间: 2011-10-12 14:43
  • 认证徽章:
个人简介

系统架构师,ACOUG MEMBER,Oracle ACE,Mail:yongjing.star@gmail.com Mobile:13875984558 QQ:409898894 Blog:www.jydba.net

ITPUB论坛APP

ITPUB论坛APP



APP发帖 享双倍积分

文章分类

全部博文(495)

文章存档

2018年(21)

2017年(62)

2016年(69)

2015年(83)

2014年(41)

2013年(83)

2012年(121)

2011年(15)

微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

分类: Oracle

下面的例子是将源RAC CDB数据库通过rman的duplicate命令复制一个RAC CDB数据库,具体的复制操作如下
1.检查源RAC CDB(jy)的参数文件,数据文件,联机日志文件,控制文件,归档日志文件的存储目录

SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- --------------------------------------------
spfile                               string      +DATA/JY/PARAMETERFILE/spfile.303.961976713

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+DATA/JY/DATAFILE/system.317.962209603
+DATA/JY/DATAFILE/sysaux.298.962209605
+DATA/JY/DATAFILE/undotbs1.277.962209605
+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675
+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675
+DATA/JY/DATAFILE/users.301.962209605
+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675
+DATA/JY/DATAFILE/undotbs2.312.962209605
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409


SQL> show parameter control_files

NAME                                 TYPE        VALUE
------------------------------------ ----------- -------------------------------------------
control_files                        string      +DATA/JY/CONTROLFILE/current.272.961976315


SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
+DATA/JY/ONLINELOG/group_2.302.961976321
+DATA/JY/ONLINELOG/group_1.261.961976319
+DATA/JY/ONLINELOG/group_3.263.961976697
+DATA/JY/ONLINELOG/group_4.262.961976705


SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +TEST/arch
Oldest online log sequence     127
Next log sequence to archive   128
Current log sequence           128

2.在目标主机上创建存储目标数据库(dup)相关数据库文件的目录,目标主机上的+fra/dup目录用来存储数据库的数据文件,控制文件,联机重做日志文件),+fra/dup目录用来存储数据库的归档重做日志文件

ASMCMD [+fra] > mkdir dup

3.将源数据库的密码文件复制到目标主机的相应目录中并修改为目标数据库(dup)对应的文件名

[grid@jytest1 ~]$ srvctl config database -db jy
Database unique name: jy
Database name: jy
Oracle home: /u01/app/oracle/product/12.2.0/db
Oracle user: oracle
Spfile: +DATA/JY/PARAMETERFILE/spfile.303.961976713
Password file: +DATA/JY/PASSWORD/pwdjy.274.961976109
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: 
Disk Groups: DATA
Mount point paths: 
Services: 
Type: RAC
Start concurrency: 
Stop concurrency: 
OSDBA group: dba
OSOPER group: oper
Database instances: jy1,jy2
Configured nodes: jytest1,jytest2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services: 
Database is administrator managed

[grid@jytest1 admin]$ asmcmd cp  +DATA/JY/PASSWORD/pwdjy.274.961976109 /home/grid/orapwdup1
copying +DATA/JY/PASSWORD/pwdjy.274.961976109 -> /home/grid/orapwdup1

[root@jytest1 ~]# cp /home/grid/orapwdup /u01/app/oracle/product/12.2.0/db/dbs/orapwdup1
[root@jytest1 ~]# chown -R oracle:oinstall /u01/app/oracle/product/12.2.0/db/dbs/orapwdup1
[root@jytest1 ~]# chmod -R 777 /u01/app/oracle/product/12.2.0/db/dbs/orapwdup1

将密码文件orapwdup复制到2号实例主机上

[oracle@jytest2 dbs]$ scp oracle@10.138.130.171:/u01/app/oracle/product/12.2.0/db/dbs/orapwdup1 /u01/app/oracle/product/12.2.0/db/dbs/
orapwdup1                                                                   100% 3584     3.5KB/s   00:00    

[oracle@jytest2 dbs]$ mv orapwdup1 orapwdup2

4.使用源数据库的spfile文件来创建目标数据库要使用的spfile文件
在源数据库中执行下面的命令来创建pfile参数文件

SQL> create pfile from spfile;

File created.

[oracle@jytest1 dbs]$ vi initdup1.ora
*.audit_file_dest='/u01/app/oracle/admin/dup/adump'
*.cluster_database=false
*.compatible='12.2.0'
*.control_files='+fra/dup/CONTROLFILE/control01.ctl'
*.db_block_size=8192
*.db_name='dup'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=jyXDB)'
*.enable_pluggable_database=true
dup2.instance_number=2
dup1.instance_number=1
*.local_listener='-oraagent-dummy-'
*.log_archive_dest_1='location=+test/arch/dup'
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=1g
*.processes=2000
*.remote_login_passwordfile='exclusive'
*.sga_max_size=2147483648
*.sga_target=2147483648
dup2.thread=2
dup1.thread=1
*.undo_retention=8640
dup1.undo_tablespace='UNDOTBS1'
dup2.undo_tablespace='UNDOTBS2'
*.db_file_name_convert=('+DATA/JY/','+fra/dup')
*.log_file_name_convert=('+DATA/JY/','+fra/dup')


[oracle@jytest1 dbs]$ export ORACLE_SID=dup1
[oracle@jytest1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jan 19 19:46:07 2018

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

Connected to an idle instance.

SQL> startup nomount pfile='/u01/app/oracle/product/12.2.0/db/dbs/initdup1.ora'
ORACLE instance started.

Total System Global Area 2147483648 bytes
Fixed Size                  8794848 bytes
Variable Size            1459621152 bytes
Database Buffers          671088640 bytes
Redo Buffers                7979008 bytes



SQL> create spfile='+fra/dup/spfiledup.ora' from pfile='/u01/app/oracle/product/12.2.0/db/dbs/initdup1.ora';

File created.

[oracle@jytest1 dbs]$ vi initdup1.ora
spfile=+fra/dup/spfiledup.ora

[oracle@jytest2 dbs]$ vi initdup1.ora
spfile=+fra/dup/spfiledup.ora

5.使用spfile参数文件来启动目标数据库实例(辅助实例dup)

SQL> shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.

Total System Global Area 2147483648 bytes
Fixed Size                  8794848 bytes
Variable Size             570428704 bytes
Database Buffers         1560281088 bytes
Redo Buffers                7979008 bytes

SQL> show parameter spfile

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ----------------------------------------------------
spfile                               string                 /u01/app/oracle/product/12.2.0/db/dbs/spfiledup1.ora

6.给目标数据库配置静态监听与tns名

[grid@jytest1 admin]$ vi listener.ora

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = dup1)
      (ORACLE_HOME =/u01/app/oracle/product/12.2.0/db)
      (GLOBAL_DBNAME=dup)
    )
  )

[grid@jytest2 admin]$ vi listener.ora

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = dup2)
      (ORACLE_HOME =/u01/app/oracle/product/12.2.0/db)
      (GLOBAL_DBNAME=dup)
    )
  )


[grid@jytest1 admin]$ srvctl stop listener -listener LISTENER

[grid@jytest1 admin]$ srvctl start listener -listener LISTENER
[grid@jytest1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 19-JAN-2018 22:36:22

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                19-JAN-2018 22:32:51
Uptime                    0 days 0 hr. 3 min. 31 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/12.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jytest1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.171)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.175)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=jytest1.jydba.net)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.2.0/db/admin/jy/xdb_wallet))(Presentation=HTTP)

(Session=RAW))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_CRS" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_FRA" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_TEST" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "5f9ac6865e87549fe053ab828a0ade94" has 1 instance(s).
  Instance "jy1", status READY, has 1 handler(s) for this service...
Service "600d6f56deb669cce053ab828a0aab7e" has 1 instance(s).
  Instance "jy1", status READY, has 1 handler(s) for this service...
Service "dup" has 1 instance(s).
  Instance "dup1", status UNKNOWN, has 1 handler(s) for this service...
Service "jy" has 1 instance(s).
  Instance "jy1", status READY, has 1 handler(s) for this service...
Service "jyXDB" has 1 instance(s).
  Instance "jy1", status READY, has 1 handler(s) for this service...
Service "jypdb" has 1 instance(s).
  Instance "jy1", status READY, has 1 handler(s) for this service...
Service "testpdb" has 1 instance(s).
  Instance "jy1", status READY, has 1 handler(s) for this service...
The command completed successfully


[grid@jytest2 admin]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 19-JAN-2018 22:41:01

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                19-JAN-2018 22:37:29
Uptime                    0 days 0 hr. 3 min. 31 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/12.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jytest2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.172)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.176)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=jytest2.jydba.net)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.2.0/db/admin/jy/xdb_wallet))(Presentation=HTTP)

(Session=RAW))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_CRS" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_FRA" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_TEST" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "5f9ac6865e87549fe053ab828a0ade94" has 1 instance(s).
  Instance "jy2", status READY, has 1 handler(s) for this service...
Service "600d6f56deb669cce053ab828a0aab7e" has 1 instance(s).
  Instance "jy2", status READY, has 1 handler(s) for this service...
Service "dup" has 1 instance(s).
  Instance "dup2", status UNKNOWN, has 1 handler(s) for this service...
Service "jy" has 1 instance(s).
  Instance "jy2", status READY, has 1 handler(s) for this service...
Service "jyXDB" has 1 instance(s).
  Instance "jy2", status READY, has 1 handler(s) for this service...
Service "jypdb" has 1 instance(s).
  Instance "jy2", status READY, has 1 handler(s) for this service...
Service "testpdb" has 1 instance(s).
  Instance "jy2", status READY, has 1 handler(s) for this service...
The command completed successfully

7.在目标主机上配置tns,用来通过网络服务名来连接源数据库与目标数据库

[oracle@jytest1 admin]$ vi tnsnames.ora 
DUP =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.138.130.171)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dup)
      (UR = A)
    )
  )

[oracle@jytest2 admin]$ vi tnsnames.ora 
DUP =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.138.130.172)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dup)
      (UR = A)
    )
  )

8.在目标主机上测试是否可以通过使用网络服务名来连接源数据库与目标数据库

[oracle@jytest1 admin]$ sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jan 19 22:58:34 2018

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

SQL> conn sys/abcd@dup as sysdba
Connected.
SQL> conn sys/abcd@jy as sysdba
Connected.

9.执行数据库复制

[oracle@jytest1 admin]$ rman target sys/abcd@jy catalog rco/abcd@jypdb_173 auxiliary sys/abcd@dup

Recovery Manager: Release 12.2.0.1.0 - Production on Fri Jan 19 23:16:15 2018

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

connected to target database: JY (DBID=979425723)
connected to recovery catalog database
connected to auxiliary database: DUP (not mounted)

RMAN> duplicate target database to dup from active database nofilenamecheck using compressed backupset;

Starting Duplicate Db at 19-JAN-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=2275 device type=DISK
current log archived

contents of Memory Script:
{
   sql clone "alter system set  db_name = 
 ''JY'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name = 
 ''DUP'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone from service  'jy' using compressed backupset
   primary controlfile;
   alter clone database mount;
}
executing Memory Script

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area    2147483648 bytes

Fixed Size                     8794848 bytes
Variable Size               1459621152 bytes
Database Buffers             671088640 bytes
Redo Buffers                   7979008 bytes

Starting restore at 19-JAN-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=1519 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:06
output file name=+FRA/dup/CONTROLFILE/control01.ctl
Finished restore at 19-JAN-18

database mounted
RMAN-05529: warning: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.

contents of Memory Script:
{
   sql clone 'alter database flashback off';
   set newname for datafile  1 to 
 "+FRA";
   set newname for datafile  3 to 
 "+FRA";
   set newname for datafile  4 to 
 "+FRA";
   set newname for datafile  5 to 
 "+FRA";
   set newname for datafile  6 to 
 "+FRA";
   set newname for datafile  7 to 
 "+FRA";
   set newname for datafile  8 to 
 "+FRA";
   set newname for datafile  9 to 
 "+FRA";
   set newname for datafile  10 to 
 "+FRA";
   set newname for datafile  11 to 
 "+FRA";
   set newname for datafile  12 to 
 "+FRA";
   set newname for datafile  13 to 
 "+FRA";
   set newname for datafile  14 to 
 "+FRA";
   set newname for datafile  15 to 
 "+FRA";
   set newname for datafile  16 to 
 "+FRA";
   set newname for datafile  17 to 
 "+FRA";
   set newname for datafile  18 to 
 "+FRA";
   set newname for datafile  19 to 
 "+FRA";
   set newname for datafile  20 to 
 "+FRA";
   set newname for datafile  21 to 
 "+FRA";
   restore
   from  nonsparse   from service 
 'jy'   using compressed backupset
   clone database
   ;
   sql 'alter system archive log current';
}
executing Memory Script

sql statement: alter database flashback off

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

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 19-JAN-18
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:55
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:46
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:36
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00008 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00009 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00010 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00011 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:36
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00012 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00013 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00014 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:36
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00015 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00016 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00017 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00018 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00019 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00020 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00021 to +FRA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
Finished restore at 19-JAN-18

sql statement: alter system archive log current
current log archived

contents of Memory Script:
{
   restore clone force from service  'jy' using compressed backupset
   archivelog from scn  13147698;
   switch clone datafile all;
}
executing Memory Script

Starting restore at 19-JAN-18
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=137
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=138
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=139
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=2 sequence=114
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using compressed network backup set from service jy
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=2 sequence=115
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
Finished restore at 19-JAN-18

datafile 1 switched to datafile copy
input datafile copy RECID=24 STAMP=965863480 file name=+FRA/DUP/DATAFILE/system.376.965863053
datafile 3 switched to datafile copy
input datafile copy RECID=25 STAMP=965863482 file name=+FRA/DUP/DATAFILE/sysaux.379.965863109
datafile 4 switched to datafile copy
input datafile copy RECID=26 STAMP=965863482 file name=+FRA/DUP/DATAFILE/undotbs1.380.965863215
datafile 5 switched to datafile copy
input datafile copy RECID=27 STAMP=965863482 file name=+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.381.965863229
datafile 6 switched to datafile copy
input datafile copy RECID=28 STAMP=965863482 file name=+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.382.965863245
datafile 7 switched to datafile copy
input datafile copy RECID=29 STAMP=965863483 file name=+FRA/DUP/DATAFILE/users.364.965863281
datafile 8 switched to datafile copy
input datafile copy RECID=30 STAMP=965863483 file name=+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.365.965863281
datafile 9 switched to datafile copy
input datafile copy RECID=31 STAMP=965863483 file name=+FRA/DUP/DATAFILE/undotbs2.366.965863289
datafile 10 switched to datafile copy
input datafile copy RECID=32 STAMP=965863483 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.367.965863293
datafile 11 switched to datafile copy
input datafile copy RECID=33 STAMP=965863483 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.326.965863309
datafile 12 switched to datafile copy
input datafile copy RECID=34 STAMP=965863484 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.285.965863345
datafile 13 switched to datafile copy
input datafile copy RECID=35 STAMP=965863484 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.325.965863349
datafile 14 switched to datafile copy
input datafile copy RECID=36 STAMP=965863484 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.369.965863351
datafile 15 switched to datafile copy
input datafile copy RECID=37 STAMP=965863484 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.370.965863387
datafile 16 switched to datafile copy
input datafile copy RECID=38 STAMP=965863484 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.371.965863391
datafile 17 switched to datafile copy
input datafile copy RECID=39 STAMP=965863485 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.372.965863407
datafile 18 switched to datafile copy
input datafile copy RECID=40 STAMP=965863485 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.373.965863443
datafile 19 switched to datafile copy
input datafile copy RECID=41 STAMP=965863485 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.375.965863445
datafile 20 switched to datafile copy
input datafile copy RECID=42 STAMP=965863485 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.377.965863449
datafile 21 switched to datafile copy
input datafile copy RECID=43 STAMP=965863485 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.378.965863451

contents of Memory Script:
{
   set until scn  13148610;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 19-JAN-18
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 137 is already on disk as file +TEST/arch/dup/1_137_961976319.dbf
archived log for thread 1 with sequence 138 is already on disk as file +TEST/arch/dup/1_138_961976319.dbf
archived log for thread 1 with sequence 139 is already on disk as file +TEST/arch/dup/1_139_961976319.dbf
archived log for thread 2 with sequence 114 is already on disk as file +TEST/arch/dup/2_114_961976319.dbf
archived log for thread 2 with sequence 115 is already on disk as file +TEST/arch/dup/2_115_961976319.dbf
archived log file name=+TEST/arch/dup/2_114_961976319.dbf thread=2 sequence=114
archived log file name=+TEST/arch/dup/1_137_961976319.dbf thread=1 sequence=137
archived log file name=+TEST/arch/dup/1_138_961976319.dbf thread=1 sequence=138
archived log file name=+TEST/arch/dup/2_115_961976319.dbf thread=2 sequence=115
archived log file name=+TEST/arch/dup/1_139_961976319.dbf thread=1 sequence=139
media recovery complete, elapsed time: 00:00:04
Finished recover at 19-JAN-18
Oracle instance started

Total System Global Area    2147483648 bytes

Fixed Size                     8794848 bytes
Variable Size               1459621152 bytes
Database Buffers             671088640 bytes
Redo Buffers                   7979008 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name = 
 ''DUP'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
}
executing Memory Script

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

sql statement: alter system reset  db_unique_name scope=spfile
Oracle instance started

Total System Global Area    2147483648 bytes

Fixed Size                     8794848 bytes
Variable Size               1459621152 bytes
Database Buffers             671088640 bytes
Redo Buffers                   7979008 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS ARCHIVELOG 
  MAXLOGFILES    192
  MAXLOGMEMBERS      3
  MAXDATAFILES     1024
  MAXINSTANCES    32
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1 ( '+FRA' ) SIZE 200 M  REUSE,
  GROUP   2 ( '+FRA' ) SIZE 200 M  REUSE
 DATAFILE
  '+FRA/DUP/DATAFILE/system.376.965863053',
  '+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.381.965863229',
  '+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.367.965863293',
  '+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.371.965863391'
 CHARACTER SET ZHS16GBK

sql statement: ALTER DATABASE ADD LOGFILE 
  
  INSTANCE 'i2' 
  GROUP   3 ( '+FRA' ) SIZE 200 M  REUSE,
  GROUP   4 ( '+FRA' ) SIZE 200 M  REUSE

contents of Memory Script:
{
   set newname for tempfile  1 to 
 "+FRA";
   set newname for tempfile  2 to 
 "+FRA";
   set newname for tempfile  3 to 
 "+FRA";
   set newname for tempfile  4 to 
 "+FRA";
   switch clone tempfile all;
   catalog clone datafilecopy  "+FRA/DUP/DATAFILE/sysaux.379.965863109", 
 "+FRA/DUP/DATAFILE/undotbs1.380.965863215", 
 "+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.382.965863245", 
 "+FRA/DUP/DATAFILE/users.364.965863281", 
 "+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.365.965863281", 
 "+FRA/DUP/DATAFILE/undotbs2.366.965863289", 
 "+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.326.965863309", 
 "+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.285.965863345", 
 "+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.325.965863349", 
 "+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.369.965863351", 
 "+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.370.965863387", 
 "+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.372.965863407", 
 "+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.373.965863443", 
 "+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.375.965863445", 
 "+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.377.965863449", 
 "+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.378.965863451";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to +FRA in control file
renamed tempfile 2 to +FRA in control file
renamed tempfile 3 to +FRA in control file
renamed tempfile 4 to +FRA in control file

cataloged datafile copy
datafile copy file name=+FRA/DUP/DATAFILE/sysaux.379.965863109 RECID=1 STAMP=965863550
cataloged datafile copy
datafile copy file name=+FRA/DUP/DATAFILE/undotbs1.380.965863215 RECID=2 STAMP=965863550
cataloged datafile copy
datafile copy file name=+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.382.965863245 RECID=3 STAMP=965863550
cataloged datafile copy
datafile copy file name=+FRA/DUP/DATAFILE/users.364.965863281 RECID=4 STAMP=965863550
cataloged datafile copy
datafile copy file name=+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.365.965863281 RECID=5 STAMP=965863550
cataloged datafile copy
datafile copy file name=+FRA/DUP/DATAFILE/undotbs2.366.965863289 RECID=6 STAMP=965863550
cataloged datafile copy
datafile copy file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.326.965863309 RECID=7 STAMP=965863550
cataloged datafile copy
datafile copy file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.285.965863345 RECID=8 STAMP=965863550
cataloged datafile copy
datafile copy file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.325.965863349 RECID=9 STAMP=965863550
cataloged datafile copy
datafile copy file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.369.965863351 RECID=10 STAMP=965863551
cataloged datafile copy
datafile copy file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.370.965863387 RECID=11 STAMP=965863551
cataloged datafile copy
datafile copy file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.372.965863407 RECID=12 STAMP=965863551
cataloged datafile copy
datafile copy file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.373.965863443 RECID=13 STAMP=965863551
cataloged datafile copy
datafile copy file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.375.965863445 RECID=14 STAMP=965863551
cataloged datafile copy
datafile copy file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.377.965863449 RECID=15 STAMP=965863551
cataloged datafile copy
datafile copy file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.378.965863451 RECID=16 STAMP=965863551

datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=965863550 file name=+FRA/DUP/DATAFILE/sysaux.379.965863109
datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=965863550 file name=+FRA/DUP/DATAFILE/undotbs1.380.965863215
datafile 6 switched to datafile copy
input datafile copy RECID=3 STAMP=965863550 file name=+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.382.965863245
datafile 7 switched to datafile copy
input datafile copy RECID=4 STAMP=965863550 file name=+FRA/DUP/DATAFILE/users.364.965863281
datafile 8 switched to datafile copy
input datafile copy RECID=5 STAMP=965863550 file name=+FRA/DUP/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.365.965863281
datafile 9 switched to datafile copy
input datafile copy RECID=6 STAMP=965863550 file name=+FRA/DUP/DATAFILE/undotbs2.366.965863289
datafile 11 switched to datafile copy
input datafile copy RECID=7 STAMP=965863550 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.326.965863309
datafile 12 switched to datafile copy
input datafile copy RECID=8 STAMP=965863550 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.285.965863345
datafile 13 switched to datafile copy
input datafile copy RECID=9 STAMP=965863550 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.325.965863349
datafile 14 switched to datafile copy
input datafile copy RECID=10 STAMP=965863551 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.369.965863351
datafile 15 switched to datafile copy
input datafile copy RECID=11 STAMP=965863551 file name=+FRA/DUP/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.370.965863387
datafile 17 switched to datafile copy
input datafile copy RECID=12 STAMP=965863551 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.372.965863407
datafile 18 switched to datafile copy
input datafile copy RECID=13 STAMP=965863551 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.373.965863443
datafile 19 switched to datafile copy
input datafile copy RECID=14 STAMP=965863551 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.375.965863445
datafile 20 switched to datafile copy
input datafile copy RECID=15 STAMP=965863551 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.377.965863449
datafile 21 switched to datafile copy
input datafile copy RECID=16 STAMP=965863551 file name=+FRA/DUP/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.378.965863451

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened

contents of Memory Script:
{
   sql clone "alter pluggable database all open";
}
executing Memory Script

sql statement: alter pluggable database all open
Finished Duplicate Db at 19-JAN-18

10.检查数据是否一致
在源数据库查询表记录

SQL> conn sys/abcd@jy as sysdba
Connected.
SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      jy
SQL> alter session set container=jypdb;

Session altered.

SQL> select count(*) from JY.SALES_Q3_1998;

  COUNT(*)
----------
     50515

在目标数据库查询表记录

SQL> conn sys/abcd@dup as sysdba
Connected.
SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      DUP
SQL> alter session set container=jypdb;

Session altered.

SQL> select count(*) from JY.SALES_Q3_1998;

  COUNT(*)
----------
     50515

到此复制整个RAC CDB数据库为RAC CDB数据库完成,后面就是向集群注册数据库就不详细介绍了。

阅读(243) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册