当前位置:Gxlcms > mysql > DuplicatingaDatabase

DuplicatingaDatabase

时间:2021-07-01 10:21:17 帮助过:26人阅读

使用duplicate命令,可以创建一个完全独立的数据库拷贝,该命令执行过程中会自动为duplicated数据库分配一个新的dbid。其具体过程我们以同一台机器内部复制和两



Starting Duplicate Db at 25-AUG-13

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=63 device type=DISK


contents of Memory Script:

{

sql clone "alter system set db_name =

''CRM'' comment=

''Modified by RMAN duplicate'' scope=spfile";

sql clone "alter system set db_unique_name =

''CRM'' 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 = ''CRM'' comment= ''Modified by RMAN duplicate'' scope=spfile


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

Oracle instance shut down


Oracle instance started


Total System Global Area 1252663296 bytes


Fixed Size 2226072 bytes

Variable Size 973080680 bytes

Database Buffers 268435456 bytes

Redo Buffers 8921088 bytes


Starting restore at 25-AUG-13

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=63 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 /backup/c-3599153036-20130824-01

channel ORA_AUX_DISK_1: piece handle=/backup/c-3599153036-20130824-01 tag=TAG20130824T233319

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03

output file name=/oracle/CRM2/control01.ctl

output file name=/oracle/CRM2/control02.ctl

Finished restore at 25-AUG-13


database mounted


contents of Memory Script:

{

set until scn 2892348;

set newname for datafile 1 to

"/oracle/CRM2/system01.dbf";

set newname for datafile 2 to

"/oracle/CRM2/sysaux01.dbf";

set newname for datafile 3 to

"/oracle/CRM2/zx.dbf";

set newname for datafile 4 to

"/oracle/CRM2/users01.dbf";

set newname for datafile 5 to

"/oracle/CRM2/pos.dbf";

set newname for datafile 6 to

"/oracle/CRM2/erp.dbf";

set newname for datafile 7 to

"/oracle/CRM2/user01.dbf";

set newname for datafile 8 to

"/oracle/CRM2/undotbs03.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


executing command: SET NEWNAME


Starting restore at 25-AUG-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 /oracle/CRM2/system01.dbf

channel ORA_AUX_DISK_1: restoring datafile 00002 to /oracle/CRM2/sysaux01.dbf

channel ORA_AUX_DISK_1: restoring datafile 00003 to /oracle/CRM2/zx.dbf

channel ORA_AUX_DISK_1: restoring datafile 00004 to /oracle/CRM2/users01.dbf

channel ORA_AUX_DISK_1: restoring datafile 00005 to /oracle/CRM2/pos.dbf

channel ORA_AUX_DISK_1: restoring datafile 00006 to /oracle/CRM2/erp.dbf

channel ORA_AUX_DISK_1: restoring datafile 00007 to /oracle/CRM2/user01.dbf

channel ORA_AUX_DISK_1: restoring datafile 00008 to /oracle/CRM2/undotbs03.dbf

channel ORA_AUX_DISK_1: reading from backup piece /backup/0moi4s34_1_1

channel ORA_AUX_DISK_1: piece handle=/backup/0moi4s34_1_1 tag=TAG20130824T232939

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:15

Finished restore at 25-AUG-13


contents of Memory Script:

{

switch clone datafile all;

}

executing Memory Script


datafile 1 switched to datafile copy

input datafile copy RECID=1 STAMP=824344808 file name=/oracle/CRM2/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=2 STAMP=824344809 file name=/oracle/CRM2/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=3 STAMP=824344809 file name=/oracle/CRM2/zx.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=4 STAMP=824344809 file name=/oracle/CRM2/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=5 STAMP=824344809 file name=/oracle/CRM2/pos.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=6 STAMP=824344809 file name=/oracle/CRM2/erp.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=7 STAMP=824344809 file name=/oracle/CRM2/user01.dbf

datafile 8 switched to datafile copy

input datafile copy RECID=8 STAMP=824344809 file name=/oracle/CRM2/undotbs03.dbf


contents of Memory Script:

{

set until scn 2892348;

recover

clone database

delete archivelog

;

}

executing Memory Script


executing command: SET until clause


Starting recover at 25-AUG-13

using channel ORA_AUX_DISK_1


starting media recovery


channel ORA_AUX_DISK_1: starting archived log restore to default destination

channel ORA_AUX_DISK_1: restoring archived log

archived log thread=1 sequence=15

channel ORA_AUX_DISK_1: reading from backup piece /backup/0noi4s9t_1_1

channel ORA_AUX_DISK_1: piece handle=/backup/0noi4s9t_1_1 tag=TAG20130824T233316

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

archived log file name=/oracle/archive/1_15_823810820.dbf thread=1 sequence=15

channel clone_default: deleting archived log(s)

archived log file name=/oracle/archive/1_15_823810820.dbf RECID=57 STAMP=824344817

media recovery complete, elapsed time: 00:00:02

Finished recover at 25-AUG-13

Oracle instance started


Total System Global Area 1252663296 bytes


Fixed Size 2226072 bytes

Variable Size 973080680 bytes

Database Buffers 268435456 bytes

Redo Buffers 8921088 bytes


contents of Memory Script:

{

sql clone "alter system set db_name =

''CRM'' 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 = ''CRM'' 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 1252663296 bytes


Fixed Size 2226072 bytes

Variable Size 973080680 bytes

Database Buffers 268435456 bytes

Redo Buffers 8921088 bytes

sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CRM" RESETLOGS ARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1 ( '/oracle/CRM2/redo01.log' ) SIZE 200 M REUSE,

GROUP 2 ( '/oracle/CRM2/redo02.log' ) SIZE 200 M REUSE,

GROUP 3 ( '/oracle/CRM2/redo03.log' ) SIZE 200 M REUSE,

GROUP 4 ( '/oracle/CRM2/redo02.dbf' ) SIZE 200 M REUSE

DATAFILE

'/oracle/CRM2/system01.dbf'

CHARACTER SET ZHS16GBK



contents of Memory Script:

{

catalog clone datafilecopy "/oracle/CRM2/sysaux01.dbf",

"/oracle/CRM2/zx.dbf",

"/oracle/CRM2/users01.dbf",

"/oracle/CRM2/pos.dbf",

"/oracle/CRM2/erp.dbf",

"/oracle/CRM2/user01.dbf",

"/oracle/CRM2/undotbs03.dbf";

switch clone datafile all;

}

executing Memory Script


cataloged datafile copy

datafile copy file name=/oracle/CRM2/sysaux01.dbf RECID=1 STAMP=824344852

cataloged datafile copy

datafile copy file name=/oracle/CRM2/zx.dbf RECID=2 STAMP=824344852

cataloged datafile copy

datafile copy file name=/oracle/CRM2/users01.dbf RECID=3 STAMP=824344852

cataloged datafile copy

datafile copy file name=/oracle/CRM2/pos.dbf RECID=4 STAMP=824344852

cataloged datafile copy

datafile copy file name=/oracle/CRM2/erp.dbf RECID=5 STAMP=824344852

cataloged datafile copy

datafile copy file name=/oracle/CRM2/user01.dbf RECID=6 STAMP=824344852

cataloged datafile copy

datafile copy file name=/oracle/CRM2/undotbs03.dbf RECID=7 STAMP=824344852


datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=824344852 file name=/oracle/CRM2/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=824344852 file name=/oracle/CRM2/zx.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=824344852 file name=/oracle/CRM2/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=4 STAMP=824344852 file name=/oracle/CRM2/pos.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=5 STAMP=824344852 file name=/oracle/CRM2/erp.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=6 STAMP=824344852 file name=/oracle/CRM2/user01.dbf

datafile 8 switched to datafile copy

input datafile copy RECID=7 STAMP=824344852 file name=/oracle/CRM2/undotbs03.dbf


contents of Memory Script:

{

Alter clone database open resetlogs;

}

executing Memory Script


database opened

Finished Duplicate Db at 25-AUG-13


--------------------------------完---------------------------------------------

本文出自 “myblog” 博客,,请务必保留此出处

人气教程排行