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. PHPstorm 的快捷键

    // ctrl+shift+n    查找文件//  ctrl+j            插入活动代码提示//  ctrl+alt+t        当前位置插入环绕代码//  alt+insert  ...

  2. PostgreSQL+PostGIS的使用 函数清单

    一. PostgreSQL与PostGIS的关系 PostgreSQL 是世界上技术最先进的开源数据库,其前身是1977年一个源于Berkeley名为Ingres的非关系型数据库,其项目领导人为Mic ...

  3. Lua中cJson的读写

    这里采用的是Lua CJson库,是一个高性能的JSON解析器和编码器,其性能比纯Lua库要高10~20倍.并且Lua Json完全支持UTF-8,无需以来其他非Lua/LuaJit相关包. 环境安装 ...

  4. 选择排序O(n^2)与快速排序O(nlogn)的优越性代码体现

    随机函数生成一个超大数组: [code]: #include <iostream> #include <stdio.h> #include<time.h> #inc ...

  5. Linux学习笔记(6)-工作管理

    什么是工作管理 工作来自job命令的翻译,job命令可以查看后台工作的进程.举例来说什么是工作管理,当你要打包一个比较大的目录时,很耗时间,但是你同时又需要使用别的命令.你会想我可以到开几个终端进行登 ...

  6. 自定义Angular指令与jQuery实现的Bootstrap风格数据双向绑定的单选&多选下拉框

    先说点闲话,熟悉Angular的猿们会喜欢这个插件的. 00.本末倒置 不得不承认我是一个喜欢本末倒置的人,学生时代就喜欢先把晚交的作业先做,留着马上就要交的作业不做,然后慢悠悠做完不重要的作业,卧槽 ...

  7. 1023: [SHOI2008]cactus仙人掌图 - BZOJ

    Description如果某个无向连通图的任意一条边至多只出现在一条简单回路(simple cycle)里,我们就称这张图为仙人图(cactus).所谓简单回路就是指在图上不重复经过任何一个顶点的回路 ...

  8. myeclipse报错:Could not create the view: An unexpected exception was thrown.

    打开server窗口,发现显示:Could not create the view: An unexpected exception was thrown. 此处解决方法: 关闭myeclipse 删 ...

  9. cannot find w3wp.exe in VS

    Same thing was happening to me, when i remembered that IIS has an idle timeout! As above the proc w3 ...

  10. linux fork函数与vfork函数

    一.fork1. 调用方法#include <sys/types.h>#include <unistd.h> pid_t fork(void);正确返回:在父进程中返回子进程的 ...