Rman实现数据库迁移

Rman实现数据库迁移
(从库A迁移到库B)
环境:
服务器A:Oracle10g+AS3
服务器B:Oracle10g+AS4
准备工作: 
1 在数据库B上建立与库A相同的目录结构(若由于磁盘空间等原因可以用软链接做到),其中包括:
  $ORACLE_BASE;$ORACLE_HOME;以及archivelog目录和BASE下的admin目录及其子目录
2 在数据库B上安装数据库软件(不建库)
实施工作:
1 备份:在数据库A上
  断开连接到A上的应用,并做全备份
  [[email protected] 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>}
  传输备份集:
  [[email protected] rman]$ scp * [email protected]:/home/share/store
  [email protected]‘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
  [[email protected] pfile]$ scp * [email protected]:/u01/app/oracle/admin/rman/pfile
  [email protected]‘s password: 
  init.ora                       100% 2471     2.4KB/s   00:00 
2 恢复:在数据库B上
  首先:启动实例
  [[email protected] pfile]$ echo $ORACLE_SID
  rman
  [[email protected] 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;
  [[email protected] ~]$ $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.
  [[email protected] ~]$
  由于联机日志没有传送过来,一般需要用resetlogs打开数据库

时间: 2024-10-09 20:50:55

Rman实现数据库迁移的相关文章

转 【TTS】AIX平台数据库迁移到Linux--基于RMAN(真实环境)

[TTS]AIX平台数据库迁移到Linux--基于RMAN(真实环境) http://www.cnblogs.com/lhrbest/articles/5186933.html 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~: ① 异构平台下传输表空间的实施 ② 传输表空间基于表空间的read only和rman2种方式 ③ 平台字节序.自包含概念 ④ expdp/impdp的应用 ⑤ 数据库迁移一般情况下应该收集哪些信息及相应的脚本

Linux平台下使用rman进行oracle数据库迁移

    实验目的:将oracle数据库从一台机器迁移到另外的一台机器(同为linux平台),设置为不同的路径,不同的实例名 源端: ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 ORACLE_SID=test 数据文件位置:/oradata/test 目标端: ORACLE_BASE=/u02/app/oracle ORACLE_HOME=/u02/app/oracle/product/10

RMAN数据库迁移

2015年12月3日23:30 RMAN源数据库(IP地址:192.168.0.254)备份: SQL>shutdown immediate SQL>startup nomount SQL>alter database mount; ------cmd Rman target / ------Rman命令: RMAN>run{Backup database format 'E:\databak\dbfull_%U.bak'; Backup current controlfile f

Oracle数据库迁移的几种方式

面试: 一.exp/imp逻辑备份与恢复: 二.Storage存储迁移: 将数据文件.控制文件.日志文件.spfile挂到新机器上,然后在新机器上启动数据库. 三.利用data guard迁移: 四.用rman做迁移: 我们常常需要对数据进行迁移,迁移到更性能配置更高级的主机OS上.迁移到远程的机房.迁移到不同的平台下,以下介绍ORACLE的几种数据库迁移方案: 一.exp/imp逻辑备份与恢复:  它是最常用最简单的方法,一般是基于应用的owner级做导出导入.  操作方法为: 在新库建立好o

Oracle 项目就是那回事 ----数据库迁移(1)

做数据库迁移是一件蛋疼的事,做数据库设计的人,往往不考虑数据构架的可扩展性,因为做数据库迁移的人不是做数据库设计的人. 之前做了这样的一个数据库迁移,要求大概如下 1.晚上大概有5个小时的宕机时间,可以做整库(A机)迁移操作. 2.数据的数据量在900G左右. 3.同样的操作系统和数据库版本 4.迁移的时候,需要更改数据库名和实例名. 5.客户现场没有数据备份磁带或磁盘设备. 6.可用的就是一台硬件升级过的小机(B机),用来运行迁移后的数据库,没有共享存储. 看到这个要求我心里大概有些谱了. 5

将文件系统数据库迁移到ASM中

使用裸设备配置ASM实例 http://www.cnblogs.com/myrunning/p/4270849.html 1.查看我们创建的磁盘组 [[email protected] ~]$ export ORACLE_SID=+ASM [[email protected] ~]$ sqlplus '/as sysdba' SQL*Plus: Release 10.2.0.4.0 - Production on Mon Feb 2 13:37:25 2015 Copyright (c) 198

数据库迁移:文件系统迁至ASM

数据库迁移:文件系统迁至ASM 系统环境: 操作系统:AIX5.3-08 Oracle:  Oracle 10gR2 1.实施操作,选择可行性迁移方案: 2.前期:准备工作,创建ASM磁盘组.启动ASM实例等: 3.中期:完成参数文件.控制文件.数据文件的迁移等: 4.后期:完成临时表空间.日志文件迁移等. ***************************************************************************************** *前期目标

ORACLE10gRAC数据库迁移至10gRAC

1.数据库备份RUN {ALLOCATE CHANNEL ch00 DEVICE TYPE disk;ALLOCATE CHANNEL ch01 DEVICE TYPE disk;ALLOCATE CHANNEL ch02 DEVICE TYPE disk;ALLOCATE CHANNEL ch03 DEVICE TYPE disk;ALLOCATE CHANNEL ch04 DEVICE TYPE disk;ALLOCATE CHANNEL ch05 DEVICE TYPE disk;back

wordpress博客站点配置及数据库迁移

1.wordpress博客站点部署配置 1.1 检查环境 1.1.1 nginx.conf配置文件 ###检查nginx配置文件 [[email protected] conf]# cat nginx.conf worker_processes 1; events { worker_connections  1024; } http { log_format  main  '$remote_addr - $remote_user [$time_local]"$request" ' '$