【RMAN】RAC数据恢复至单机环境(一)

2014-11-24 17:17:54 · 作者: · 浏览: 2

RAC数据恢复至单机环境


一、概括


随着越来越多的RAC环境,将RAC数据迁移至单机环境下的需求也随之增加,怎样才能更有效的迁移呢,方法有许多逻辑迁移(exp/expdp)、RMAN、DG、goldengate等,我们可根据自身环境及需求选择相应的迁移方式,下面简单介绍一下使用RMAN将RAC数据迁移至单机环境中的步骤。


二、 模拟环境:整套RAC环境无故宕机,暂无法恢复,我们将之前备份的数据进行恢复
将最近一次全备份文件上传至目标环境,并查看文件信息


/oracle/backup


[oracle@oradb1 backup]$ ls -lrt


总计 264312


-rw-r----- 1 oracle oinstall 132608 02-17 13:24 arch_0lp0ro84


-rw-r----- 1 oracle oinstall 19456 02-17 13:24 arch_0ip0ro4u


-rw-r----- 1 oracle oinstall 1114112 02-17 13:24 full_0kp0ro7v_1_1


-rw-r----- 1 oracle oinstall 269107200 02-17 13:24 full_0jp0ro50_1_


通过上述我们可以看到,归档文件有两个,由于是测试环境,数据量及备份信息较简单,数据文件也是两个,由此得知文件full_0kp0ro7v_1_1存放参数文件和控制文件。
设置环境变量


[oracle@oradb1 ~]$ vi ~/.bash_profile


修改参数为:export ORACLE_SID=racdb1


恢复spfile文件


[oracle@oradb1 backup]$ rman target /


Recovery Manager: Release 11.2.0.4.0 - Production on Mon Feb 17 11:37:45 2014


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


connected to target database (not started)


RMAN> startup force nomount;


startup failed: ORA-01078: failure in processing system parameters


LRM-00109: could not open parameter file '/oracle/db_1/dbs/initracdb1.ora'


starting Oracle instance without parameter file for retrieva l of spfile


Oracle instance started


Total System Global Area 1068937216 bytes


Fixed Size 2260088 bytes


Variable Size 281019272 bytes


Database Buffers 780140544 bytes


Redo Buffers 5517312 bytes


RMAN> restore spfile from '/oracle/backup/full_0kp0ro7v_1_1';


Starting restore at 17-FEB-14


using target database control file instead of recovery catalog


allocated channel: ORA_DISK_1


channel ORA_DISK_1: SID=19 device type=DISK


channel ORA_DISK_1: restoring spfile from AUTOBACKUP /oracle/backup/full_0kp0ro7v_1_1


channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete


Finished restore at 17-FEB-14


RMAN> restore spfile from '/oracle/backup/full_0kp0ro7v_1_1';


Starting restore at 17-FEB-14


using target database control file instead of recovery catalog


allocated channel: ORA_DISK_1


channel ORA_DISK_1: SID=19 device type=DISK


channel ORA_DISK_1: restoring spfile from AUTOBACKUP /oracle/backup/full_0kp0ro7v_1_1


channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete


Finished restore at 17-FEB-14


登录到数据库,生成pfile文件,并编辑,删除与集群即节点2相关参数,修改控制文件及其他目录路径,并根据需求创建相应目录(如闪回区、oracle基础目录)


--------------------------------------------------------------------------------


--------------------------------------------------------------------------------


idle> create pfile from spfile;


File created.


创建spfile,并重启实例



idle> create spfile from pfile;


File created.


idle> show parameter pfile


NAME TYPE VALUE


------------------------------------ ----------- ------------------------------


spfile string


idle> show parameter spfile


NAME TYPE VALUE


------------------------------------ ----------- ------------------------------


spfile string


idle> shutdown abort


ORACLE instance shut down.


idle> startup nomount


ORACLE instance started.


Total System Global Area 534462464 bytes


Fixed Size 2254952 bytes


Variable Size 213911448 bytes


Database Buffers 314572800 bytes


Redo Buffers 3723264 bytes


idle> show parameter pfile


NAME TYPE VALUE


------------------------------------ ---------