首页 > Linux操作系统 > Linux操作系统 > 数据库DUPLICATE实验
今天在windows下的oracle做DUPLICATE一个目标数据库。
windows和unix的区别可能就是需要开启一个新实例的服务ORADIM -new -sid 来新注册启动一个实例。
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup force nomount pfile=D:\app\Administrator\product\11.2.0\dbhome_1\database\initdupdb.ora
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 230687184 bytes
Database Buffers 297795584 bytes
Redo Buffers 5804032 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
C:\Documents and Settings\Administrator>orapwd file=D:\app\Administrator\product\11.2.0\dbhome_1\database\orapwdupdb password
=5 force=y
C:\Documents and Settings\Administrator>rman target sys/Password123@orcl auxiliary sys/oracle@dupdb
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Mar 30 21:45:37 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1331365231)
connected to auxiliary database: DUPDB (not mounted)
RMAN> DUPLICATE TARGET DATABASE TO dupdb;
Starting Duplicate Db at 30-MAR-13
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=10 device type=DISK
contents of Memory Script.:
{
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script.:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 230687184 bytes
Database Buffers 297795584 bytes
Redo Buffers 5804032 bytes
contents of Memory Script.:
{
sql clone "alter system set db_name =
''ORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''DUPDB'' 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 = ''DUPDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 230687184 bytes
Database Buffers 297795584 bytes
Redo Buffers 5804032 bytes
Starting restore at 30-MAR-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=134 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2013_03_30\O1_MF_S
DMFO_.BKP
channel ORA_AUX_DISK_1: piece handle=D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2013_03_30\O1_MF_S_811459986_8O
=TAG20130330T213306
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\CONTROL01.CTL
Finished restore at 30-MAR-13
database mounted
contents of Memory Script.:
{
set until scn 5411356;
set newname for datafile 1 to
"D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSTEM01.DBF";
set newname for datafile 2 to
"D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSAUX01.DBF";
set newname for datafile 3 to
"D:\APP\ADMINISTRATOR\ORADATA\DUPDB\UNDOTBS01.DBF";
set newname for datafile 4 to
"D:\APP\ADMINISTRATOR\ORADATA\DUPDB\USERS01.DBF";
set newname for datafile 5 to
"D:\APP\ADMINISTRATOR\ORADATA\DUPDB\EXAMPLE01.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
Starting restore at 30-MAR-13
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSTEM01.DBF
channel ORA_AUX_DISK_1: restoring datafile 00002 to D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSAUX01.DBF
channel ORA_AUX_DISK_1: restoring datafile 00003 to D:\APP\ADMINISTRATOR\ORADATA\DUPDB\UNDOTBS01.DBF
channel ORA_AUX_DISK_1: restoring datafile 00004 to D:\APP\ADMINISTRATOR\ORADATA\DUPDB\USERS01.DBF
channel ORA_AUX_DISK_1: restoring datafile 00005 to D:\APP\ADMINISTRATOR\ORADATA\DUPDB\EXAMPLE01.DBF
channel ORA_AUX_DISK_1: reading from backup piece D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2013_03_30\O1_MF_NN
T213128_8OFT9K98_.BKP
channel ORA_AUX_DISK_1: piece handle=D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2013_03_30\O1_MF_NNNDF_TAG201303
K98_.BKP tag=TAG20130330T213128
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:25
Finished restore at 30-MAR-13
contents of Memory Script.:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=811460865 file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSTEM01.DBF
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=811460865 file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=811460865 file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\UNDOTBS01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=811460866 file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=11 STAMP=811460866 file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\EXAMPLE01.DBF
contents of Memory Script.:
{
set until scn 5411356;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 30-MAR-13
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 4 is already on disk as file D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG
MF_1_4_8OFTDJHN_.ARC
archived log file name=D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2013_03_30\O1_MF_1_4_8OFTDJHN_.ARC thread=1 s
media recovery complete, elapsed time: 00:00:01
Finished recover at 30-MAR-13
contents of Memory Script.:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''DUPDB'' 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
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 230687184 bytes
Database Buffers 297795584 bytes
Redo Buffers 5804032 bytes
sql statement: alter system set db_name = ''DUPDB'' 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 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 230687184 bytes
Database Buffers 297795584 bytes
Redo Buffers 5804032 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPDB" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( 'D:\APP\ADMINISTRATOR\ORADATA\DUPDB\REDO01.LOG' ) SIZE 50 M REUSE,
GROUP 2 ( 'D:\APP\ADMINISTRATOR\ORADATA\DUPDB\REDO02.LOG' ) SIZE 50 M REUSE,
GROUP 3 ( 'D:\APP\ADMINISTRATOR\ORADATA\DUPDB\REDO03.LOG' ) SIZE 50 M REUSE
DATAFILE
'D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSTEM01.DBF'
CHARACTER SET AL32UTF8
contents of Memory Script.:
{
set newname for tempfile 1 to
"D:\APP\ADMINISTRATOR\ORADATA\DUPDB\TEMP01.DBF";
switch clone tempfile all;
catalog clone datafilecopy "D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSAUX01.DBF",
"D:\APP\ADMINISTRATOR\ORADATA\DUPDB\UNDOTBS01.DBF",
"D:\APP\ADMINISTRATOR\ORADATA\DUPDB\USERS01.DBF",
"D:\APP\ADMINISTRATOR\ORADATA\DUPDB\EXAMPLE01.DBF";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to D:\APP\ADMINISTRATOR\ORADATA\DUPDB\TEMP01.DBF in control file
cataloged datafile copy
datafile copy file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSAUX01.DBF RECID=1 STAMP=811460886
cataloged datafile copy
datafile copy file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\UNDOTBS01.DBF RECID=2 STAMP=811460886
cataloged datafile copy
datafile copy file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\USERS01.DBF RECID=3 STAMP=811460886
cataloged datafile copy
datafile copy file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\EXAMPLE01.DBF RECID=4 STAMP=811460886
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=811460886 file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\SYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=811460886 file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\UNDOTBS01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=811460886 file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=811460886 file name=D:\APP\ADMINISTRATOR\ORADATA\DUPDB\EXAMPLE01.DBF
contents of Memory Script.:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 30-MAR-13
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28487128/viewspace-757486/ ,如需转载,请注明出处,否则将追究法律责任。