一个rman从A到B库的迁移

Rman实现数据库迁移

(从库A迁移到库B)

环境:
服务器A:Oracle10.1.0.3+AS3
服务器B:Oracle10.2.0.1+AS4
准备工作:
1 在数据库B上建立与库A相同的目录结构(若由于磁盘空间等原因可以用软链接做到),其中包括:
  $ORACLE_BASE;$ORACLE_HOME;以及archivelog目录和BASE下的admin目录及其子目录
2 在数据库B上安装数据库软件(不建库)
实施工作:
1 备份:在数据库A上
  断开连接到A上的应用,并做全备份
  [oracle@rman oradata]$ $ORACLE_HOME/bin/rman
  Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 19 13:48:55 2007
  Copyright (c) 1982, 2005, Oracle.  All rights reserved.
  RMAN>connect catalog rman/rman
  RMAN>connect target /
  connected to target database: RMAN (DBID=1509600741)
  RMAN>run {
  2>configure controlfile autobackup on;
  3>configure controlfile autobackup format for device type disk to '/home/share/rman/%F';
  4>allocate channel d1 type disk;
  5>allocate channel d2 type disk;
  6>backup incremental level=0 database format '/home/share/rman/d_%T_%s.bak';
  7>release channel d1;
  8>release channel d2;
  9>}
  传输备份集:
  [oracle@rman rman]$ scp * oracle@192.168.1.162:/home/share/store
  oracle@192.168.1.162's password:
  c-1509600741-20070619-01      100% 6976KB  1.4MB/s  00:05   
  full_08ikm3h2_1_1              100%  23MB  1.3MB/s  00:18   
  full_09ikm3h8_1_1              100% 6816KB  1.3MB/s  00:05   
  full_0aikm3h8_1_1              35%  198MB  1.1MB/s  05:17 ETA
  [oracle@rman pfile]$ scp * oracle@192.168.1.162:/u01/app/oracle/admin/rman/pfile
  oracle@192.168.1.162's password:
  init.ora                      100% 2471    2.4KB/s  00:00
2 恢复:在数据库B上
  首先:启动实例
  [oracle@etc pfile]$ echo $ORACLE_SID
  rman
  [oracle@etc pfile]$ sqlplus "/ as sysdba"
  SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 19 16:39:32 2007
  Copyright (c) 1982, 2005, Oracle.  All rights reserved.
  Connected to an idle instance.
  SQL> startup pfile='/u01/app/oracle/admin/rman/pfile/init.ora.4212007155133' nomount
  ORACLE instance started.
  Total System Global Area  285212672 bytes
  Fixed Size                  1218992 bytes
  Variable Size              92276304 bytes
  Database Buffers          188743680 bytes
  Redo Buffers                2973696 bytes
  SQL> exit
  其次进入Rman恢复controlfile,spfile和database;
  [oracle@etc ~]$ $ORACLE_HOME/bin/rman 
  Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jun 20 14:04:25 2007 
  Copyright (c) 1982, 2005, Oracle.  All rights reserved. 
  RMAN> connect target /
  connected to target database: rman (not mounted)
  RMAN> set dbid=1509600741 
  executing command: SET DBID
  RMAN> restore controlfile from '/home/share/rman/c-1509600741-20070619-02'
  Starting restore at 20-JUN-07
  using target database control file instead of recovery catalog
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: sid=155 devtype=DISK 
  channel ORA_DISK_1: restoring control file
  channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
  output filename=/u01/app/oracle/oradata/rman/control01.ctl
  output filename=/u01/app/oracle/oradata/rman/control02.ctl
  output filename=/u01/app/oracle/oradata/rman/control03.ctl
  Finished restore at 20-JUN-07 
  RMAN> restore spfile from '/home/share/rman/c-1509600741-20070619-02'; 
  Starting restore at 20-JUN-07
  using channel ORA_DISK_1 
  channel ORA_DISK_1: autobackup found: /home/share/rman/c-1509600741-20070619-02
  channel ORA_DISK_1: SPFILE restore from autobackup complete
  Finished restore at 20-JUN-07 
  RMAN> restore database; 
  Starting restore at 20-JUN-07
  using channel ORA_DISK_1
  RMAN-00571: ===========================================================
  RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  RMAN-00571: ===========================================================
  RMAN-03002: failure of restore command at 06/20/2007 14:08:15
  ORA-01507: database not mounted
  RMAN> alter database mount; 
  database mounted
  released channel: ORA_DISK_1
  RMAN> restore database; 
  Starting restore at 20-JUN-07
  Starting implicit crosscheck backup at 20-JUN-07
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: sid=154 devtype=DISK
  Crosschecked 10 objects
  Finished implicit crosscheck backup at 20-JUN-07 
  Starting implicit crosscheck copy at 20-JUN-07
  using channel ORA_DISK_1
  Finished implicit crosscheck copy at 20-JUN-07 
  searching for all files in the recovery area
  cataloging files...
  no files cataloged 
  using channel ORA_DISK_1
  channel ORA_DISK_1: starting datafile backupset restore
  channel ORA_DISK_1: specifying datafile(s) to restore from backup set
  restoring datafile 00001 to /u01/app/oracle/oradata/rman/system01.dbf
  restoring datafile 00002 to /u01/app/oracle/oradata/rman/undotbs01.dbf
  restoring datafile 00003 to /u01/app/oracle/oradata/rman/sysaux01.dbf
  channel ORA_DISK_1: reading from backup piece /home/share/rman/d_20070619_14.bak
  channel ORA_DISK_1: restored backup piece 1
  piece handle=/home/share/rman/d_20070619_14.bak tag=TAG20070619T212606
  channel ORA_DISK_1: restore complete, elapsed time: 00:01:36
  channel ORA_DISK_1: starting datafile backupset restore
  channel ORA_DISK_1: specifying datafile(s) to restore from backup set
  restoring datafile 00004 to /u01/app/oracle/oradata/rman/users01.dbf
  restoring datafile 00005 to /u01/app/oracle/oradata/rman/rman01.dbf
  channel ORA_DISK_1: reading from backup piece /home/share/rman/d_20070619_13.bak
  channel ORA_DISK_1: restored backup piece 1
  piece handle=/home/share/rman/d_20070619_13.bak tag=TAG20070619T212606
  channel ORA_DISK_1: restore complete, elapsed time: 00:01:16
  Finished restore at 20-JUN-07 
  RMAN> recover database; 
  Starting recover at 20-JUN-07
  using channel ORA_DISK_1 
  starting media recovery 
  unable to find archive log
  archive log thread=1 sequence=27
  RMAN-00571: ===========================================================
  RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  RMAN-00571: ===========================================================
  RMAN-03002: failure of recover command at 06/20/2007 14:18:07
  RMAN-06054: media recovery requesting unknown log: thread 1 seq 27 lowscn 1101806 
  RMAN> alter database open resetlogs;
  database opened
  RMAN> exit
  Recovery Manager complete.
  [oracle@etc ~]$
  由于联机日志没有传送过来,一般需要用resetlogs打开数据库

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/76721/viewspace-364672/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/76721/viewspace-364672/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值