Oracle 11g RMAN新特性 active database duplication 复制数据库

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:760

Oracle 11g RMAN新特性 active database duplication 复制数据库

第二.利用active database duplication 复制一个数据库
前面1到5步 和创建standby 数据库一样
其中第5步设置dataguard相关初始化参数可以去掉

6.登录主库 开始复制
C:\Documents and Settings\Administrator>set oracle_sid=primary
C:\Documents and Settings\Administrator>rman target / auxiliary mailto:sys/abcdefg@standby]sys/abcdefg@standby
Recovery Manager: Release 11.1.0.6.0 - Production on Thu Jul 31 14:10:57 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: PRIMARY (DBID=1498839992)
connected to auxiliary database: PRIMARY (not mounted)
RMAN> RMAN> duplicate target database to 'standby'
2> from active database
3> spfile set DB_UNIQUE_NAME 'standby'
4> set log_archive_dest_1
5> 'LOCATION=d:\standby\archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
6> '
7> set CONTROL_FILES 'd:\app\administrator\oradata\standby\control01.ctl',
8> 'd:\app\administrator\oradata\standby\control02.ctl',
9> 'd:\app\administrator\oradata\standby\control03.ctl'
10> ;
Starting Duplicate Db at 31-JUL-08
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=98 device type=DISK
contents of Memory Script.:
{
backup as copy reuse
file 'D:\APP\ADMINISTRATOR\PRODUCT\11.1.0\DB_1\DATABASE\SPFILEPRIMARY.ORA' auxiliary format
'D:\APP\ADMINISTRATOR\PRODUCT\11.1.0\DB_1\DATABASE\SPFILESTANDBY.ORA' ;
sql clone "alter system set spfile= ''D:\APP\ADMINISTRATOR\PRODUCT\11.1.0\DB_1\DATABASE\SPFILESTANDBY.ORA''";
}
executing Memory Script
Starting backup at 31-JUL-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=138 device type=DISK
Finished backup at 31-JUL-08
sql statement: alter system set spfile= ''D:\APP\ADMINISTRATOR\PRODUCT\11.1.0\DB_1\DATABASE\SPFILESTANDBY.ORA''
contents of Memory Script.:
{
sql clone "alter system set db_name =
''STANDBY'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''standby'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''LOCATION=d:\standby\archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES)'' comment=
'''' scope=spfile";
sql clone "alter system set CONTROL_FILES =
''d:\app\administrator\oradata\standby\control01.ctl'', ''d:\app\administrator\oradata\standby\control02.ctl'', ''d:\app\administrator\oradata\standby\control03.ctl'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount ;
}
executing Memory Script
sql statement: alter system set db_name = ''STANDBY'' comment= ''duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''standby'' comment= '''' scope=spfile
sql statement: alter system set log_archive_dest_1 = ''LOCATION=d:\standby\archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES)'' comment= '''' scope=spfile
sql statement: alter system set CONTROL_FILES = ''d:\app\administrator\oradata\standby\control01.ctl'', ''d:\app\administrator\oradata\standby\control02.ctl'', ''d:\app\administrator\oradata\standby\control03.ctl'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 431038464 bytes
Fixed Size 1333676 bytes
Variable Size 255854164 bytes
Database Buffers 167772160 bytes
Redo Buffers 6078464 bytes
contents of Memory Script.:
{
set newname for datafile 1 to
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSTEM01.DBF";
set newname for datafile 2 to
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSAUX01.DBF";
set newname for datafile 3 to
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\UNDOTBS01.DBF";
set newname for datafile 4 to
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\USERS01.DBF";
set newname for datafile 5 to
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\TEST01_NEW.DBF";
backup as copy reuse
datafile 1 auxiliary format
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSTEM01.DBF" datafile
2 auxiliary format
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSAUX01.DBF" datafile
3 auxiliary format
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\UNDOTBS01.DBF" datafile
4 auxiliary format
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\USERS01.DBF" datafile
5 auxiliary format
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\TEST01_NEW.DBF" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 31-JUL-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=D:\APP\ADMINISTRATOR\ORADATA\PRIMARY\SYSTEM01.DBF
output file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSTEM01.DBF tag=TAG20080731T141157 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=D:\APP\ADMINISTRATOR\ORADATA\PRIMARY\UNDOTBS01.DBF
output file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\UNDOTBS01.DBF tag=TAG20080731T141157 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=D:\APP\ADMINISTRATOR\ORADATA\PRIMARY\SYSAUX01.DBF
output file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSAUX01.DBF tag=TAG20080731T141157 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=D:\APP\ADMINISTRATOR\ORADATA\PRIMARY\TEST01_NEW.DBF
output file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\TEST01_NEW.DBF tag=TAG20080731T141157 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=D:\APP\ADMINISTRATOR\ORADATA\PRIMARY\USERS01.DBF
output file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\USERS01.DBF tag=TAG20080731T141157 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 31-JUL-08
sql statement: alter system archive log current
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "STANDBY" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( 'D:\APP\ADMINISTRATOR\ORADATA\STANDBY\REDO01.LOG' ) SIZE 50 M REUSE,
GROUP 2 ( 'D:\APP\ADMINISTRATOR\ORADATA\STANDBY\REDO02.LOG' ) SIZE 50 M REUSE,
GROUP 3 ( 'D:\APP\ADMINISTRATOR\ORADATA\STANDBY\REDO03.LOG' ) SIZE 50 M REUSE
DATAFILE
'D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSTEM01.DBF'
CHARACTER SET WE8MSWIN1252

contents of Memory Script.:
{
backup as copy reuse
archivelog like "D:\PRIMARY\ARCHIVELOG\ARC00047_0661357304.001" auxiliary format
"D:\STANDBY\ARCHIVELOG\ARC00047_0661357304.001" ;
catalog clone archivelog "D:\STANDBY\ARCHIVELOG\ARC00047_0661357304.001";
switch clone datafile all;
}
executing Memory Script
Starting backup at 31-JUL-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=47 RECID=65 STAMP=661529574
output file name=D:\STANDBY\ARCHIVELOG\ARC00047_0661357304.001 RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 31-JUL-08
cataloged archived log
archived log file name=D:\STANDBY\ARCHIVELOG\ARC00047_0661357304.001 RECID=1 STAMP=661529578
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=661529578 file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=661529579 file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\UNDOTBS01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=661529579 file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=661529579 file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\TEST01_NEW.DBF
contents of Memory Script.:
{
set until scn 286773;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 31-JUL-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=153 device type=DISK
starting media recovery
archived log for thread 1 with sequence 47 is already on disk as file D:\STANDBY\ARCHIVELOG\ARC00047_0661357304.001
archived log file name=D:\STANDBY\ARCHIVELOG\ARC00047_0661357304.001 thread=1 sequence=47
media recovery complete, elapsed time: 00:00:00
Finished recover at 31-JUL-08
contents of Memory Script.:
{
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 431038464 bytes
Fixed Size 1333676 bytes
Variable Size 255854164 bytes
Database Buffers 167772160 bytes
Redo Buffers 6078464 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "STANDBY" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( 'D:\APP\ADMINISTRATOR\ORADATA\STANDBY\REDO01.LOG' ) SIZE 50 M REUSE,
GROUP 2 ( 'D:\APP\ADMINISTRATOR\ORADATA\STANDBY\REDO02.LOG' ) SIZE 50 M REUSE,
GROUP 3 ( 'D:\APP\ADMINISTRATOR\ORADATA\STANDBY\REDO03.LOG' ) SIZE 50 M REUSE
DATAFILE
'D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSTEM01.DBF'
CHARACTER SET WE8MSWIN1252

contents of Memory Script.:
{
set newname for tempfile 1 to
"D:\APP\ADMINISTRATOR\ORADATA\STANDBY\TEMP01.DBF";
switch clone tempfile all;
catalog clone datafilecopy "D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSAUX01.DBF";
catalog clone datafilecopy "D:\APP\ADMINISTRATOR\ORADATA\STANDBY\UNDOTBS01.DBF";
catalog clone datafilecopy "D:\APP\ADMINISTRATOR\ORADATA\STANDBY\USERS01.DBF";
catalog clone datafilecopy "D:\APP\ADMINISTRATOR\ORADATA\STANDBY\TEST01_NEW.DBF";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to D:\APP\ADMINISTRATOR\ORADATA\STANDBY\TEMP01.DBF in control file
cataloged datafile copy
datafile copy file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSAUX01.DBF RECID=1 STAMP=661529588
cataloged datafile copy
datafile copy file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\UNDOTBS01.DBF RECID=2 STAMP=661529588
cataloged datafile copy
datafile copy file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\USERS01.DBF RECID=3 STAMP=661529588
cataloged datafile copy
datafile copy file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\TEST01_NEW.DBF RECID=4 STAMP=661529588
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=661529588 file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\SYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=661529588 file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\UNDOTBS01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=661529588 file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=661529588 file name=D:\APP\ADMINISTRATOR\ORADATA\STANDBY\TEST01_NEW.DBF
contents of Memory Script.:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 31-JUL-08
7.登录复制的数据库
C:\Documents and Settings\Administrator>set oracle_sid=standby
C:\Documents and Settings\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Thu Jul 31 14:05:15 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select status,instance_name from v$instance;
STATUS INSTANCE_NAME
------------ ----------------
OPEN standby
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination d:\standby\archivelog
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】