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. (转)Qt Model/View 学习笔记 (一)——Qt Model/View模式简介

    Qt Model/View模式简介 Qt 4推出了一组新的item view类,它们使用model/view结构来管理数据与表示层的关系.这种结构带来的 功能上的分离给了开发人员更大的弹性来定制数据项 ...

  2. Invalid argument supplied for foreach()

    将需要被遍历的数组强制转换为数组类型即可 <?php $array = null; foreach((array)$array as $value){ #..code.... } ?>

  3. 【面试题】Https

    https原理, 我很难一下子记住,   https=http+ssl 先说http,  基于tcp/IP协议 传输,有三次握手 http://blog.csdn*net/xubo_zhang/art ...

  4. linux源码分析2

    linux源码分析 这里使用的linux版本是4.8,x86体系. 这篇是 http://home.ustc.edu.cn/~boj/courses/linux_kernel/1_boot.html  ...

  5. 如何让VS根据编译环境选择相应的配置文件

    其实微软还是蛮有创造力的,一个配置文件居然弄了这么多的形式,从原来的ini到现在的xml,总而言之让我们这些在微软殿堂里的程序员翘着屁股追赶. 微软最新的配置文件实际上就是个xml文件,以后缀名.co ...

  6. apache与nginx日志文件的区别(转载)

    apache与nginx日志文件的区别 转载:http://www.xfcodes.com/apache/log/3270.htm 导读:apache与nginx日志文件的区别,在apache与ngi ...

  7. Ext4.2 grid 条件查询使用

    项目中用到Ext4.2,初次接触,用的不是太熟,做个总结,恳请指正! 1.grid重新设置条件,查询结果不是从第1页开始 在处理grid条件查询时,点击搜索按钮调用store.load()方法时,会把 ...

  8. 团体程序设计天梯赛-练习集L1-009. *N个数求和

    L1-009. N个数求和 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 本题的要求很简单,就是求N个数字的和.麻烦的是,这些 ...

  9. 定长内存池之BOOST::pool

    内存池可有效降低动态申请内存的次数,减少与内核态的交互,提升系统性能,减少内存碎片,增加内存空间使用率,避免内存泄漏的可能性,这么多的优点,没有理由不在系统中使用该技术. 内存池分类: 1.      ...

  10. iOS开发--TableView详细解释

    -.建立 UITableView  DataTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 420)];  [Data ...