單例項的duplicate(non ASM)
Creating a Duplicate Database on a New Host (non ASM). (文件 ID 388431.1) 轉到底部轉到底部
In this Document
Goal
Solution
Duplicate database from server A to server B (Non ASM)
1. Backup of the primary database.
2. Determine how much disk space will be required.
3. Ensuring you have enough space on your target server.
4. Making the backup available for the duplicate process.
5. Creating the init.ora & administration directories for the duplicate database.
6. Ensuring SQL*NET connections to primary database and RMAN catalog are working.
7. Prepare RMAN duplicate script.
8. Execute the RMAN script.
References
====================================================================================
Solution
Duplicate database from server A to server B (Non ASM)
Assumed database names:
Primary Database SID: PROD
Duplicate Database SID: AUX
RMAN Catalog SID: RMAN
====================================================================================
Steps
1. Backup the primary database.
2. Determine how much disk space will be required.
3. Ensuring you have enough space on your target server.
4. Making the backup available for the duplicate process.
5. Creating the init.ora & administration directories for the duplicate database.
6. Ensuring SQL*NET connections to primary database and RMAN catalog are working.
7. Prepare RMAN duplicate script.
8. Execute the RMAN script.
=====================================================================================
1. Backup of the primary database.
RMAN>
run
{
allocate channel d1 type disk;
backup format '/backup/df_t%t_s%s_p%p' database;
sql 'alter system archive log current';
backup format '/backup/al_t%t_s%s_p%p' archivelog all;
release channel d1;
}
----------------------------------------------------------------
RMAN> run {
allocate channel d1 type disk;
backup format '/backups/PROD/df_t%t_s%s_p%p'
tablespace SYSTEM, SYSAUX, UNDO, USERS;
sql 'alter system archive log current';
backup format '/backups/PROD/al_t%t_s%s_p%p' archivelog all;
release channel d1;
}
Figure 1b- This command will perform a tablespace backup ( SYSTEM, SYSAUX, UNDO & USERS) including archive logs and the current controlfile. This would be used if rman is duplicating a subset of the database.
---------------------------------------------------------------
[oracle@xuh admin]$ echo $ORACLE_SID
orcl
[oracle@xuh admin]$ rman target sys/oracle@xuh
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Aug 12 10:58:25 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1414669689)
RMAN> run {
2> allocate channel d1 type disk;
3> backup format '/backup/df_t%t_s%s_p%p' database;
4> sql 'alter system archive log current';
5> backup format '/backup/al_t%t_s%s_p%p' archivelog all;
6> release channel d1;
7> }
using target database control file instead of recovery catalog
allocated channel: d1
channel d1: SID=34 device type=DISK
Starting backup at 12-AUG-15
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/orcl/system01.dbf
input datafile file number=00002 name=/oradata/orcl/sysaux01.dbf
input datafile file number=00005 name=/oradata/orcl/example01.dbf
input datafile file number=00006 name=/oradata/orcl/backup01.dbf
input datafile file number=00003 name=/oradata/orcl/undotbs01.dbf
input datafile file number=00007 name=/oradata/orcl/backup02.dbf
input datafile file number=00004 name=/oradata/orcl/users01.dbf
channel d1: starting piece 1 at 12-AUG-15
channel d1: finished piece 1 at 12-AUG-15
piece handle=/backup/df_t887540365_s12_p1 tag=TAG20150812T105925 comment=NONE
channel d1: backup set complete, elapsed time: 00:01:15
Finished backup at 12-AUG-15
Starting Control File and SPFILE Autobackup at 12-AUG-15
piece handle=/backup/c-1414669689-20150812-00 comment=NONE
Finished Control File and SPFILE Autobackup at 12-AUG-15
sql statement: alter system archive log current
Starting backup at 12-AUG-15
current log archived
channel d1: starting archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=20 RECID=21 STAMP=886958164
input archived log thread=1 sequence=21 RECID=23 STAMP=887463418
input archived log thread=1 sequence=22 RECID=24 STAMP=887471438
input archived log thread=1 sequence=23 RECID=25 STAMP=887472264
channel d1: starting piece 1 at 12-AUG-15
channel d1: finished piece 1 at 12-AUG-15
piece handle=/backup/al_t887540442_s14_p1 tag=TAG20150812T110042 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:03
channel d1: starting archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=26 STAMP=887540442
input archived log thread=1 sequence=2 RECID=27 STAMP=887540442
channel d1: starting piece 1 at 12-AUG-15
channel d1: finished piece 1 at 12-AUG-15
piece handle=/backup/al_t887540445_s15_p1 tag=TAG20150812T110042 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-AUG-15
Starting Control File and SPFILE Autobackup at 12-AUG-15
piece handle=/backup/c-1414669689-20150812-01 comment=NONE
Finished Control File and SPFILE Autobackup at 12-AUG-15
released channel: d1
RMAN> list backup by file;
List of Datafile Backups
========================
File Key TY LV S Ckp SCN Ckp Time #Pieces #Copies Compressed Tag
---- ------- - -- - ---------- --------- ------- ------- ---------- ---
1 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
2 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
3 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
4 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
5 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
6 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
7 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
List of Archived Log Backups
============================
Thrd Seq Low SCN Low Time BS Key S #Pieces #Copies Compressed Tag
---- ------- ---------- --------- ------- - ------- ------- ---------- ---
1 20 1106818 05-AUG-15 10 A 1 1 NO TAG20150812T110042
1 21 1106821 05-AUG-15 10 A 1 1 NO TAG20150812T110042
1 22 1128050 11-AUG-15 10 A 1 1 NO TAG20150812T110042
1 23 1136492 11-AUG-15 10 A 1 1 NO TAG20150812T110042
1 1 1137634 11-AUG-15 11 A 1 1 NO TAG20150812T110042
1 2 1140324 12-AUG-15 11 A 1 1 NO TAG20150812T110042
List of Control File Backups
============================
CF Ckp SCN Ckp Time BS Key S #Pieces #Copies Compressed Tag
---------- --------- ------- - ------- ------- ---------- ---
1140342 12-AUG-15 12 A 1 1 NO TAG20150812T110046
1140313 12-AUG-15 9 A 1 1 NO TAG20150812T110041
1137716 11-AUG-15 7 A 1 1 NO TAG20150811T173207
List of SPFILE Backups
======================
Modification Time BS Key S #Pieces #Copies Compressed Tag
----------------- ------- - ------- ------- ---------- ---
11-AUG-15 12 A 1 1 NO TAG20150812T110046
11-AUG-15 9 A 1 1 NO TAG20150812T110041
11-AUG-15 7 A 1 1 NO TAG20150811T173207
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 6 11-AUG-15
Backup Piece 6 11-AUG-15 /home/oracle/temp/db_07qebh80_1_1
Backup Set 7 11-AUG-15
Backup Piece 7 11-AUG-15 /home/oracle/c-1414669689-20150811-03
Backup Set 9 12-AUG-15
Backup Piece 9 12-AUG-15 /backup/c-1414669689-20150812-00
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=34 device type=DISK
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 6 11-AUG-15
Backup Piece 6 11-AUG-15 /home/oracle/temp/db_07qebh80_1_1
Backup Set 7 11-AUG-15
Backup Piece 7 11-AUG-15 /home/oracle/c-1414669689-20150811-03
Backup Set 9 12-AUG-15
Backup Piece 9 12-AUG-15 /backup/c-1414669689-20150812-00
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/home/oracle/temp/db_07qebh80_1_1 RECID=6 STAMP=887473408
deleted backup piece
backup piece handle=/home/oracle/c-1414669689-20150811-03 RECID=7 STAMP=887477528
deleted backup piece
backup piece handle=/backup/c-1414669689-20150812-00 RECID=9 STAMP=887540441
Deleted 3 objects
RMAN> list backup by file;
List of Datafile Backups
========================
File Key TY LV S Ckp SCN Ckp Time #Pieces #Copies Compressed Tag
---- ------- - -- - ---------- --------- ------- ------- ---------- ---
1 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
2 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
3 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
4 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
5 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
7 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
List of Archived Log Backups
============================
Thrd Seq Low SCN Low Time BS Key S #Pieces #Copies Compressed Tag
---- ------- ---------- --------- ------- - ------- ------- ---------- ---
1 20 1106818 05-AUG-15 10 A 1 1 NO TAG20150812T110042
1 21 1106821 05-AUG-15 10 A 1 1 NO TAG20150812T110042
1 22 1128050 11-AUG-15 10 A 1 1 NO TAG20150812T110042
1 23 1136492 11-AUG-15 10 A 1 1 NO TAG20150812T110042
1 1 1137634 11-AUG-15 11 A 1 1 NO TAG20150812T110042
1 2 1140324 12-AUG-15 11 A 1 1 NO TAG20150812T110042
List of Control File Backups
============================
CF Ckp SCN Ckp Time BS Key S #Pieces #Copies Compressed Tag
---------- --------- ------- - ------- ------- ---------- ---
1140342 12-AUG-15 12 A 1 1 NO TAG20150812T110046
List of SPFILE Backups
======================
Modification Time BS Key S #Pieces #Copies Compressed Tag
----------------- ------- - ------- ------- ---------- ---
11-AUG-15 12 A 1 1 NO TAG20150812T110046
=====================================================================================
2、Determine how much disk space will be required.
Note: sql valid for version 10g only.
SQL> select DF.TOTAL/1048576 "DataFile Size Mb",
LOG.TOTAL/1048576 "Redo Log Size Mb",
CONTROL.TOTAL/1048576 "Control File Size Mb",
(DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 "Total Size Mb"
from dual,
(select sum(a.bytes) TOTAL from dba_data_files a) DF,
(select sum(b.bytes) TOTAL from v$log b) LOG,
(select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL;
Figure 2a - Calculate total space for all datafiles within database.
SQL> select DF.TOTAL/1048576 "DataFile Size Mb",
LOG.TOTAL/1048576 "Redo Log Size Mb",
CONTROL.TOTAL/1048576 "Control File Size Mb",
(DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 "Total Size Mb" from dual,
(select sum(a.bytes) TOTAL from dba_data_files a
where tablespace_name in('SYSTEM','UNDOTBS1', 'SYSAUX', 'USERS')) DF,
(select sum(b.bytes) TOTAL from v$log b) LOG,
(select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL;
Figure 2b - If duplicating a subset of the database, calculate space for list of tablespaces within primary database.
DataFile Size Mb Redo Log Size Mb Control File Size Mb Total Size Mb
---------------- ---------------- -------------------- -------------
900 150 20.34375 1070.34375
Figure 2c - Sample output of space calculation.
=====================================================================================
3、Ensuring you have enough space on your target server.
=====================================================================================
4. Making the backup available for the duplicate process.
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8 Full 1.08G DISK 00:01:08 12-AUG-15
BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20150812T105925
Piece Name: /backup/df_t887540365_s12_p1
List of Datafiles in backup set 8
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1140278 12-AUG-15 /oradata/orcl/system01.dbf
2 Full 1140278 12-AUG-15 /oradata/orcl/sysaux01.dbf
3 Full 1140278 12-AUG-15 /oradata/orcl/undotbs01.dbf
4 Full 1140278 12-AUG-15 /oradata/orcl/users01.dbf
5 Full 1140278 12-AUG-15 /oradata/orcl/example01.dbf
6 Full 1140278 12-AUG-15 /oradata/orcl/backup01.dbf
7 Full 1140278 12-AUG-15 /oradata/orcl/backup02.dbf
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
10 44.29M DISK 00:00:01 12-AUG-15
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20150812T110042
Piece Name: /backup/al_t887540442_s14_p1
List of Archived Logs in backup set 10
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 20 1106818 05-AUG-15 1106821 05-AUG-15
1 21 1106821 05-AUG-15 1128050 11-AUG-15
1 22 1128050 11-AUG-15 1136492 11-AUG-15
1 23 1136492 11-AUG-15 1136955 11-AUG-15
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
11 1.60M DISK 00:00:00 12-AUG-15
BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20150812T110042
Piece Name: /backup/al_t887540445_s15_p1
List of Archived Logs in backup set 11
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 1 1137634 11-AUG-15 1140324 12-AUG-15
1 2 1140324 12-AUG-15 1140332 12-AUG-15
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12 Full 9.36M DISK 00:00:01 12-AUG-15
BP Key: 12 Status: AVAILABLE Compressed: NO Tag: TAG20150812T110046
Piece Name: /backup/c-1414669689-20150812-01
SPFILE Included: Modification time: 11-AUG-15
SPFILE db_unique_name: ORCL
Control File Included: Ckp SCN: 1140342 Ckp time: 12-AUG-15
RMAN>
=====================================================================================
5. Creating the init.ora & administration directories for the duplicate database.
SQL>create pfile='/home/oracle/initorcl.ora' from spfile;
將pfile傳至auxiliary端$ORACLE_HOME/dbs下
修改初始化引數檔案initorcl.ora
SQL>create spfile from pfile;
SQL>startup nomount
=====================================================================================
6. Ensuring SQL*NET connections to primary database and RMAN catalog are working.
=====================================================================================
7、Prepare RMAN duplicate script.
$rman target sys/oracle@orcl auxiliary sys/oracle
RMAN>
run
{
allocate auxiliary channel C1 device type disk;
duplicate target database to ORCL;
}
------------------------------------------------------
run {
allocate auxiliary channel C1 device type disk;
duplicate target database to AUX;
}
Figure 7a - Sample duplicate command.
run {
allocate auxiliary channel C1 device type disk;
duplicate target database to AUX skip tablespace ABC, XYZ;
}
Figure 7b - Sample duplicate script omitting optional tablespaces;
run {
set until time "to_date('Jan 01 2000 12:00:00','Mon DD YYYY HH24:MI:SS')";
allocate auxiliary channel C1 device type disk;
duplicate target database to AUX;
}
Figure 7c - Sample duplicate script to a point in time.
--------------------------------------------------------
[oracle@zlj dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Aug 12 17:07:44 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@zlj dbs]$
[oracle@zlj dbs]$
[oracle@zlj dbs]$ rman target sys/oracle@orcl auxiliary sys/oracle
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Aug 12 17:08:10 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1414669689)
connected to auxiliary database: ORCL (not mounted)
RMAN> run
2> {
3> allocate auxiliary channel C1 device type disk;
4> duplicate target database to ORCL;
5> }
using target database control file instead of recovery catalog
allocated channel: C1
channel C1: SID=19 device type=DISK
Starting Duplicate Db at 12-AUG-15
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 =
''ORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
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 = ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK
Starting restore at 12-AUG-15
channel C1: starting datafile backup set restore
channel C1: restoring control file
channel C1: reading from backup piece /backup/c-1414669689-20150812-03
channel C1: piece handle=/backup/c-1414669689-20150812-03 tag=TAG20150812T170220
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:01
output file name=/oradata/standby/control01.ctl
output file name=/oradata/standby/control02.ctl
Finished restore at 12-AUG-15
database mounted
contents of Memory Script:
{
set until scn 1183861;
set newname for datafile 1 to
"/oradata/standby/system01.dbf";
set newname for datafile 2 to
"/oradata/standby/sysaux01.dbf";
set newname for datafile 3 to
"/oradata/standby/undotbs01.dbf";
set newname for datafile 4 to
"/oradata/standby/users01.dbf";
set newname for datafile 5 to
"/oradata/standby/example01.dbf";
set newname for datafile 6 to
"/oradata/standby/backup01.dbf";
set newname for datafile 7 to
"/oradata/standby/backup02.dbf";
restore
clone database
;
}
executing Memory Script
executing command: SET until clause
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 12-AUG-15
channel C1: starting datafile backup set restore
channel C1: specifying datafile(s) to restore from backup set
channel C1: restoring datafile 00001 to /oradata/standby/system01.dbf
channel C1: restoring datafile 00002 to /oradata/standby/sysaux01.dbf
channel C1: restoring datafile 00003 to /oradata/standby/undotbs01.dbf
channel C1: restoring datafile 00004 to /oradata/standby/users01.dbf
channel C1: restoring datafile 00005 to /oradata/standby/example01.dbf
channel C1: restoring datafile 00006 to /oradata/standby/backup01.dbf
channel C1: restoring datafile 00007 to /oradata/standby/backup02.dbf
channel C1: reading from backup piece /backup/df_t887562072_s43_p1
channel C1: piece handle=/backup/df_t887562072_s43_p1 tag=TAG20150812T170112
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:55
Finished restore at 12-AUG-15
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=887562576 file name=/oradata/standby/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=887562576 file name=/oradata/standby/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=887562576 file name=/oradata/standby/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=887562576 file name=/oradata/standby/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=887562576 file name=/oradata/standby/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=15 STAMP=887562576 file name=/oradata/standby/backup01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=16 STAMP=887562576 file name=/oradata/standby/backup02.dbf
contents of Memory Script:
{
set until scn 1183861;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 12-AUG-15
starting media recovery
channel C1: starting archived log restore to default destination
channel C1: restoring archived log
archived log thread=1 sequence=58
channel C1: restoring archived log
archived log thread=1 sequence=59
channel C1: reading from backup piece /backup/al_t887562139_s45_p1
channel C1: piece handle=/backup/al_t887562139_s45_p1 tag=TAG20150812T170219
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:01
archived log file name=/archive/orcl1_58_887477514.dbf thread=1 sequence=58
channel clone_default: deleting archived log(s)
archived log file name=/archive/orcl1_58_887477514.dbf RECID=124 STAMP=887562577
archived log file name=/archive/orcl1_59_887477514.dbf thread=1 sequence=59
channel clone_default: deleting archived log(s)
archived log file name=/archive/orcl1_59_887477514.dbf RECID=123 STAMP=887562577
media recovery complete, elapsed time: 00:00:01
Finished recover at 12-AUG-15
Oracle instance started
Total System Global Area 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''ORCL'' 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 = ''ORCL'' 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 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/oradata/standby/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/oradata/standby/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/oradata/standby/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/oradata/standby/system01.dbf'
CHARACTER SET ZHS16GBK
contents of Memory Script:
{
set newname for tempfile 1 to
"/oradata/standby/temp01.dbf";
set newname for tempfile 2 to
"/oradata/standby/tmp_backup01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/oradata/standby/sysaux01.dbf",
"/oradata/standby/undotbs01.dbf",
"/oradata/standby/users01.dbf",
"/oradata/standby/example01.dbf",
"/oradata/standby/backup01.dbf",
"/oradata/standby/backup02.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to /oradata/standby/temp01.dbf in control file
renamed tempfile 2 to /oradata/standby/tmp_backup01.dbf in control file
cataloged datafile copy
datafile copy file name=/oradata/standby/sysaux01.dbf RECID=1 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/undotbs01.dbf RECID=2 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/users01.dbf RECID=3 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/example01.dbf RECID=4 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/backup01.dbf RECID=5 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/backup02.dbf RECID=6 STAMP=887562587
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=887562587 file name=/oradata/standby/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=887562587 file name=/oradata/standby/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=887562587 file name=/oradata/standby/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=887562587 file name=/oradata/standby/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=887562587 file name=/oradata/standby/backup01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=887562587 file name=/oradata/standby/backup02.dbf
Reenabling controlfile options for auxiliary database
Executing: alter database force logging
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 12-AUG-15
released channel: C1
RMAN>
In this Document
Goal
Solution
Duplicate database from server A to server B (Non ASM)
1. Backup of the primary database.
2. Determine how much disk space will be required.
3. Ensuring you have enough space on your target server.
4. Making the backup available for the duplicate process.
5. Creating the init.ora & administration directories for the duplicate database.
6. Ensuring SQL*NET connections to primary database and RMAN catalog are working.
7. Prepare RMAN duplicate script.
8. Execute the RMAN script.
References
====================================================================================
Solution
Duplicate database from server A to server B (Non ASM)
Assumed database names:
Primary Database SID: PROD
Duplicate Database SID: AUX
RMAN Catalog SID: RMAN
====================================================================================
Steps
1. Backup the primary database.
2. Determine how much disk space will be required.
3. Ensuring you have enough space on your target server.
4. Making the backup available for the duplicate process.
5. Creating the init.ora & administration directories for the duplicate database.
6. Ensuring SQL*NET connections to primary database and RMAN catalog are working.
7. Prepare RMAN duplicate script.
8. Execute the RMAN script.
=====================================================================================
1. Backup of the primary database.
RMAN>
run
{
allocate channel d1 type disk;
backup format '/backup/df_t%t_s%s_p%p' database;
sql 'alter system archive log current';
backup format '/backup/al_t%t_s%s_p%p' archivelog all;
release channel d1;
}
----------------------------------------------------------------
RMAN> run {
allocate channel d1 type disk;
backup format '/backups/PROD/df_t%t_s%s_p%p'
tablespace SYSTEM, SYSAUX, UNDO, USERS;
sql 'alter system archive log current';
backup format '/backups/PROD/al_t%t_s%s_p%p' archivelog all;
release channel d1;
}
Figure 1b- This command will perform a tablespace backup ( SYSTEM, SYSAUX, UNDO & USERS) including archive logs and the current controlfile. This would be used if rman is duplicating a subset of the database.
---------------------------------------------------------------
[oracle@xuh admin]$ echo $ORACLE_SID
orcl
[oracle@xuh admin]$ rman target sys/oracle@xuh
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Aug 12 10:58:25 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1414669689)
RMAN> run {
2> allocate channel d1 type disk;
3> backup format '/backup/df_t%t_s%s_p%p' database;
4> sql 'alter system archive log current';
5> backup format '/backup/al_t%t_s%s_p%p' archivelog all;
6> release channel d1;
7> }
using target database control file instead of recovery catalog
allocated channel: d1
channel d1: SID=34 device type=DISK
Starting backup at 12-AUG-15
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/orcl/system01.dbf
input datafile file number=00002 name=/oradata/orcl/sysaux01.dbf
input datafile file number=00005 name=/oradata/orcl/example01.dbf
input datafile file number=00006 name=/oradata/orcl/backup01.dbf
input datafile file number=00003 name=/oradata/orcl/undotbs01.dbf
input datafile file number=00007 name=/oradata/orcl/backup02.dbf
input datafile file number=00004 name=/oradata/orcl/users01.dbf
channel d1: starting piece 1 at 12-AUG-15
channel d1: finished piece 1 at 12-AUG-15
piece handle=/backup/df_t887540365_s12_p1 tag=TAG20150812T105925 comment=NONE
channel d1: backup set complete, elapsed time: 00:01:15
Finished backup at 12-AUG-15
Starting Control File and SPFILE Autobackup at 12-AUG-15
piece handle=/backup/c-1414669689-20150812-00 comment=NONE
Finished Control File and SPFILE Autobackup at 12-AUG-15
sql statement: alter system archive log current
Starting backup at 12-AUG-15
current log archived
channel d1: starting archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=20 RECID=21 STAMP=886958164
input archived log thread=1 sequence=21 RECID=23 STAMP=887463418
input archived log thread=1 sequence=22 RECID=24 STAMP=887471438
input archived log thread=1 sequence=23 RECID=25 STAMP=887472264
channel d1: starting piece 1 at 12-AUG-15
channel d1: finished piece 1 at 12-AUG-15
piece handle=/backup/al_t887540442_s14_p1 tag=TAG20150812T110042 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:03
channel d1: starting archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=26 STAMP=887540442
input archived log thread=1 sequence=2 RECID=27 STAMP=887540442
channel d1: starting piece 1 at 12-AUG-15
channel d1: finished piece 1 at 12-AUG-15
piece handle=/backup/al_t887540445_s15_p1 tag=TAG20150812T110042 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-AUG-15
Starting Control File and SPFILE Autobackup at 12-AUG-15
piece handle=/backup/c-1414669689-20150812-01 comment=NONE
Finished Control File and SPFILE Autobackup at 12-AUG-15
released channel: d1
RMAN> list backup by file;
List of Datafile Backups
========================
File Key TY LV S Ckp SCN Ckp Time #Pieces #Copies Compressed Tag
---- ------- - -- - ---------- --------- ------- ------- ---------- ---
1 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
2 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
3 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
4 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
5 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
6 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
7 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 B F A 1137633 11-AUG-15 1 1 NO TAG20150811T162327
List of Archived Log Backups
============================
Thrd Seq Low SCN Low Time BS Key S #Pieces #Copies Compressed Tag
---- ------- ---------- --------- ------- - ------- ------- ---------- ---
1 20 1106818 05-AUG-15 10 A 1 1 NO TAG20150812T110042
1 21 1106821 05-AUG-15 10 A 1 1 NO TAG20150812T110042
1 22 1128050 11-AUG-15 10 A 1 1 NO TAG20150812T110042
1 23 1136492 11-AUG-15 10 A 1 1 NO TAG20150812T110042
1 1 1137634 11-AUG-15 11 A 1 1 NO TAG20150812T110042
1 2 1140324 12-AUG-15 11 A 1 1 NO TAG20150812T110042
List of Control File Backups
============================
CF Ckp SCN Ckp Time BS Key S #Pieces #Copies Compressed Tag
---------- --------- ------- - ------- ------- ---------- ---
1140342 12-AUG-15 12 A 1 1 NO TAG20150812T110046
1140313 12-AUG-15 9 A 1 1 NO TAG20150812T110041
1137716 11-AUG-15 7 A 1 1 NO TAG20150811T173207
List of SPFILE Backups
======================
Modification Time BS Key S #Pieces #Copies Compressed Tag
----------------- ------- - ------- ------- ---------- ---
11-AUG-15 12 A 1 1 NO TAG20150812T110046
11-AUG-15 9 A 1 1 NO TAG20150812T110041
11-AUG-15 7 A 1 1 NO TAG20150811T173207
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 6 11-AUG-15
Backup Piece 6 11-AUG-15 /home/oracle/temp/db_07qebh80_1_1
Backup Set 7 11-AUG-15
Backup Piece 7 11-AUG-15 /home/oracle/c-1414669689-20150811-03
Backup Set 9 12-AUG-15
Backup Piece 9 12-AUG-15 /backup/c-1414669689-20150812-00
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=34 device type=DISK
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 6 11-AUG-15
Backup Piece 6 11-AUG-15 /home/oracle/temp/db_07qebh80_1_1
Backup Set 7 11-AUG-15
Backup Piece 7 11-AUG-15 /home/oracle/c-1414669689-20150811-03
Backup Set 9 12-AUG-15
Backup Piece 9 12-AUG-15 /backup/c-1414669689-20150812-00
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/home/oracle/temp/db_07qebh80_1_1 RECID=6 STAMP=887473408
deleted backup piece
backup piece handle=/home/oracle/c-1414669689-20150811-03 RECID=7 STAMP=887477528
deleted backup piece
backup piece handle=/backup/c-1414669689-20150812-00 RECID=9 STAMP=887540441
Deleted 3 objects
RMAN> list backup by file;
List of Datafile Backups
========================
File Key TY LV S Ckp SCN Ckp Time #Pieces #Copies Compressed Tag
---- ------- - -- - ---------- --------- ------- ------- ---------- ---
1 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
2 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
3 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
4 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
5 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
6 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
7 8 B F A 1140278 12-AUG-15 1 1 NO TAG20150812T105925
List of Archived Log Backups
============================
Thrd Seq Low SCN Low Time BS Key S #Pieces #Copies Compressed Tag
---- ------- ---------- --------- ------- - ------- ------- ---------- ---
1 20 1106818 05-AUG-15 10 A 1 1 NO TAG20150812T110042
1 21 1106821 05-AUG-15 10 A 1 1 NO TAG20150812T110042
1 22 1128050 11-AUG-15 10 A 1 1 NO TAG20150812T110042
1 23 1136492 11-AUG-15 10 A 1 1 NO TAG20150812T110042
1 1 1137634 11-AUG-15 11 A 1 1 NO TAG20150812T110042
1 2 1140324 12-AUG-15 11 A 1 1 NO TAG20150812T110042
List of Control File Backups
============================
CF Ckp SCN Ckp Time BS Key S #Pieces #Copies Compressed Tag
---------- --------- ------- - ------- ------- ---------- ---
1140342 12-AUG-15 12 A 1 1 NO TAG20150812T110046
List of SPFILE Backups
======================
Modification Time BS Key S #Pieces #Copies Compressed Tag
----------------- ------- - ------- ------- ---------- ---
11-AUG-15 12 A 1 1 NO TAG20150812T110046
=====================================================================================
2、Determine how much disk space will be required.
Note: sql valid for version 10g only.
SQL> select DF.TOTAL/1048576 "DataFile Size Mb",
LOG.TOTAL/1048576 "Redo Log Size Mb",
CONTROL.TOTAL/1048576 "Control File Size Mb",
(DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 "Total Size Mb"
from dual,
(select sum(a.bytes) TOTAL from dba_data_files a) DF,
(select sum(b.bytes) TOTAL from v$log b) LOG,
(select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL;
Figure 2a - Calculate total space for all datafiles within database.
SQL> select DF.TOTAL/1048576 "DataFile Size Mb",
LOG.TOTAL/1048576 "Redo Log Size Mb",
CONTROL.TOTAL/1048576 "Control File Size Mb",
(DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 "Total Size Mb" from dual,
(select sum(a.bytes) TOTAL from dba_data_files a
where tablespace_name in('SYSTEM','UNDOTBS1', 'SYSAUX', 'USERS')) DF,
(select sum(b.bytes) TOTAL from v$log b) LOG,
(select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL;
Figure 2b - If duplicating a subset of the database, calculate space for list of tablespaces within primary database.
DataFile Size Mb Redo Log Size Mb Control File Size Mb Total Size Mb
---------------- ---------------- -------------------- -------------
900 150 20.34375 1070.34375
Figure 2c - Sample output of space calculation.
=====================================================================================
3、Ensuring you have enough space on your target server.
=====================================================================================
4. Making the backup available for the duplicate process.
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8 Full 1.08G DISK 00:01:08 12-AUG-15
BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20150812T105925
Piece Name: /backup/df_t887540365_s12_p1
List of Datafiles in backup set 8
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1140278 12-AUG-15 /oradata/orcl/system01.dbf
2 Full 1140278 12-AUG-15 /oradata/orcl/sysaux01.dbf
3 Full 1140278 12-AUG-15 /oradata/orcl/undotbs01.dbf
4 Full 1140278 12-AUG-15 /oradata/orcl/users01.dbf
5 Full 1140278 12-AUG-15 /oradata/orcl/example01.dbf
6 Full 1140278 12-AUG-15 /oradata/orcl/backup01.dbf
7 Full 1140278 12-AUG-15 /oradata/orcl/backup02.dbf
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
10 44.29M DISK 00:00:01 12-AUG-15
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20150812T110042
Piece Name: /backup/al_t887540442_s14_p1
List of Archived Logs in backup set 10
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 20 1106818 05-AUG-15 1106821 05-AUG-15
1 21 1106821 05-AUG-15 1128050 11-AUG-15
1 22 1128050 11-AUG-15 1136492 11-AUG-15
1 23 1136492 11-AUG-15 1136955 11-AUG-15
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
11 1.60M DISK 00:00:00 12-AUG-15
BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20150812T110042
Piece Name: /backup/al_t887540445_s15_p1
List of Archived Logs in backup set 11
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 1 1137634 11-AUG-15 1140324 12-AUG-15
1 2 1140324 12-AUG-15 1140332 12-AUG-15
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12 Full 9.36M DISK 00:00:01 12-AUG-15
BP Key: 12 Status: AVAILABLE Compressed: NO Tag: TAG20150812T110046
Piece Name: /backup/c-1414669689-20150812-01
SPFILE Included: Modification time: 11-AUG-15
SPFILE db_unique_name: ORCL
Control File Included: Ckp SCN: 1140342 Ckp time: 12-AUG-15
RMAN>
=====================================================================================
5. Creating the init.ora & administration directories for the duplicate database.
SQL>create pfile='/home/oracle/initorcl.ora' from spfile;
將pfile傳至auxiliary端$ORACLE_HOME/dbs下
修改初始化引數檔案initorcl.ora
SQL>create spfile from pfile;
SQL>startup nomount
=====================================================================================
6. Ensuring SQL*NET connections to primary database and RMAN catalog are working.
=====================================================================================
7、Prepare RMAN duplicate script.
$rman target sys/oracle@orcl auxiliary sys/oracle
RMAN>
run
{
allocate auxiliary channel C1 device type disk;
duplicate target database to ORCL;
}
------------------------------------------------------
run {
allocate auxiliary channel C1 device type disk;
duplicate target database to AUX;
}
Figure 7a - Sample duplicate command.
run {
allocate auxiliary channel C1 device type disk;
duplicate target database to AUX skip tablespace ABC, XYZ;
}
Figure 7b - Sample duplicate script omitting optional tablespaces;
run {
set until time "to_date('Jan 01 2000 12:00:00','Mon DD YYYY HH24:MI:SS')";
allocate auxiliary channel C1 device type disk;
duplicate target database to AUX;
}
Figure 7c - Sample duplicate script to a point in time.
--------------------------------------------------------
[oracle@zlj dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Aug 12 17:07:44 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@zlj dbs]$
[oracle@zlj dbs]$
[oracle@zlj dbs]$ rman target sys/oracle@orcl auxiliary sys/oracle
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Aug 12 17:08:10 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1414669689)
connected to auxiliary database: ORCL (not mounted)
RMAN> run
2> {
3> allocate auxiliary channel C1 device type disk;
4> duplicate target database to ORCL;
5> }
using target database control file instead of recovery catalog
allocated channel: C1
channel C1: SID=19 device type=DISK
Starting Duplicate Db at 12-AUG-15
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 =
''ORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
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 = ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK
Starting restore at 12-AUG-15
channel C1: starting datafile backup set restore
channel C1: restoring control file
channel C1: reading from backup piece /backup/c-1414669689-20150812-03
channel C1: piece handle=/backup/c-1414669689-20150812-03 tag=TAG20150812T170220
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:01
output file name=/oradata/standby/control01.ctl
output file name=/oradata/standby/control02.ctl
Finished restore at 12-AUG-15
database mounted
contents of Memory Script:
{
set until scn 1183861;
set newname for datafile 1 to
"/oradata/standby/system01.dbf";
set newname for datafile 2 to
"/oradata/standby/sysaux01.dbf";
set newname for datafile 3 to
"/oradata/standby/undotbs01.dbf";
set newname for datafile 4 to
"/oradata/standby/users01.dbf";
set newname for datafile 5 to
"/oradata/standby/example01.dbf";
set newname for datafile 6 to
"/oradata/standby/backup01.dbf";
set newname for datafile 7 to
"/oradata/standby/backup02.dbf";
restore
clone database
;
}
executing Memory Script
executing command: SET until clause
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 12-AUG-15
channel C1: starting datafile backup set restore
channel C1: specifying datafile(s) to restore from backup set
channel C1: restoring datafile 00001 to /oradata/standby/system01.dbf
channel C1: restoring datafile 00002 to /oradata/standby/sysaux01.dbf
channel C1: restoring datafile 00003 to /oradata/standby/undotbs01.dbf
channel C1: restoring datafile 00004 to /oradata/standby/users01.dbf
channel C1: restoring datafile 00005 to /oradata/standby/example01.dbf
channel C1: restoring datafile 00006 to /oradata/standby/backup01.dbf
channel C1: restoring datafile 00007 to /oradata/standby/backup02.dbf
channel C1: reading from backup piece /backup/df_t887562072_s43_p1
channel C1: piece handle=/backup/df_t887562072_s43_p1 tag=TAG20150812T170112
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:55
Finished restore at 12-AUG-15
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=887562576 file name=/oradata/standby/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=887562576 file name=/oradata/standby/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=887562576 file name=/oradata/standby/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=887562576 file name=/oradata/standby/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=887562576 file name=/oradata/standby/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=15 STAMP=887562576 file name=/oradata/standby/backup01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=16 STAMP=887562576 file name=/oradata/standby/backup02.dbf
contents of Memory Script:
{
set until scn 1183861;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 12-AUG-15
starting media recovery
channel C1: starting archived log restore to default destination
channel C1: restoring archived log
archived log thread=1 sequence=58
channel C1: restoring archived log
archived log thread=1 sequence=59
channel C1: reading from backup piece /backup/al_t887562139_s45_p1
channel C1: piece handle=/backup/al_t887562139_s45_p1 tag=TAG20150812T170219
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:01
archived log file name=/archive/orcl1_58_887477514.dbf thread=1 sequence=58
channel clone_default: deleting archived log(s)
archived log file name=/archive/orcl1_58_887477514.dbf RECID=124 STAMP=887562577
archived log file name=/archive/orcl1_59_887477514.dbf thread=1 sequence=59
channel clone_default: deleting archived log(s)
archived log file name=/archive/orcl1_59_887477514.dbf RECID=123 STAMP=887562577
media recovery complete, elapsed time: 00:00:01
Finished recover at 12-AUG-15
Oracle instance started
Total System Global Area 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''ORCL'' 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 = ''ORCL'' 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 242208768 bytes
Fixed Size 2227176 bytes
Variable Size 184550424 bytes
Database Buffers 50331648 bytes
Redo Buffers 5099520 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/oradata/standby/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/oradata/standby/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/oradata/standby/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/oradata/standby/system01.dbf'
CHARACTER SET ZHS16GBK
contents of Memory Script:
{
set newname for tempfile 1 to
"/oradata/standby/temp01.dbf";
set newname for tempfile 2 to
"/oradata/standby/tmp_backup01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/oradata/standby/sysaux01.dbf",
"/oradata/standby/undotbs01.dbf",
"/oradata/standby/users01.dbf",
"/oradata/standby/example01.dbf",
"/oradata/standby/backup01.dbf",
"/oradata/standby/backup02.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to /oradata/standby/temp01.dbf in control file
renamed tempfile 2 to /oradata/standby/tmp_backup01.dbf in control file
cataloged datafile copy
datafile copy file name=/oradata/standby/sysaux01.dbf RECID=1 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/undotbs01.dbf RECID=2 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/users01.dbf RECID=3 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/example01.dbf RECID=4 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/backup01.dbf RECID=5 STAMP=887562587
cataloged datafile copy
datafile copy file name=/oradata/standby/backup02.dbf RECID=6 STAMP=887562587
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=887562587 file name=/oradata/standby/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=887562587 file name=/oradata/standby/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=887562587 file name=/oradata/standby/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=887562587 file name=/oradata/standby/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=887562587 file name=/oradata/standby/backup01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=887562587 file name=/oradata/standby/backup02.dbf
Reenabling controlfile options for auxiliary database
Executing: alter database force logging
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 12-AUG-15
released channel: C1
RMAN>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30310891/viewspace-1769548/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RAC+DG(asm單例項)ASM單例
- 【DG】在Linux平臺上搭建單例項的dataguard--duplicateLinux單例
- ASM單例項安裝後,需要手動設定ASM的引數檔案ASM單例
- 健壯的例項變數 (Non Fragile ivars)和脆弱的例項變數(Fragile ivars)變數
- 【Oracle】ASM例項安裝入門OracleASM
- 11.2.0.4單例項ASM安裝報錯ohasd failed to ... line 73.單例ASMAI
- 【ASK_ORACLE】Relink ASM單例項資料庫詳細步驟OracleASM單例資料庫
- 呀!ASM例項起不來可咋整ASM
- [20191128]11GR2 asm例項audit檔案.txtASM
- Oracle 11gR2 ASM例項記憶體管理OracleASM記憶體
- Redis單例項安裝Redis單例
- PHP 完整表單例項PHP單例
- ORACLE11GR2 RAC解除安裝ASM例項步驟OracleASM
- 【ASM】Oracle RAC css啟動報錯"Duplicate voting file found"ASMOracleCSS
- ORA-15020:discoverd duplicate ASM disk "XXX_CJCDB_OCR_0002"ASM
- Java的Socket通訊簡單例項Java單例
- RAC+單例項DG的切換單例
- C++學習隨筆——簡單的單例設計模式例項C++單例設計模式
- 【ASM】Oracle asm刪除磁碟組注意事項ASMOracle
- opengl簡單入門例項
- rac恢復到單例項單例
- 單例項mysql.yaml kubernetes單例MySqlYAML
- Spark 簡單例項(基本操作)Spark單例
- C#out引數的簡單例項C#單例
- Spring 原始碼學習 - 單例bean的例項化過程Spring原始碼單例Bean
- php例項化物件的例項方法PHP物件
- canal同步mysql,監聽單例項,多例項配置MySql單例
- EventBus詳解及簡單例項單例
- 利用白名單繞過360例項
- on duplicate key update簡單使用
- 例項QT程式 —— Qt單例不規則介面程式QT單例
- 快遞鳥查詢訂單例項單例
- docker 執行elasticsearch單例項(elasticsearch:7.12.0)DockerElasticsearch單例
- python 單一程式例項 實現Python
- ElasticSearch客戶端簡單操作例項Elasticsearch客戶端
- [20201231]單例項data buffer states.txt單例
- JavaScript 表單驗證程式碼例項JavaScript
- oracle之 單例項監聽修改埠Oracle單例
- html實現簡單ListViews效果的例項程式碼HTMLView