测试环境分别在虚拟机安装A,B主机
系统:linux 6.4,
数据库:oracle 11g r2
A主机:安装oracle 11g r2数据库
B主机:只安装oracle 11g r2软件

第一步,运行下面rman命令备份数据库
run{
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/dbback/config_%F';
allocate channel c1 type disk format '/u01/app/dbback/full_%U';
backup database tag 'full_gpodb_data' FILESPERSET 10 PLUS ARCHIVELOG FILESPERSET 20 DELETE ALL INPUT;
release channel c1;
 }

[root@bogon ~]# su - oracle
[oracle@bogon ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Oct 26 05:16:55 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DB (DBID=1587060738) ------------记住这个DBID恢复数据库会用到
RMAN> run{
2> CONFIGURE CONTROLFILE AUTOBACKUP ON;
3> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/dbback/config_%F';
4> allocate channel c1 type disk format '/u01/app/dbback/full_%U';
5> backup database tag 'full_gpodb_data' FILESPERSET 10 PLUS ARCHIVELOG FILESPERSET 20 DELETE ALL INPUT;
6> release channel c1;
7>  }

old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/dbback/gpofullbak/%F';
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/dbback/config_%F';
new RMAN configuration parameters are successfully stored

allocated channel: c1
channel c1: SID=47 device type=DISK

Starting backup at 26-OCT-13
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=21 RECID=12 STAMP=829805117
channel c1: starting piece 1 at 26-OCT-13
channel c1: finished piece 1 at 26-OCT-13
piece handle=/u01/app/dbback/full_08onbkhu_1_1 tag=TAG20131026T052518 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/u01/app/archiv/1_21_823244933.dbf RECID=12 STAMP=829805117
Finished backup at 26-OCT-13

Starting backup at 26-OCT-13
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/db/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/db/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/db/anfei01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/db/undotbs01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/db/DB/datafile/o1_mf_dbs_91x4vt9f_.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/db/dbt.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/db/users01.dbf
channel c1: starting piece 1 at 26-OCT-13
channel c1: finished piece 1 at 26-OCT-13
piece handle=/u01/app/dbback/full_09onbkhv_1_1 tag=FULL_GPODB_DATA comment=NONE
channel c1: backup set complete, elapsed time: 00:01:36
Finished backup at 26-OCT-13

Starting backup at 26-OCT-13
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=22 RECID=13 STAMP=829805216
channel c1: starting piece 1 at 26-OCT-13
channel c1: finished piece 1 at 26-OCT-13
piece handle=/u01/app/dbback/full_0aonbkl1_1_1 tag=TAG20131026T052657 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/u01/app/archiv/1_22_823244933.dbf RECID=13 STAMP=829805216
Finished backup at 26-OCT-13

Starting Control File and SPFILE Autobackup at 26-OCT-13
piece handle=/u01/app/dbback/config_c-1587060738-20131026-01 comment=NONE
Finished Control File and SPFILE Autobackup at 26-OCT-13

released channel: c1

RMAN>

第二步,创建pfile参数文件

[oracle@bogon dbs]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Sat Oct 26 05:52:14 2013

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create pfile from spfile;

File created.

第三步,利用scp命令将备份文件,pfile参数文件传输到B主机
备份文件的目标在/u01/app/dbback,首先在B主机创建dbback目录
[oracle@bogon app]$ mkdir dbback

传输pfile文件(这这里将/u01/app/oracle/product/11.2.1/db_1/dbs目录下的文件全部传输到了B主机)
[oracle@bogon dbs]$ scp * 192.168.1.103:/u01/app/oracle/product/11.2.1/db_1/dbs
The authenticity of host '192.168.1.103 (192.168.1.103)' can't be established.
RSA key fingerprint is aa:25:3b:48:55:b9:e9:f5:dd:60:2d:55:b5:93:af:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.103' (RSA) to the list of known hosts.
reverse mapping checking getaddrinfo for bogon [192.168.1.103] failed - POSSIBLE BREAK-IN ATTEMPT!
oracle@192.168.1.103's password:
hc_db.dat                                                                    100% 1544     1.5KB/s   00:00    
hc_DBUA0.dat                                                                 100% 1544     1.5KB/s   00:00    
initdb.ora                                                                   100%  975     1.0KB/s   00:00    
init.ora                                                                     100% 2851     2.8KB/s   00:00    
lkDB                                                                         100%   24     0.0KB/s   00:00    
orapwdb                                                                      100% 1536     1.5KB/s   00:00    
peshm_db_0: not a regular file
peshm_DBUA0_0: not a regular file
snapcf_db.f                                                                  100% 9520KB   9.3MB/s   00:01    
spfiledb.ora                                                                 100% 2560     2.5KB/s   00:00

传输/u01/app/dbback目录下的备份文件
[oracle@bogon dbback]$ scp * 192.168.1.102:/u01/app/dbback
The authenticity of host '192.168.1.102 (192.168.1.102)' can't be established.
RSA key fingerprint is 2e:02:60:91:68:fb:bd:0c:9c:22:82:08:74:fd:f0:42.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.102' (RSA) to the list of known hosts.
oracle@192.168.1.102's password:
config_c-1587060738-20131026-01                                              100% 9600KB   9.4MB/s   00:01    
full_08onbkhu_1_1                                                            100% 3584     3.5KB/s   00:00    
full_09onbkhv_1_1                                                            100%  950MB   5.7MB/s   02:46    
full_0aonbkl1_1_1                                                            100%   14KB  13.5KB/s   00:00    
[oracle@bogon dbback]$ cd ~

第四步,登陆B主机,创建和A主机相对应的文件夹

我主机的oracle 文件安装在/u01/app/oracle

[oracle@bogon app]$ cd oracle
[oracle@bogon oracle]$ ls        ---------------和A主机对应缺少了diag  flash_recovery_area  oradata admin  cfgtoollogs 文件夹
checkpoints  product
[oracle@bogon oracle]$
[oracle@bogon oracle]$ mkdir diag  flash_recovery_area  oradata admin  cfgtoollogs        --------创建文件夹
[oracle@bogon oracle]$ cd oradata
[oracle@bogon oradata]$ ls
[oracle@bogon oradata]$ mkdir db
[oracle@bogon oradata]$ ls
db

[oracle@bogon oracle]$ cd cfgtoollogs
[oracle@bogon cfgtoollogs]$ ls
[oracle@bogon cfgtoollogs]$ mkdir dbca  emca  netca
[oracle@bogon cfgtoollogs]$

[oracle@bogon admin]$ mkdir db
[oracle@bogon admin]$ cd db
[oracle@bogon db]$ ls
[oracle@bogon db]$ mkdir adump dpdump  pfile
[oracle@bogon db]$
[oracle@bogon oracle]$ cd flash_recovery_area
[oracle@bogon flash_recovery_area]$ ls
[oracle@bogon flash_recovery_area]$ mkdir db

[oracle@bogon app]$ pwd
/u01/app
[oracle@bogon archiv]$ mkdir archiv

第五步,启动B主机数据库到nomount状态
oracle@bogon ~]$ export ORACLE_SID=db
[oracle@bogon ~]$
[oracle@bogon ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 25 23:14:56 2013

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

Connected to an idle instance.

SQL> startup nomount;  
ORACLE instance started.

Total System Global Area  418484224 bytes
Fixed Size                  1336932 bytes
Variable Size             364906908 bytes
Database Buffers           46137344 bytes
Redo Buffers                6103040 bytes

第六步,用rman恢复数据库

[oracle@bogon admin]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Oct 25 23:23:59 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DB (not mounted)

RMAN> set dbid=1587060738;       (备份数据了时的DBID)

executing command: SET DBID

RMAN>

RMAN> restore controlfile from '/u01/app/dbback/config_c-1587060738-20131026-01';

Starting restore at 25-OCT-13
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
output file name=/u01/app/oracle/oradata/db/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/db/control02.ctl
Finished restore at 25-OCT-13

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database from tag='full_gpodb_data';

Starting restore at 25-OCT-13
Starting implicit crosscheck backup at 25-OCT-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
Crosschecked 8 objects
Finished implicit crosscheck backup at 25-OCT-13

Starting implicit crosscheck copy at 25-OCT-13
using channel ORA_DISK_1
Finished implicit crosscheck copy at 25-OCT-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 backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/db/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/db/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/db/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/db/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/db/anfei01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/db/DB/datafile/o1_mf_dbs_91x4vt9f_.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/db/dbt.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/dbback/full_09onbkhv_1_1
channel ORA_DISK_1: piece handle=/u01/app/dbback/full_09onbkhv_1_1 tag=FULL_GPODB_DATA
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:28
Finished restore at 25-OCT-13

RMAN> recover database;

Starting recover at 25-OCT-13
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=22
channel ORA_DISK_1: reading from backup piece /u01/app/dbback/full_0aonbkl1_1_1
channel ORA_DISK_1: piece handle=/u01/app/dbback/full_0aonbkl1_1_1 tag=TAG20131026T052657
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/archiv/1_22_823244933.dbf thread=1 sequence=22
unable to find archived log
archived log thread=1 sequence=23
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 10/25/2013 23:32:41
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 23 and starting SCN of 1146472

RMAN> alter database open resetlogs;

database opened

RMAN> exit

数据库迁移完成
Recovery Manager complete.

oracle@bogon ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 25 23:14:56 2013

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

Connected to an idle instance.

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/db/system01.dbf
/u01/app/oracle/oradata/db/sysaux01.dbf
/u01/app/oracle/oradata/db/undotbs01.dbf
/u01/app/oracle/oradata/db/users01.dbf
/u01/app/oracle/oradata/db/anfei01.dbf
/u01/app/oracle/oradata/db/DB/datafile/o1_mf_dbs_96o3mf4d_.dbf
/u01/app/oracle/oradata/db/dbt.dbf

linux 6.4平台利用rman迁移oracle 11g r2数据库的更多相关文章

  1. CentOS 7静默安装Oracle 11g R2数据库软件

    之前安装Oracle 11g R2数据库软件都是建立在图形界面上的,不过现在大部分服务器上都没有安装图形界面.图形界面安装较为方便,安装选项清晰,步骤明确,但Oracle还支持另一种安装方式,就是通过 ...

  2. ORACLE 11g R2数据库安装硬件环境要求

    物理内存要求:最小1G,在windows7,windows8,windows8.1上最小2G. 虚拟内存(或分页空间)容量要求: Available RAM Swap Space Required B ...

  3. CentOS上oracle 11g R2数据库安装折腾记

    1.虚拟机上centos镜像的获取.这里推荐网易镜像站中的CentOS7版本(其他开源镜像站亦可).这里给出链接: http://mirrors.163.com/centos/7.3.1611/iso ...

  4. Linux 6.x 下Oracle 11g R2 安装配置

    Oracle 11g R2 数据库安装硬件配置要求: 最小内存 1 GB of RAM 虚拟内存容量,这个oracle也有要求,不用担心此时的swap分区不够oracle的要求 .虚拟内存swap如何 ...

  5. Redhat Linux 下安装Oracle 11g R2

    能够下载:http://download.csdn.net/detail/ykh554541184/8086647文档方便查阅 官方文档:http://docs.oracle.com/cd/E1188 ...

  6. Oracle 11g R2创建数据库之DBCA静默方式

    通常创建Oracle数据库都是通过DBCA(Database Configuration Assistant)工具完成的,DBCA工具可以通过两种方式完成建库任务,即图形界面方式和静默命令行方式.既然 ...

  7. Oracle 11g R2 Sample Schemas 安装

    最近准备对之前学习SQL*Loader的笔记进行整理,希望通过官方文档中的示例学习(Case Studies)来进行,但是官方文档中示例学习相关的脚本文件在数据库软件安装完成之后默认并没有提供,而是整 ...

  8. oracle 11G R2卸载说明

    oracle 11G R2数据库卸载

  9. Oracle Linux 6.3下安装Oracle 11g R2(11.2.0.3)

    本文主要描写叙述了在Oracle Linux 6.3下安装Oracle 11gR2(11.2.0.3).从Oracle 11g開始,Oracle官方站点不再提供其Patch的下载链接,须要使用Meat ...

随机推荐

  1. Quartz 2D官方文档翻译(持续更新中)

    转换  核心绘图模型定义了两个完全独立的坐标空间:用户空间,一个是代表文档页,和设备空间,另外一个代表本机设备的分辨率.用户空间坐标是与设备空间中像素分辨率无关的浮点数字.当你想要打印或者显示你的文档 ...

  2. oFixed() 方法

    oFixed() 方法可把 Number 四舍五入为指定小数位数的数字. 在本例中,我们将把数字舍入为仅有一位小数的数字: Show the number 13.37 with one decimal ...

  3. onload ready

    确保在 <body> 元素的onload事件中没有注册函数,否则不会触发$(document).ready()事件. 可以在同一个页面中无限次地使用$(document).ready()事 ...

  4. Ajax应用常见的HTTP ContentType设置

    文章出处:Ajax应用常见的HTTP ContentType设置 ajax开发中, 常遇到下面的几种情况: 1 服务端需要返回一段普通文本给客户端 2 服务端需要返回一段HTML代码给客户端 3 服务 ...

  5. 学习笔记(一) HTML+CSS基础课程

    这个周把慕课网的<HTML+CSS基础课程>课程学完,内容都是非常非常基础的,不过还是学到了几个小知识点,记下来先. <a>超链接发送邮件 直接上把他的图片给挪过来了,我就不打 ...

  6. ETL中的数据增量抽取机制

    ETL中的数据增量抽取机制 (     增量抽取是数据仓库ETL(extraction,transformation,loading,数据的抽取.转换和装载)实施过程中需要重点考虑的问 题.在ETL过 ...

  7. Mirror–使用证书配置镜像模板

    –==================================================================–该文档主要用于内部配置模板–场景:–主服务器:192.168.3 ...

  8. poj2141---字符串转换

    #include <stdio.h> #include <stdlib.h> int main() { ]; char tmp; scanf("%s",ke ...

  9. Pascal 线段树 lazy-tag 模板

    先说下我的代码风格(很丑,勿喷) maxn表示最大空间的四倍 tree数组表示求和的线段树 delta表示增减的增量标记 sign表示覆盖的标记 delta,sign实际上都是lazy标志 pushd ...

  10. 【G-BLASTN 1.0正式发布】

    [G-BLASTN 1.0正式发布]G-BLASTN使用GPU来加速NCBI-BLAST里的BLASTN模块,单块GTX780比四核CPU平均快6倍. http://www.comp.hkbu.edu ...