利用rman进行异机还原(目录相同)

源始库:192.168.201.2
目标库:192.168.201.3

--192.168.201.2
--rman
[oracle@db01 ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Sep 18 08:52:25 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1354163930)--dbid

--备份数据文件
RMAN> backup database format '/u02/backup/dbf_%T_%U.bak';

Starting backup at 18-SEP-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=140 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u02/oradata/orcl/system01.dbf
input datafile fno=00002 name=/u02/oradata/orcl/undotbs01.dbf
input datafile fno=00003 name=/u02/oradata/orcl/sysaux01.dbf
input datafile fno=00005 name=/u02/oradata/orcl/app01.dbf
input datafile fno=00004 name=/u02/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 18-SEP-13
channel ORA_DISK_1: finished piece 1 at 18-SEP-13
piece handle=/u02/backup/dbf_20130918_05ok565a_1_1.bak tag=TAG20130918T085402

comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 18-SEP-13
channel ORA_DISK_1: finished piece 1 at 18-SEP-13
piece handle=/u02/backup/dbf_20130918_06ok567v_1_1.bak tag=TAG20130918T085402

comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 18-SEP-13

--备份归档日志
RMAN> backup archivelog all format '/u02/backup/arc_%T_%U.bak' delete input;

Starting backup at 18-SEP-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=33 recid=6 stamp=826448032
input archive log thread=1 sequence=34 recid=7 stamp=826448303
channel ORA_DISK_1: starting piece 1 at 18-SEP-13
channel ORA_DISK_1: finished piece 1 at 18-SEP-13
piece handle=/u02/backup/arc_20130918_07ok56dg_1_1.bak tag=TAG20130918T085823

comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/u02/archivelog/1_33_826383194.dbf recid=6 stamp=826448032
archive log filename=/u02/archivelog/1_34_826383194.dbf recid=7 stamp=826448303
Finished backup at 18-SEP-13

--备份控制文件
RMAN> backup current controlfile format '/u02/backup/ctl_%T_%U.bak';

Starting backup at 18-SEP-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 18-SEP-13
channel ORA_DISK_1: finished piece 1 at 18-SEP-13
piece handle=/u02/backup/ctl_20130918_08ok56fa_1_1.bak tag=TAG20130918T085922

comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 18-SEP-13

--192.168.201.3
--关闭数据库
[oracle@db02 orcl]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Sep 18 07:39:50 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

--打开数据库到nomount状态
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  734003200 bytes
Fixed Size      1221564 bytes
Variable Size    213912644 bytes
Database Buffers   515899392 bytes
Redo Buffers      2969600 bytes

--rman
[oracle@db02 bdump]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Sep 18 09:02:02 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: orcl (not mounted)

--设置dbid(与源库保持一致,如果与源库不同,则会无法恢复,后面再演示)
RMAN> set dbid=1354163930

executing command: SET DBID

--还原控制文件
RMAN> restore controlfile from '/u02/backup/ctl_20130918_0cok56kv_1_1.bak';

Starting restore at 18-SEP-13
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:02
output filename=/u02/oradata/orcl/control01.ctl
output filename=/u02/oradata/orcl/control02.ctl
output filename=/u02/oradata/orcl/control03.ctl
Finished restore at 18-SEP-13

--打开数据库到mount状态
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

--还原数据库
RMAN> restore database;

Starting restore at 18-SEP-13
Starting implicit crosscheck backup at 18-SEP-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
Crosschecked 11 objects
Finished implicit crosscheck backup at 18-SEP-13

Starting implicit crosscheck copy at 18-SEP-13
using channel ORA_DISK_1
Finished implicit crosscheck copy at 18-SEP-13

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 /u02/oradata/orcl/system01.dbf
restoring datafile 00002 to /u02/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /u02/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /u02/oradata/orcl/users01.dbf
restoring datafile 00005 to /u02/oradata/orcl/app01.dbf
channel ORA_DISK_1: reading from backup piece /u02/backup/dbf_20130918_09ok56i6_1_1.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/u02/backup/dbf_20130918_09ok56i6_1_1.bak tag=TAG20130918T090054
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 18-SEP-13

--恢复数据库
RMAN> recover database;

Starting recover at 18-SEP-13
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=35
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=36
channel ORA_DISK_1: reading from backup piece /u02/backup/arc_20130918_0bok56kj_1_1.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/u02/backup/arc_20130918_0bok56kj_1_1.bak tag=TAG20130918T090211
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archive log filename=/u02/archivelog/1_35_826383194.dbf thread=1 sequence=35
archive log filename=/u02/archivelog/1_36_826383194.dbf thread=1 sequence=36
unable to find archive log
archive log thread=1 sequence=37
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/18/2013 09:05:45
RMAN-06054: media recovery requesting unknown log: thread 1 seq 37 lowscn 372817
--注:此处报错属于正常现象,因为前面创建的备份非一致性备份

--打开数据库
RMAN> alter database open resetlogs;

database opened

--注:至此,恢复完成。

--下面演示目标库的dbid与原始库的dbid设置的不一致所出现的问题
--关闭数据库
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

--打开数据库到nomount状态
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  734003200 bytes
Fixed Size      1221564 bytes
Variable Size    213912644 bytes
Database Buffers   515899392 bytes
Redo Buffers      2969600 bytes

--rman
[oracle@db02 bdump]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Sep 18 09:10:37 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: orcl (not mounted)

--设置dbid
RMAN> set dbid=546330155

executing command: SET DBID

--还原控制文件
RMAN> restore controlfile from '/u02/backup/ctl_20130918_0cok56kv_1_1.bak';

Starting restore at 18-SEP-13
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:01
output filename=/u02/oradata/orcl/control01.ctl
output filename=/u02/oradata/orcl/control02.ctl
output filename=/u02/oradata/orcl/control03.ctl
Finished restore at 18-SEP-13

--打开数据库到mount状态
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 18-SEP-13
Starting implicit crosscheck backup at 18-SEP-13
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/18/2013 09:12:30
RMAN-12010: automatic channel allocation initialization failed
RMAN-06189: current DBID 546330155 does not match target mounted database (1354163930)
--注:这里还原数据库的时候报错。

利用rman进行异机还原(目录相同)的更多相关文章

  1. RMAN冷备份异机还原

    1:环境准备 在新的服务器上安装ORACLE实例,安装过程中需要注意源服务器与目标服务器的ORACLE_SID一致,另外确保安装路径与源路径一致(不仅是安装目录,甚至包括数据文件.控制文件目录.联机重 ...

  2. RMAN数据库异机迁移步骤

    --RMAN数据库异机迁移步骤----------------------------2013/09/28 测试环境:AIX+ora11g   一. source数据库准备.   1.获取数据文件编号 ...

  3. 基于RMAN的异机数据库克隆(rman duplicate)

    对于基于生产环境下的数据库的版本升级或者测试新的应用程序的性能及其影响,备份恢复等等,我们可以采取从生产环境以克隆的方式将其克隆到本地而不影响生产数据库的正常使用.实现这个功能我们可以借助rman d ...

  4. 使用rman备份异机恢复数据库

    一.RMAN备份源库注意点: 最好保留rman备份日志 $rman target / log=backup.log RMAN>run { allocate channel t1 type dis ...

  5. Hyper-V安装Oracle Linux6_4 Oracle db 12c并使用rman做异机恢复

    本文记录在Windows Server 2012 R2上安装Oracle Enterprise Linux 6.4以及使用RMAN进行进行异机恢复的过程. Windows服务器增加Hyper-V功能 ...

  6. RMAN - 备份异机恢复

    OS: Oracle Linux Server release 5.7 DB: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - ...

  7. RMAN 备份异机恢复 并创建新DBID

    测试平台信息: Oracle:11gR2 操作系统:Redhat 5.5 Target DB:dave   几点说明: (1)RMAN 异机恢复的时候,db_name必须相同. 如果说要想改成其他的实 ...

  8. Oracle备份恢复之冷备份恢复与异机还原

    (同平台:rhel6.4~rhel6.4:同版本:oracle 11g 11.2.0.1~ oracle 11g 11.2.0.1) 冷备份发生在数据库关闭状态下,直接拷贝物理文件的备份方式,备份数据 ...

  9. Oracle之使用rman进行异机恢复测试记录

    本次测试目的是从生产数据库导出rman备份然后在测试数据库恢复 1,拷贝备份至相应目录 2,进入rman rman target \ 3,关闭数据库 shutdown 4,以nomount模式启动数据 ...

随机推荐

  1. placeholder在不同浏览器下的表现及兼容方法 placeholder兼容

    1.什么是placeholder?    placeholder是html5新增的一个属性,当input或者textarea设置了该属性后,该值的内容将作为灰字提示显示在文本框中,当文本框获得焦点(或 ...

  2. 新建Android项目的时候,选择SDK的区别

    选择新建一个Android项目时候,出现MiniMum Required SDK.Target SDK.Compile With.Theme,如下所示,分别是什么意思呢? MinMum Require ...

  3. 一个失误导致微信下载图片接口Token失效

    公司的应用调了一个微信上传下载图片的接口,本来在线上跑的好好的,什么问题没有,但是这两天总是不定时的出现下载下来的图片损坏,拿着Token和serverid去接口测试网页验证,返回的是Token失效了 ...

  4. 一道C语言面试题:判断字串是否可以通过重新排列字母使之对称

    题目:输入一个字符串,如“adcaeceeed”,判断是否可以通过重新排列使之可以输出对称字符串,如本例可以输出“adceeeecda”,返回True. 来源:某500强企业面试题目 思路:扫描字串, ...

  5. KeybMap 键盘映射工具更新至 V1.5(修订)

    KeybMap 更新至 V1.5,主要是增加了对一些多媒体键定义修改功能,也可以将任意一键定义为打开指定的程序. 3月9日略做修订. http://www.mympc.org/down/1/2005- ...

  6. Noip2013之路

    当我回望过去的一年,我想,我对自己没有任何的愧疚,因为我每一个脚印,都踩的很坚实. 第一次参加模拟赛,第一次接触NOIP的规则,虽然考得不是特别好,但是还是很有收获的,首先,数组一定要开得足够大,不然 ...

  7. Android学习总结——Activity之间传递参数

    核心内容:一.在 Activity 之间传递简单数据二.在 Activity 之间传递复杂数据 三.在 Activity 之间传递自定义值对象   软件环境:Android Studio   一.在 ...

  8. C#中静态与非静态方法比较【转】

    C#静态方法与非静态方法的区别不仅仅是概念上的,那么他们有什么具体的区别呢?让我们通过本文向你做一下解析. C#的类中可以包含两种方法:C#静态方法与非静态方法.那么他们的定义有什么不同呢?他们在使用 ...

  9. NSDictionary所有API的学习。

    <欢迎大家增加iOS开发学习交流群:QQ529560119> @property (readonly)NSUInteger count; //1.利用指定的key寻找相应的value - ...

  10. Android官方技术文档翻译——Ant 任务

    本文译自Android官方技术文档<Ant Tasks>,原文地址:http://tools.android.com/tech-docs/ant-tasks. 由于是抽着时间译的.所以这篇 ...