欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

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

程序员文章站 2022-05-12 16:57:44
...

随着越来越多的RAC环境,将RAC数据迁移至单机环境下的需求也随之增加,怎样才能更有效的迁移呢,方法有许多逻辑迁移(exp/expdp)

RAC数据恢复至单机环境

一、概括

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

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

[Oracle@oradb1 backup]$ pwd

/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 retrieval 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基础目录)

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

RMAN 配置归档日志删除策略

Oracle基础教程之通过RMAN复制数据库

RMAN备份策略制定参考内容

RMAN备份学习笔记

Oracle数据库备份加密 RMAN加密

Linux-6-64下安装Oracle 12C笔记

在CentOS 6.4下安装Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虚拟机中安装步骤

Debian 下 安装 Oracle 11g XE R2

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

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

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

spfile string /oracle/db_1/dbs/spfileracdb1.

Ora

恢复控制文件,并启动数据库到mount模式


[oracle@oradb1 oracle]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Feb 17 12:45:58 2014

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

connected to target database: RACDB (not mounted)

RMAN> restore controlfile from '/oracle/backup/full_0bp0rlcu_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 control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:15

output file name=/oracle/oradata/racdb/current.273.839446247

output file name=/oracle/oradata/racdb/current.274.839446249

Finished restore at 17-FEB-14

RMAN> sql 'alter database mount';

sql statement: alter database mount

released channel: ORA_DISK_1

更多详情见请继续阅读下一页的精彩内容:

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