RMAN> connect target sys/oracle@orcl
connect auxiliary sys/oracle@orcldg
run {
allocate channel c1 type disk;
allocate auxiliary channel s1 type disk;
duplicate target database
for standby
from active database nofilenamecheck
dorecover
spfile
parameter_value_convert 'orcl','orcldg'
set db_unique_name='orcldg'
set db_create_file_dest='/oradata/orcl'
connected to target database: ORCL (DBID=1399018635)
set db_file_name_convert='/orcl/','/orcl/'
RMAN>
set log_file_name_convert='/orcl/','/orcl/'
set control_files='/oradata/orcl/control01.ctl','/oradata/orcl/control02.ctl'
set fal_client='orcldg'
set fal_server='orcl'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(orcl,orcldg)'
connected to auxiliary database: ORCL (not mounted)
set log_archive_dest_1='location=/oradata/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=orcldg'
RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> set log_archive_dest_2='service=orcl LGWR SYNC affirm valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=orcl'
21> set log_archive_dest_state_2='enable'
22> ;
23> sql channel c1 "alter system archive log current";
24> sql channel s1 "alter database recover managed standby database disconnect";
25> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=44 device type=DISK
allocated channel: s1
channel s1: SID=22 device type=DISK
Starting Duplicate Db at 2015-05-10 14:38:46
current log archived
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/12.1.0/db_1/dbs/orapworcl' auxiliary format
'/u01/app/oracle/product/12.1.0/db_1/dbs/orapworcl' ;
restore clone from service 'orcl' spfile to
'/u01/app/oracle/product/12.1.0/db_1/dbs/spfileorcl.ora';
sql clone "alter system set spfile= ''/u01/app/oracle/product/12.1.0/db_1/dbs/spfileorcl.ora''";
}
executing Memory Script
Starting backup at 2015-05-10 14:38:47
Finished backup at 2015-05-10 14:38:48
Starting restore at 2015-05-10 14:38:48
channel s1: starting datafile backup set restore
channel s1: using network backup set from service orcl
channel s1: restoring SPFILE
output file name=/u01/app/oracle/product/12.1.0/db_1/dbs/spfileorcl.ora
channel s1: restore complete, elapsed time: 00:00:01
Finished restore at 2015-05-10 14:38:49
sql statement: alter system set spfile= ''/u01/app/oracle/product/12.1.0/db_1/dbs/spfileorcl.ora''
contents of Memory Script:
{
sql clone "alter system set audit_file_dest =
''/u01/app/oracle/admin/orcldg/adump'' comment=
'''' scope=spfile";
sql clone "alter system set dispatchers =
''(PROTOCOL=TCP) (SERVICE=orcldgXDB)'' comment=
'''' scope=spfile";
sql clone "alter system set db_unique_name =
''orcldg'' comment=
'''' scope=spfile";
sql clone "alter system set db_create_file_dest =
''/oradata/orcl'' comment=
'''' scope=spfile";
sql clone "alter system set db_file_name_convert =
''/orcl/'', ''/orcl/'' comment=
'''' scope=spfile";
sql clone "alter system set log_file_name_convert =
''/orcl/'', ''/orcl/'' comment=
'''' scope=spfile";
sql clone "alter system set control_files =
''/oradata/orcl/control01.ctl'', ''/oradata/orcl/control02.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set fal_client =
''orcldg'' comment=
'''' scope=spfile";
sql clone "alter system set fal_server =
''orcl'' comment=
'''' scope=spfile";
sql clone "alter system set standby_file_management =
''AUTO'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_config =
''dg_config=(orcl,orcldg)'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''location=/oradata/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=orcldg'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_2 =
''service=orcl LGWR SYNC affirm valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=orcl'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_state_2 =
''enable'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set audit_file_dest = ''/u01/app/oracle/admin/orcldg/adump'' comment= '''' scope=spfile
sql statement: alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=orcldgXDB)'' comment= '''' scope=spfile
sql statement: alter system set db_unique_name = ''orcldg'' comment= '''' scope=spfile
sql statement: alter system set db_create_file_dest = ''/oradata/orcl'' comment= '''' scope=spfile
sql statement: alter system set db_file_name_convert = ''/orcl/'', ''/orcl/'' comment= '''' scope=spfile
sql statement: alter system set log_file_name_convert = ''/orcl/'', ''/orcl/'' comment= '''' scope=spfile
sql statement: alter system set control_files = ''/oradata/orcl/control01.ctl'', ''/oradata/orcl/control02.ctl'' comment= '''' scope=spfile
sql statement: alter system set fal_client = ''orcldg'' comment= '''' scope=spfile
sql statement: alter system set fal_server = ''orcl'' comment= '''' scope=spfile
sql statement: alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile
sql statement: alter system set log_archive_config = ''dg_config=(orcl,orcldg)'' comment= '''' scope=spfile
sql statement: alter system set log_archive_dest_1 = ''location=/oradata/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=orcldg'' comment= '''' scope=spfile
sql statement: alter system set log_archive_dest_2 = ''service=orcl LGWR SYNC affirm valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=orcl'' comment= '''' scope=spfile
sql statement: alter system set log_archive_dest_state_2 = ''enable'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1073741824 bytes
Fixed Size 2932632 bytes
Variable Size 339738728 bytes
Database Buffers 515899392 bytes
Redo Buffers 5455872 bytes
In-Memory Area 209715200 bytes
allocated channel: s1
channel s1: SID=21 device type=DISK
contents of Memory Script:
{
restore clone from service 'orcl' standby controlfile;
}
executing Memory Script
Starting restore at 2015-05-10 14:39:08
channel s1: starting datafile backup set restore
channel s1: using network backup set from service orcl
channel s1: restoring control file
channel s1: restore complete, elapsed time: 00:00:01
output file name=/oradata/orcl/control01.ctl
output file name=/oradata/orcl/control02.ctl
Finished restore at 2015-05-10 14:39:10
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
Using previous duplicated file /oradata/orcl/system01.dbf for datafile 1 with checkpoint SCN of 2714023
Using previous duplicated file /oradata/orcl/sysaux01.dbf for datafile 3 with checkpoint SCN of 2714064
Using previous duplicated file /oradata/orcl/undotbs01.dbf for datafile 4 with checkpoint SCN of 2714094
contents of Memory Script:
{
set newname for tempfile 1 to
"/oradata/orcl/temp01.dbf";
set newname for tempfile 2 to
"/oradata/orcl/pdbseed/pdbseed_temp012015-02-09_06-32-26-PM.dbf";
set newname for tempfile 3 to
"/oradata/orcl/travel/travel_temp012015-03-19_01-30-29-PM.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/oradata/orcl/system01.dbf";
set newname for datafile 3 to
"/oradata/orcl/sysaux01.dbf";
set newname for datafile 4 to
"/oradata/orcl/undotbs01.dbf";
set newname for datafile 5 to
"/oradata/orcl/pdbseed/system01.dbf";
set newname for datafile 6 to
"/oradata/orcl/users01.dbf";
set newname for datafile 7 to
"/oradata/orcl/pdbseed/sysaux01.dbf";
set newname for datafile 21 to
"/oradata/orcl/travel/system01.dbf";
set newname for datafile 22 to
"/oradata/orcl/travel/sysaux01.dbf";
set newname for datafile 23 to
"/oradata/orcl/travel/SAMPLE_SCHEMA_users01.dbf";
set newname for datafile 24 to
"/oradata/orcl/travel/example01.dbf";
restore
from service 'orcl' clone datafile
5, 6, 7, 21, 22, 23, 24 ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to /oradata/orcl/temp01.dbf in control file
renamed tempfile 2 to /oradata/orcl/pdbseed/pdbseed_temp012015-02-09_06-32-26-PM.dbf in control file
renamed tempfile 3 to /oradata/orcl/travel/travel_temp012015-03-19_01-30-29-PM.dbf in control file
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 2015-05-10 14:39:15
channel s1: starting datafile backup set restore
channel s1: using network backup set from service orcl
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00005 to /oradata/orcl/pdbseed/system01.dbf
channel s1: restore complete, elapsed time: 00:00:07
channel s1: starting datafile backup set restore
channel s1: using network backup set from service orcl
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00006 to /oradata/orcl/users01.dbf
channel s1: restore complete, elapsed time: 00:00:01
channel s1: starting datafile backup set restore
channel s1: using network backup set from service orcl
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00007 to /oradata/orcl/pdbseed/sysaux01.dbf
channel s1: restore complete, elapsed time: 00:00:15
channel s1: starting datafile backup set restore
channel s1: using network backup set from service orcl
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00021 to /oradata/orcl/travel/system01.dbf
channel s1: restore complete, elapsed time: 00:00:07
channel s1: starting datafile backup set restore
channel s1: using network backup set from service orcl
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00022 to /oradata/orcl/travel/sysaux01.dbf
channel s1: restore complete, elapsed time: 00:00:15
channel s1: starting datafile backup set restore
channel s1: using network backup set from service orcl
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00023 to /oradata/orcl/travel/SAMPLE_SCHEMA_users01.dbf
channel s1: restore complete, elapsed time: 00:00:01
channel s1: starting datafile backup set restore
channel s1: using network backup set from service orcl
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00024 to /oradata/orcl/travel/example01.dbf
channel s1: restore complete, elapsed time: 00:00:16
Finished restore at 2015-05-10 14:40:17
sql statement: alter system archive log current
current log archived
contents of Memory Script:
{
restore clone force from service 'orcl'
archivelog from scn 2714023;
catalog clone datafilecopy "/oradata/orcl/system01.dbf",
"/oradata/orcl/sysaux01.dbf",
"/oradata/orcl/undotbs01.dbf";
switch clone datafile 1 to datafilecopy
"/oradata/orcl/system01.dbf";
switch clone datafile 3 to datafilecopy
"/oradata/orcl/sysaux01.dbf";
switch clone datafile 4 to datafilecopy
"/oradata/orcl/undotbs01.dbf";
switch clone datafile all;
}
executing Memory Script
Starting restore at 2015-05-10 14:40:20
channel s1: starting archived log restore to default destination
channel s1: using network backup set from service orcl
channel s1: restoring archived log
archived log thread=1 sequence=75
channel s1: restore complete, elapsed time: 00:00:01
channel s1: starting archived log restore to default destination
channel s1: using network backup set from service orcl
channel s1: restoring archived log
archived log thread=1 sequence=76
channel s1: restore complete, elapsed time: 00:00:01
channel s1: starting archived log restore to default destination
channel s1: using network backup set from service orcl
channel s1: restoring archived log
archived log thread=1 sequence=77
channel s1: restore complete, elapsed time: 00:00:01
channel s1: starting archived log restore to default destination
channel s1: using network backup set from service orcl
channel s1: restoring archived log
archived log thread=1 sequence=78
channel s1: restore complete, elapsed time: 00:00:01
channel s1: starting archived log restore to default destination
channel s1: using network backup set from service orcl
channel s1: restoring archived log
archived log thread=1 sequence=79
channel s1: restore complete, elapsed time: 00:00:01
channel s1: starting archived log restore to default destination
channel s1: using network backup set from service orcl
channel s1: restoring archived log
archived log thread=1 sequence=80
channel s1: restore complete, elapsed time: 00:00:01
channel s1: starting archived log restore to default destination
channel s1: using network backup set from service orcl
channel s1: restoring archived log
archived log thread=1 sequence=81
channel s1: restore complete, elapsed time: 00:00:01
Finished restore at 2015-05-10 14:40:28
cataloged datafile copy
datafile copy file name=/oradata/orcl/system01.dbf RECID=11 STAMP=879345628
cataloged datafile copy
datafile copy file name=/oradata/orcl/sysaux01.dbf RECID=12 STAMP=879345628
cataloged datafile copy
datafile copy file name=/oradata/orcl/undotbs01.dbf RECID=13 STAMP=879345628
datafile 1 switched to datafile copy
input datafile copy RECID=11 STAMP=879345628 file name=/oradata/orcl/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=879345628 file name=/oradata/orcl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=879345628 file name=/oradata/orcl/undotbs01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=879345629 file name=/oradata/orcl/pdbseed/system01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=15 STAMP=879345629 file name=/oradata/orcl/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=16 STAMP=879345629 file name=/oradata/orcl/pdbseed/sysaux01.dbf
datafile 21 switched to datafile copy
input datafile copy RECID=17 STAMP=879345629 file name=/oradata/orcl/travel/system01.dbf
datafile 22 switched to datafile copy
input datafile copy RECID=18 STAMP=879345629 file name=/oradata/orcl/travel/sysaux01.dbf
datafile 23 switched to datafile copy
input datafile copy RECID=19 STAMP=879345629 file name=/oradata/orcl/travel/SAMPLE_SCHEMA_users01.dbf
datafile 24 switched to datafile copy
input datafile copy RECID=20 STAMP=879345629 file name=/oradata/orcl/travel/example01.dbf
contents of Memory Script:
{
set until scn 2715969;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 2015-05-10 14:40:29
starting media recovery
archived log for thread 1 with sequence 75 is already on disk as file /oradata/archivelog/1_75_871237903.dbf
archived log for thread 1 with sequence 76 is already on disk as file /oradata/archivelog/1_76_871237903.dbf
archived log for thread 1 with sequence 77 is already on disk as file /oradata/archivelog/1_77_871237903.dbf
archived log for thread 1 with sequence 78 is already on disk as file /oradata/archivelog/1_78_871237903.dbf
archived log for thread 1 with sequence 79 is already on disk as file /oradata/archivelog/1_79_871237903.dbf
archived log for thread 1 with sequence 80 is already on disk as file /oradata/archivelog/1_80_871237903.dbf
archived log for thread 1 with sequence 81 is already on disk as file /oradata/archivelog/1_81_871237903.dbf
archived log file name=/oradata/archivelog/1_75_871237903.dbf thread=1 sequence=75
archived log file name=/oradata/archivelog/1_76_871237903.dbf thread=1 sequence=76
archived log file name=/oradata/archivelog/1_77_871237903.dbf thread=1 sequence=77
archived log file name=/oradata/archivelog/1_78_871237903.dbf thread=1 sequence=78
archived log file name=/oradata/archivelog/1_79_871237903.dbf thread=1 sequence=79
archived log file name=/oradata/archivelog/1_80_871237903.dbf thread=1 sequence=80
archived log file name=/oradata/archivelog/1_81_871237903.dbf thread=1 sequence=81
media recovery complete, elapsed time: 00:00:00
Finished recover at 2015-05-10 14:40:30
Finished Duplicate Db at 2015-05-10 14:40:32
sql statement: alter system archive log current
sql statement: alter database recover managed standby database disconnect
released channel: c1
released channel: s1
RMAN>
/*
sqlplus / as sysdba
shutdown immediate;
!rm -rf /u01/app/oracle/product/12.1.0/db_1/dbs/spfileorcl.ora
startup nomount;
*/ |