登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

li.angshan 的博客

关注数据计算领域

 
 
 

日志

 
 
 
 

使用rman duplicate迁移数据库  

2009-10-29 12:07:44|  分类: oracle rman技术 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

step1 :backup whole db using rman tools include crontrol files and archive log ;

step2: copy backup sets on same to primary host location;

step3: vi dupliate1.rcv

run{
SET NEWNAME FOR DATAFILE 1 to '/mnt/disk1/oracle/oradata/orcl/system01.dbf';
SET NEWNAME FOR DATAFILE 2 to '/mnt/disk1/oracle/oradata/orcl/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 3 to '/mnt/disk1/oracle/oradata/orcl/sysaux01.dbf';
SET NEWNAME FOR DATAFILE 4 to '/mnt/disk1/oracle/oradata/orcl/users01.dbf';
SET NEWNAME FOR TEMPFILE 1 to '/mnt/disk1/oracle/oradata/orcl/temp01.dbf';
DUPLICATE TARGET DATABASE to orcl
LOGFILE
    '/mnt/disk1/oracle/oradata/orcl/redo01.log' SIZE 4096K,
    '/mnt/disk1/oracle/oradata/orcl/redo02.log' SIZE 4096K,
    '/mnt/disk1/oracle/oradata/orcl/redo03.log' SIZE 4096K;
}

 

step4:

rman:@dupliate1.rcv

RMAN> run{
2> SET NEWNAME FOR DATAFILE 1 to '/mnt/disk1/oracle/oradata/orcl/system01.dbf';
3> SET NEWNAME FOR DATAFILE 2 to '/mnt/disk1/oracle/oradata/orcl/undotbs01.dbf';
4> SET NEWNAME FOR DATAFILE 3 to '/mnt/disk1/oracle/oradata/orcl/sysaux01.dbf';
5> SET NEWNAME FOR DATAFILE 4 to '/mnt/disk1/oracle/oradata/orcl/users01.dbf';
6> SET NEWNAME FOR TEMPFILE 1 to '/mnt/disk1/oracle/oradata/orcl/temp01.dbf';
7> DUPLICATE TARGET DATABASE to orcl
8> LOGFILE
9>     '/mnt/disk1/oracle/oradata/orcl/redo01.log' SIZE 4096K,
10>     '/mnt/disk1/oracle/oradata/orcl/redo02.log' SIZE 4096K,
11>     '/mnt/disk1/oracle/oradata/orcl/redo03.log' SIZE 4096K;
12> }
executing command: SET NEWNAME
using target database control file instead of recovery catalog

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting Duplicate Db at 14-APR-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK

contents of Memory Script:
{
   set until scn  1385985;
   set newname for datafile  1 to
 "/mnt/disk1/oracle/oradata/orcl/system01.dbf";
   set newname for datafile  2 to
 "/mnt/disk1/oracle/oradata/orcl/undotbs01.dbf";
   set newname for datafile  3 to
 "/mnt/disk1/oracle/oradata/orcl/sysaux01.dbf";
   set newname for datafile  4 to
 "/mnt/disk1/oracle/oradata/orcl/users01.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

Starting restore at 14-APR-08
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 /mnt/disk1/oracle/oradata/orcl/system01.dbf
restoring datafile 00002 to /mnt/disk1/oracle/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /mnt/disk1/oracle/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /mnt/disk1/oracle/oradata/orcl/users01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oracle/backup/db_ORCL_42_1_652012333
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/backup/db_ORCL_42_1_652012333 tag=WHOLE_INC0
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 14-APR-08
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 '/mnt/disk1/oracle/oradata/orcl/redo01.log' SIZE 4096 K ,
  GROUP  2 '/mnt/disk1/oracle/oradata/orcl/redo02.log' SIZE 4096 K ,
  GROUP  3 '/mnt/disk1/oracle/oradata/orcl/redo03.log' SIZE 4096 K
 DATAFILE
  '/mnt/disk1/oracle/oradata/orcl/system01.dbf'
 CHARACTER SET ZHS16GBK


contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

released channel: ORA_AUX_DISK_1
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=651997879 filename=/mnt/disk1/oracle/oradata/orcl/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=651997879 filename=/mnt/disk1/oracle/oradata/orcl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=651997879 filename=/mnt/disk1/oracle/oradata/orcl/users01.dbf

contents of Memory Script:
{
   set until scn  1385985;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 14-APR-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK

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=52
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=53
channel ORA_AUX_DISK_1: reading from backup piece /oracle/backup/arch_ORCL_44_1_652012662
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/backup/arch_ORCL_44_1_652012662 tag=TAG20080414T103740
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:13
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2008_04_14/o1_mf_1_52_406dms64_.arc thread=1 sequence=52
channel clone_default: deleting archive log(s)
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2008_04_14/o1_mf_1_52_406dms64_.arc recid=1 stamp=651997891
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2008_04_14/o1_mf_1_53_406dn3m7_.arc thread=1 sequence=53
channel clone_default: deleting archive log(s)
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2008_04_14/o1_mf_1_53_406dn3m7_.arc recid=2 stamp=651997891
media recovery complete, elapsed time: 00:00:07
Finished recover at 14-APR-08

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     167772160 bytes

Fixed Size                     1218316 bytes
Variable Size                 67111156 bytes
Database Buffers              96468992 bytes
Redo Buffers                   2973696 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 '/mnt/disk1/oracle/oradata/orcl/redo01.log' SIZE 4096 K ,
  GROUP  2 '/mnt/disk1/oracle/oradata/orcl/redo02.log' SIZE 4096 K ,
  GROUP  3 '/mnt/disk1/oracle/oradata/orcl/redo03.log' SIZE 4096 K
 DATAFILE
  '/mnt/disk1/oracle/oradata/orcl/system01.dbf'
 CHARACTER SET ZHS16GBK


contents of Memory Script:
{
   set newname for tempfile  1 to
 "/mnt/disk1/oracle/oradata/orcl/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/mnt/disk1/oracle/oradata/orcl/undotbs01.dbf";
   catalog clone datafilecopy  "/mnt/disk1/oracle/oradata/orcl/sysaux01.dbf";
   catalog clone datafilecopy  "/mnt/disk1/oracle/oradata/orcl/users01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to /mnt/disk1/oracle/oradata/orcl/temp01.dbf in control file

cataloged datafile copy
datafile copy filename=/mnt/disk1/oracle/oradata/orcl/undotbs01.dbf recid=1 stamp=651998550

cataloged datafile copy
datafile copy filename=/mnt/disk1/oracle/oradata/orcl/sysaux01.dbf recid=2 stamp=651998550

cataloged datafile copy
datafile copy filename=/mnt/disk1/oracle/oradata/orcl/users01.dbf recid=3 stamp=651998550

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=651998550 filename=/mnt/disk1/oracle/oradata/orcl/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=651998550 filename=/mnt/disk1/oracle/oradata/orcl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=651998550 filename=/mnt/disk1/oracle/oradata/orcl/users01.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 14-APR-08

RMAN> **end-of-file**

 

note: 过大的日志文件会增加进程处理时间

  评论这张
 
阅读(343)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018