Rman实现数据库迁移
(从库A迁移到库B)
环境:
服务器A:Oracle10g+AS3
服务器B:Oracle10g+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打开数据库
 

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

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

        实验目的:将oracle数据库从一台机器迁移到另外的一台机器(同为linux平台),设置为不同的路径,不同的实例名 源端: ORACLE_BASE=/u01/app/oracle ORACLE ...

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

    [TTS]AIX平台数据库迁移到Linux--基于RMAN(真实环境) http://www.cnblogs.com/lhrbest/articles/5186933.html 各位技术爱好者,看完本 ...

  3. ORACLE10gRAC数据库迁移至10gRAC

    1.数据库备份RUN {ALLOCATE CHANNEL ch00 DEVICE TYPE disk;ALLOCATE CHANNEL ch01 DEVICE TYPE disk;ALLOCATE C ...

  4. Oracle数据库迁移到AWS云的方案

    当前云已经成为常态,越来越多的企业希望使用云来增加基础设施的弹性.减轻基础设施的维护压力,运维的成本等.很多企业使用云碰到的难题之一是如何将现有的应用迁移到云上,将现有应用的中间件系统.Web系统及其 ...

  5. oracle数据库迁移---windows环境下

    以前在学校只是听过oracle,但是从来没有接触过.最近公司突然给了我一个任务,让我将某个大型商场的网站迁移到与服务器上面. 当时也觉得,迁移个网站也就是个很简单的事情,将文件复制,拷贝下就可以了撒. ...

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

    使用裸设备配置ASM实例 http://www.cnblogs.com/myrunning/p/4270849.html 1.查看我们创建的磁盘组 [oracle@std ~]$ export ORA ...

  7. Oracle数据库迁移的几种方式

    面试: 一.exp/imp逻辑备份与恢复: 二.Storage存储迁移: 将数据文件.控制文件.日志文件.spfile挂到新机器上,然后在新机器上启动数据库. 三.利用data guard迁移: 四. ...

  8. EF Code First Migrations数据库迁移

    1.EF Code First创建数据库 新建控制台应用程序Portal,通过程序包管理器控制台添加EntityFramework. 在程序包管理器控制台中执行以下语句,安装EntityFramewo ...

  9. 2.EF中 Code-First 方式的数据库迁移

    原文链接:http://www.c-sharpcorner.com/UploadFile/3d39b4/code-first-migrations-with-entity-framework/ 系列目 ...

随机推荐

  1. SelectedValue,SelectedValuePath,SelectedValueBinding,DisplayMemberPath讲解

    无论在Winform.WPF.ASP.NET中,数据绑定是我们经常使用的一个重要技术,我们经常会把相关类动态显示绑定到UI界面中,其中有几个比较重要的属性需要大家灵活运用. 那Combox来说明有两个 ...

  2. GridView ItemCommand

    GridView ItemCommand中取某行某列的值方法,这里提供两个常用的: 一.用CommandArgument属性取值页面如下: <asp:TemplateColumn HeaderT ...

  3. 【BZOJ 1003】 [ZJOI2006]物流运输trans

    Description 物流公司要把一批货物从码头A运到码头B.由于货物量比较大,需要n天才能运完.货物运输过程中一般要转停好几个码头.物流公司通常会设计一条固定的运输路线,以便对整个运输过程实施严格 ...

  4. centos7初步配置

    centos7初步配置 首先安装lrzsz zip/unzip yum -y install lrzsz yum -y install zip unzip 安装vim yum install vim* ...

  5. Java程序员的发展前景

    不知道什么时候开始,IT业初级程序员的工作性质与进城打工的"农民工"变得如此惊人的相似.很多IT公司的高管认为"人便宜,就是要用到坏掉,然后再找更便宜.更年轻的" ...

  6. Extjs4.2布局——Ext.container.ViewportView

    先贴出官方文档的关于此布局的描述:“ 一个专门的容器用于可视应用领域(浏览器窗口). Viewport渲染自身到网页的documet body区域, 并自动将自己调整到适合浏览器窗口的大小,在窗口大小 ...

  7. textarea中限制输入字符长度

    要在textarea中限制输入字符的长度,比如在twitter中要限制字符为140个,可实现的方法有: 1. <textarea name="A" cols="45 ...

  8. Discuz云平台站点信息同步失败,An unknown error occurred. May be DNS Error.

    站点信息同步失败 An unknown error occurred. May be DNS Error. (ERRCODE:1) 经过Discuz教程网(http://www.1314study.c ...

  9. 在MAC下调试运行暗黑全世界客户端及部分代码注解(基于Firefly)

    原地址:http://www.myexception.cn/program/1399860.html 在MAC下调试运行暗黑全世界客户端及部分代码注解(基于Firefly) 在MAC下调试运行暗黑世界 ...

  10. Shell命令合集

    Ccat zdd 浏览文件zdd的内容cat zdd1 zdd2 浏览多个文件的内容cat -n zdd浏览文件zdd的内容并显示行号 cd 回到起始目录,也即刚登陆到系统的目录,cd后面无参数cd ...