考虑数据库迁移可以通过duplicate 方式迁移整个库的方式,这次项目可以采用下,所以测试下,很成功,所以记录下来:

均在本机复制不同的目录下:

备份:

run {
 backup full database format '/data/oracle/marven/archive/backmarven_%U';
 backup archivelog all format '/data/oracle/marven/archive/arc_%U.bak' ;
 copy current controlfile to '/data/oracle/marven/archive/control_bak.ctl';
}

恢复

 run
{ allocate auxiliary channel d1 type disk ;
set newname for datafile 1 to '/data/oracle/marven/system01.dbf';
set newname for datafile 2 to '/data/oracle/marven/undotbs01.dbf';
set newname for datafile 3 to '/data/oracle/marven/cwmlite01.dbf';
set newname for datafile 4 to '/data/oracle/marven/drsys01.dbf';
set newname for datafile 5 to '/data/oracle/marven/example01.dbf';
set newname for datafile 6 to '/data/oracle/marven/indx01.dbf';
set newname for datafile 7 to '/data/oracle/marven/odm01.dbf';
set newname for datafile 8 to '/data/oracle/marven/tools01.dbf';
set newname for datafile 9 to '/data/oracle/marven/users01.dbf';
set newname for datafile 10 to '/data/oracle/marven/xdb01.dbf';
duplicate target database to "marven"
logfile
'/data/oracle/marven/redo01.log' size 50m,
'/data/oracle/marven/redo02.log' size 50m,
'/data/oracle/marven/redo03.log' size 50m;
}

 


released channel: ORA_DISK_1
allocated channel: d1
channel d1: sid=15 devtype=DISK

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

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting Duplicate Db at 2010-08-12 21:02:21

printing stored script: Memory Script
{
   set until scn  188632;
   set newname for datafile  1 to
 "/data/oracle/marven/system01.dbf";
   set newname for datafile  2 to
 "/data/oracle/marven/undotbs01.dbf";
   set newname for datafile  3 to
 "/data/oracle/marven/cwmlite01.dbf";
   set newname for datafile  4 to
 "/data/oracle/marven/drsys01.dbf";
   set newname for datafile  5 to
 "/data/oracle/marven/example01.dbf";
   set newname for datafile  6 to
 "/data/oracle/marven/indx01.dbf";
   set newname for datafile  7 to
 "/data/oracle/marven/odm01.dbf";
   set newname for datafile  8 to
 "/data/oracle/marven/tools01.dbf";
   set newname for datafile  9 to
 "/data/oracle/marven/users01.dbf";
   set newname for datafile  10 to
 "/data/oracle/marven/xdb01.dbf";
   restore
   check readonly
   clone database
   ;
}
executing script: 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

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 2010-08-12 21:02:21

channel d1: starting datafile backupset restore
channel d1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /data/oracle/marven/system01.dbf
restoring datafile 00002 to /data/oracle/marven/undotbs01.dbf
restoring datafile 00003 to /data/oracle/marven/cwmlite01.dbf
restoring datafile 00004 to /data/oracle/marven/drsys01.dbf
restoring datafile 00005 to /data/oracle/marven/example01.dbf
restoring datafile 00006 to /data/oracle/marven/indx01.dbf
restoring datafile 00007 to /data/oracle/marven/odm01.dbf
restoring datafile 00008 to /data/oracle/marven/tools01.dbf
restoring datafile 00009 to /data/oracle/marven/users01.dbf
restoring datafile 00010 to /data/oracle/marven/xdb01.dbf
channel d1: restored backup piece 1
piece handle=/data/oracle/marven/archive/backmarven_07ll6c87_1_1 tag=TAG20100812T205846 params=NULL
channel d1: restore complete
Finished restore at 2010-08-12 21:03:17
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "marven" RESETLOGS ARCHIVELOG
  MAXLOGFILES     50
  MAXLOGMEMBERS      5
  MAXDATAFILES      100
  MAXINSTANCES     1
  MAXLOGHISTORY      226
 LOGFILE
  GROUP  1 '/data/oracle/marven/redo01.log' SIZE   52428800 ,
  GROUP  2 '/data/oracle/marven/redo02.log' SIZE   52428800 ,
  GROUP  3 '/data/oracle/marven/redo03.log' SIZE   52428800
 DATAFILE
  '/data/oracle/marven/system01.dbf'
 CHARACTER SET ZHS16GBK


printing stored script: Memory Script
{
   switch clone datafile all;
}
executing script: Memory Script

datafile 2 switched to datafile copy
input datafilecopy recid=1 stamp=726872599 filename=/data/oracle/marven/undotbs01.dbf
datafile 3 switched to datafile copy
input datafilecopy recid=2 stamp=726872599 filename=/data/oracle/marven/cwmlite01.dbf
datafile 4 switched to datafile copy
input datafilecopy recid=3 stamp=726872599 filename=/data/oracle/marven/drsys01.dbf
datafile 5 switched to datafile copy
input datafilecopy recid=4 stamp=726872599 filename=/data/oracle/marven/example01.dbf
datafile 6 switched to datafile copy
input datafilecopy recid=5 stamp=726872599 filename=/data/oracle/marven/indx01.dbf
datafile 7 switched to datafile copy
input datafilecopy recid=6 stamp=726872599 filename=/data/oracle/marven/odm01.dbf
datafile 8 switched to datafile copy
input datafilecopy recid=7 stamp=726872599 filename=/data/oracle/marven/tools01.dbf
datafile 9 switched to datafile copy
input datafilecopy recid=8 stamp=726872599 filename=/data/oracle/marven/users01.dbf
datafile 10 switched to datafile copy
input datafilecopy recid=9 stamp=726872599 filename=/data/oracle/marven/xdb01.dbf

printing stored script: Memory Script
{
   set until scn  188632;
   recover
   clone database
    delete archivelog
   ;
}
executing script: Memory Script

executing command: SET until clause

Starting recover at 2010-08-12 21:03:21

starting media recovery

archive log thread 1 sequence 2 is already on disk as file /data/oracle/archive/1_2.dbf
archive log filename=/data/oracle/archive/1_2.dbf thread=1 sequence=2
media recovery complete
Finished recover at 2010-08-12 21:03:22

printing stored script: Memory Script
{
   shutdown clone;
   startup clone nomount ;
}
executing script: Memory Script

sql>alter database open resetlogs;