温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

RAC怎么进行从带库到单实例的恢复

发布时间:2021-11-30 16:19:21 来源:亿速云 阅读:218 作者:柒染 栏目:关系型数据库

本篇文章给大家分享的是有关RAC怎么进行从带库到单实例的恢复,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

备份软件:HP-DP
原库:生产RAC 2节点,IP:192.168.160.2和192.168.160.3
目标库:单实例库,IP:192.168.160.129
0. 准备环境
    配置好目标服务器的监听,让备份服务器可以链接到目标服务器。
1. 恢复控制文件
 对于备份软件恢复控制文件,是直接将其恢复到目标服务器的os上的,一般是在var目录下。
 登陆备份服务器,点开DP软件,选择RESTORE,找到原库的备份。然后在SOURCE选择"CONTROL FILE FROM DP MANAGED BACKUP",在OPTIONS中配置:Clinet=恢复的目标服务器,user name=oracle(目标服务器的oracle软件的os用户),User group=oinstall,Restore mode=Normal,Restore unitl=selected time,我这里选择的是20131227 22:00点。在Settings中配置目标服务器的sys密码和service_name。然后点击restore即可。随后去目标服务器(160.129)的/var/opt/omni/tmp/下找新产生的控制文件。
备注:Client这里要选择在备份服务器中配置的192.168.160.129所对应的别名,这里的别名一般都是主机名。
2. 恢复spfile
 现在已经有控制文件,其实参数文件,我们自己造一个就行,但如果想恢复的话,也是可以的。首先自己造一个参数文件,或者直接startup nomount force也行。随后恢复控制文件,并启动到mount,然后恢复spfile,具体如下:
SQL> startup nomount force
RMAN> restore controlfile from '/var/opt/omni/tmp/ctrl_ORCLDB.dbf';
RMAN> alter database mount;
RMAN> run {
 allocate channel 'dev_0' type 'sbt_tape'
 parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=mubiao_dbname,OB2BARLIST=mubiao_dbname)';
send device type 'sbt_tape' 'OB2BARHOSTNAME=yuanku_hostname';
 restore spfile to '/home/orazkf/spfileORCL1.ora' from autobackup;
release channel 'dev_0';
 }
released channel: ORA_DISK_1
allocated channel: dev_0
channel dev_0: SID=893 instance=ORCL1 device type=SBT_TAPE
channel dev_0: Data Protector A.06.20/PHSS_42081/DPSOL_00448/DPLNX_00154
sent command to channel: dev_0
Starting restore at 07-JAN-14
channel dev_0: looking for AUTOBACKUP on day: 20140107
channel dev_0: AUTOBACKUP found: c-3400117082-20140107-00
channel dev_0: restoring spfile from AUTOBACKUP c-3400117082-20140107-00
channel dev_0: SPFILE restore from AUTOBACKUP complete
Finished restore at 07-JAN-14
released channel: dev_0
  现在可以用恢复的spfile和控制文件,将数据库启动到mount状态。但需要注意的是,需要修改归档目录,dump目录等。
3. 恢复数据文件
 对于rac到单实例的恢复,肯定是要做set newname的,因为rac的数据文件都存在在磁盘组里,而本来都是在fs中。
RMAN>run {
allocate channel 'dev_0' type 'sbt_tape'
parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=mubiao_dbname,OB2BARLIST=mubiao_dbname)';
send device type 'sbt_tape' 'OB2BARHOSTNAME=yuanku_hostname';
set newname for datafile  1 to '/pmsdb/oradata/ORCL1/data1/system.345.760169914';
set newname for datafile 2 to '/pmsdb/oradata/ORCL1/data1/sysaux.564.760187953';
set newname for datafile 3 to '/pmsdb/oradata/ORCL1/data1/undotbs1.124.760889985';
set newname for datafile 4 to '/pmsdb/oradata/ORCL1/data1/undotbs2.456.760990001';
set newname for datafile 5 to '/pmsdb/oradata/ORCL1/data1/users.167.760190409';
set newname for datafile 6 to '/pmsdb/oradata/ORCL1/data1/undotbs1.281.760310569';
set newname for datafile 7 to '/pmsdb/oradata/ORCL1/data1/undotbs2.282.760110751';
set newname for datafile 24 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata101.dbf';
set newname for datafile 25 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata102.dbf';
set newname for datafile 26 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata103.dbf';
set newname for datafile 27 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata104.dbf';
set newname for datafile 28 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata105.dbf';
set newname for datafile 29 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata106.dbf';
set newname for datafile 30 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata107.dbf';
set newname for datafile 31 to '/pmsdb/oradata/ORCL1/data1/ORCLrddata108.dbf';
set newname for datafile 32 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex101.dbf';
set newname for datafile 33 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex102.dbf';
set newname for datafile 34 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex103.dbf';
set newname for datafile 35 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex104.dbf';
set newname for datafile 36 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex105.dbf';
set newname for datafile 37 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex106.dbf';
set newname for datafile 38 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex107.dbf';
set newname for datafile 39 to '/pmsdb/oradata/ORCL1/data1/ORCLrdindex108.dbf';
restore database;
switch datafile all;
release channel 'dev_0';
}
 静静的等待很久,最后恢复成功。
4. 恢复归档文件
RMAN>run {
 allocate channel 'dev_0' type 'sbt_tape'
 parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORCL1,OB2BARLIST=ORCL1)';
  send device type 'sbt_tape' 'OB2BARHOSTNAME=yuanku_hostname';
 restore archivelog time between "to_date('2013-12-27 22:00:00','YYYY-MM-DD HH24:MI:SS')" and "to_date('2013-12-27 22:30:00','YYYY-MM-DD HH24:MI:SS')";
  release channel 'dev_0';     
 }
由于我在此之前已经设置好新的归档目录,所以待恢复归档完毕后,去我的归档目录下查看,就会发现有几个归档文件。
5 执行recover
RMAN>recover database;
6 执行open resetlogs
 再此之前需要设置好闪回恢复区的大小,因为此时oracle可能会将新的onlinelog放在你的闪回恢复区中,所有要设置好大小正好,才可以启动成功。

以上就是RAC怎么进行从带库到单实例的恢复,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

rac
AI