6、在RMAN中执行数据库的复制操作。
[Oracle@ORA10G dbs]$ rman
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Feb 17 19:51:50 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
RMAN> connect target sys/hongye50@hongye
connected to target database: HONGYE (DBID=2424037643)
RMAN> connect auxiliary /
connected to auxiliary database: CATDB (not mounted)
RMAN> duplicate target database to catdb;
Starting Duplicate Db at 17-FEB-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=56 devtype=DISK
contents of Memory Script:
{
set until scn 1219581;
set newname for datafile 1 to
"/oracle/oradata/catdb/system01.dbf";
set newname for datafile 2 to
"/oracle/oradata/catdb/undotbs01.dbf";
set newname for datafile 3 to
"/oracle/oradata/catdb/sysaux01.dbf";
set newname for datafile 4 to
"/oracle/oradata/catdb/users01.dbf";
set newname for datafile 5 to
"/oracle/oradata/catdb/example01.dbf";
restore
check readonly
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 17-FEB-11
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/oradata/catdb/system01.dbf
restoring datafile 00002 to /oracle/oradata/catdb/undotbs01.dbf
restoring datafile 00003 to /oracle/oradata/catdb/sysaux01.dbf
restoring datafile 00004 to /oracle/oradata/catdb/users01.dbf
restoring datafile 00005 to /oracle/oradata/catdb/example01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_nnndf_TAG20110217T191915_6ot11mbc_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_nnndf_TAG20110217T191915_6ot11mbc_.bkp tag=TAG20110217T191915
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:37
Finished restore at 17-FEB-11
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CATDB" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/oracle/oradata/catdb/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/oracle/oradata/catdb/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/oracle/oradata/catdb/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/oracle/oradata/catdb/system01.dbf'
CHARACTER SET WE8ISO8859P1
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=743370847 filename=/oracle/oradata/catdb/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=743370847 filename=/oracle/oradata/catdb/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=743370847 filename=/oracle/oradata/catdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=743370847 filename=/oracle/oradata/catdb/example01.dbf
contents of Memory Script:
{
set until scn 1219581;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 17-FEB-11
using channel ORA_AUX_DISK_1
starting media recovery
channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=2
channel ORA_AUX_DISK_1: reading from backup piece /oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T192041_6ot14bjm_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T192041_6ot14bjm_.bkp tag=TAG20110217T192041
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=/oracle/flash_recovery_area/CATDB/archivelog/2011_02_17/o1_mf_1_2_6ot3332m_.arc thread=1 sequence=2
channel clone_default: deleting archive log(s)
archive log filename=/oracle/flash_recovery_area/CATDB/archivelog/2011_02_17/o1_mf_1_2_6ot3332m_.arc recid=1 stamp=743370851
media recovery complete, elapsed time: 00:00:03
Finished recover at 17-FEB-11
contents of Memory Script:
{
shutdown clone;
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 83886080 bytes
Fixed Size 1272096 bytes
Variable Size 58722016 bytes
Database Buffers 16777216 bytes
Redo Buffers 7114752 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CATDB" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/oracle/oradata/catdb/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/oracle/oradata/catdb/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/oracle/oradata/catdb/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/oracle/oradata/catdb/system01.dbf'
CHARACTER SET WE8ISO8859P1
contents of Memory Script:
{
set newname for tempfile 1 to
"/oracle/oradata/catdb/temp01.dbf";
set newname for tempfile 2 to
"/oracle/oradata/catdb/temp02.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/oracle/oradata/catdb/undotbs01.dbf";
catalog clone datafilecopy "/oracle/oradata/catdb/sysaux01.dbf";
catalog clone datafilecopy "/oracle/oradata/catdb/users01.dbf";
catalog clone datafilecopy "/oracle/oradata/catdb/example01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed temporary file 1 to /oracle/oradata/catdb/temp01.dbf in control file
renamed temporary file 2 to /oracle/oradata/catdb/temp02.dbf in control file
cataloged datafile copy
datafile copy filename=/oracle/oradata/catdb/undotbs01.dbf recid=1 stamp=743370868
cataloged datafile copy
datafile copy filename=/oracle/oradata/catdb/sysaux01.dbf recid=2 stamp=743370869
cataloged datafile copy
datafile copy filename=/oracle/oradata/catdb/users01.dbf recid=3 stamp=743370869
cataloged datafile copy
datafile copy filename=/oracle/oradata/catdb/example01.dbf recid=4 stamp=743370869
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=743370868 filename=/oracle/oradata/catdb/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=743370869 filename=/oracle/oradata/catdb/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=743370869 filename=/oracle/oradata/catdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=743370869 filename=/oracle/oradata/catdb/example01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 17-FEB-11
RMAN> exit
Recovery Manager complete.
