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实现数据库迁移的更多相关文章
- Linux平台下使用rman进行oracle数据库迁移
实验目的:将oracle数据库从一台机器迁移到另外的一台机器(同为linux平台),设置为不同的路径,不同的实例名 源端: ORACLE_BASE=/u01/app/oracle ORACLE ...
- 转 【TTS】AIX平台数据库迁移到Linux--基于RMAN(真实环境)
[TTS]AIX平台数据库迁移到Linux--基于RMAN(真实环境) http://www.cnblogs.com/lhrbest/articles/5186933.html 各位技术爱好者,看完本 ...
- ORACLE10gRAC数据库迁移至10gRAC
1.数据库备份RUN {ALLOCATE CHANNEL ch00 DEVICE TYPE disk;ALLOCATE CHANNEL ch01 DEVICE TYPE disk;ALLOCATE C ...
- Oracle数据库迁移到AWS云的方案
当前云已经成为常态,越来越多的企业希望使用云来增加基础设施的弹性.减轻基础设施的维护压力,运维的成本等.很多企业使用云碰到的难题之一是如何将现有的应用迁移到云上,将现有应用的中间件系统.Web系统及其 ...
- oracle数据库迁移---windows环境下
以前在学校只是听过oracle,但是从来没有接触过.最近公司突然给了我一个任务,让我将某个大型商场的网站迁移到与服务器上面. 当时也觉得,迁移个网站也就是个很简单的事情,将文件复制,拷贝下就可以了撒. ...
- 将文件系统数据库迁移到ASM中
使用裸设备配置ASM实例 http://www.cnblogs.com/myrunning/p/4270849.html 1.查看我们创建的磁盘组 [oracle@std ~]$ export ORA ...
- Oracle数据库迁移的几种方式
面试: 一.exp/imp逻辑备份与恢复: 二.Storage存储迁移: 将数据文件.控制文件.日志文件.spfile挂到新机器上,然后在新机器上启动数据库. 三.利用data guard迁移: 四. ...
- EF Code First Migrations数据库迁移
1.EF Code First创建数据库 新建控制台应用程序Portal,通过程序包管理器控制台添加EntityFramework. 在程序包管理器控制台中执行以下语句,安装EntityFramewo ...
- 2.EF中 Code-First 方式的数据库迁移
原文链接:http://www.c-sharpcorner.com/UploadFile/3d39b4/code-first-migrations-with-entity-framework/ 系列目 ...
随机推荐
- js 操作cookie
jquery.cookie中的操作: jquery.cookie.js是一个基于jquery的插件,点击下载! 创建一个会话cookie: $.cookie(‘cookieName’,'cookieV ...
- K2 Blackpearl 4.6.8 安装步骤详解
由于某些原因,我幼小的心灵受到了很大的创伤,倍感世态之炎凉,久久不能愈合,也因此很久没再接触K2 Blackpearl了.偶然来了兴趣,想整个K2的环境,闲暇之余了解其新功能,温故知新,也希望从中能讨 ...
- 关于Javascript"数组"那点事儿
记住Javascript里没有“数组”忘掉一切吧,骚年...一切都是对象:书中还细分了下简单类型和对象类型基本类型:typeof xxx => "number"数字,&quo ...
- 【BZOJ 2301】[HAOI2011]Problem b
Description 对于给出的n个询问,每次求有多少个数对(x,y),满足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函数为x和y的最大公约数. Input 第一行一个整数 ...
- Python之print语句
print语句可以向屏幕上输出指定的文字.比如输出'hello, world',用代码实现如下: >>> print 'hello, world' 注意: 1.当我们在Python交 ...
- python学习笔记27(python中sys模块的使用)
sys.argv 命令行参数List,第一个元素是程序本身路径 sys.modules.keys() 返回所有已经导入的模块列表 sys.exc_info() 获取当前正在 ...
- iOS 的 Gif 渲染引擎 FLAnimatedImage-b
公司的项目有个首页加载一张2M左右的git图,刚做的时候是使用的SDWebImage里面的方法: + (UIImage *)sd_animatedGIFNamed:(NSString *)name; ...
- 安装oracle 11g详细过程仅供参考
- HTTP协议的几个重要概念
转自:http://ice-cream.iteye.com/blog/77549 1.连接(Connection):一个传输层的实际环流,它是建立在两个相互通讯的应用程序之间. 2.消息(Messag ...
- WP-Syntax 插件使用方法
技术博客中使用WP-Syntax将代码高亮是最常见的.而一段时间不用总会忘记每种语言的的pre标签的值. 这里简单介绍下,WP-Syntax 是一个针对 Wordpress 的代码高亮插件,最大的优点 ...