【kingsql分享】将RAC数据库异机恢复到单实例(Ⅰ)

本文将陆续讲述如何将一个RAC数据库,异机恢复到单实例

实验的大致思路是,备份一个RAC数据库,把RMAN备份集拷贝到一个单机,然后通过RMAN做异机恢复,恢复成单实例数据库

本实验的意义在于,当只剩下一个节点或者数据库全瘫痪的状态下,应急恢复业务

1.创建测试用户

创建一个用户hongzhuohui,赋予DBA权限,用于创建测试表

SYS@testora2%10gR2> create user hongzhuohui identified by oracle;
 
User created.
 
SYS@testora2%10gR2> grant dba to hongzhuohui;
 
Grant succeeded.

2.查看实例名

登录第二个节点的数据库,查看实例名为testora2,那么数据库名其实是testora

SYS@testora2%10gR2> select instance_name from v$instance;
 
INSTANCE_NAME
----------------
testora2

3.创建测试表

在hongzhuohui用户里创建测试表,那么做全备份之后,恢复之后,如果数据库里有这个表,则证明实验成功

SYS@testora2%10gR2> conn hongzhuohui/oracle
Connected.
SYS@testora2%10gR2> create table test001 (x int); 
 
Table created.
 
SYS@testora2%10gR2> insert into test001 values (99);
 
1 row created.
 
SYS@testora2%10gR2> commit;
 
Commit complete.
 
SYS@testora2%10gR2> select * from test001;
 
         X
----------
        99
 
SYS@testora2%10gR2> show user;
USER is "hongzhuohui"
 
4.备份数据库

对testora2做全备份,记录数据库DBID 676818789用户恢复

[oracle@rac2 ~]$ rman target /
 
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Nov 9 22:18:58 2014
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
connected to target database: TESTORA (DBID=676818789)
 
RMAN> run
{
allocate channel d1 type disk maxpiecesize 4000m ;
backup as compressed backupset incremental level = 0 database
format '/home/oracle/xpg/db_%d_%s_%p_%T'
plus archivelog skip inaccessible delete all input
format '/home/oracle/xpg/log_%d_%s_%p_%T';
SYS@testora2%10gR2 'alter system archive log current';
release channel d1;
}2> 3> 4> 5> 6> 7> 8> 9> 10> 
 
using target database control file instead of recovery catalog
allocated channel: d1
channel d1: sid=141 instance=testora2 devtype=DISK
 
 
Starting backup at 09-NOV-14
current log archived
channel d1: starting compressed archive log backupset
channel d1: specifying archive log(s) in backup set
input archive log thread=1 sequence=42 recid=27 stamp=863192962
input archive log thread=1 sequence=43 recid=30 stamp=863216434
input archive log thread=2 sequence=15 recid=28 stamp=863192967
input archive log thread=2 sequence=16 recid=29 stamp=863216065
input archive log thread=2 sequence=17 recid=31 stamp=863216438
channel d1: starting piece 1 at 09-NOV-14
channel d1: finished piece 1 at 09-NOV-14
piece handle=/home/oracle/xpg/log_TESTORA_5_1_20141109 tag=TAG20141109T222038 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:02
channel d1: deleting archive log(s)
archive log filename=+DATA/testora/1_42_854718629.dbf recid=27 stamp=863192962
archive log filename=+DATA/testora/1_43_854718629.dbf recid=30 stamp=863216434
archive log filename=+DATA/testora/2_15_854718629.dbf recid=28 stamp=863192967
archive log filename=+DATA/testora/2_16_854718629.dbf recid=29 stamp=863216065
archive log filename=+DATA/testora/2_17_854718629.dbf recid=31 stamp=863216438
Finished backup at 09-NOV-14
 
Starting backup at 09-NOV-14
channel d1: starting compressed incremental level 0 datafile backupset
channel d1: specifying datafile(s) in backupset
input datafile fno=00001 name=+DATA/testora/datafile/system.259.854718649
input datafile fno=00002 name=+DATA/testora/datafile/undotbs1.260.854718659
input datafile fno=00003 name=+DATA/testora/datafile/sysaux.261.854718665
input datafile fno=00004 name=+DATA/testora/datafile/undotbs2.263.854718673
input datafile fno=00005 name=+DATA/testora/datafile/users.264.854718679
channel d1: starting piece 1 at 09-NOV-14
channel d1: finished piece 1 at 09-NOV-14
piece handle=/home/oracle/xpg/db_TESTORA_6_1_20141109 tag=TAG20141109T222042 comment=NONE
channel d1: backup set complete, elapsed time: 00:01:05
channel d1: starting compressed incremental level 0 datafile backupset
channel d1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel d1: starting piece 1 at 09-NOV-14
channel d1: finished piece 1 at 09-NOV-14
piece handle=/home/oracle/xpg/db_TESTORA_7_1_20141109 tag=TAG20141109T222042 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:05
Finished backup at 09-NOV-14
 
Starting backup at 09-NOV-14
current log archived
channel d1: starting compressed archive log backupset
channel d1: specifying archive log(s) in backup set
input archive log thread=1 sequence=44 recid=32 stamp=863216513
input archive log thread=2 sequence=18 recid=33 stamp=863216513
channel d1: starting piece 1 at 09-NOV-14
channel d1: finished piece 1 at 09-NOV-14
piece handle=/home/oracle/xpg/log_TESTORA_8_1_20141109 tag=TAG20141109T222153 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:02
channel d1: deleting archive log(s)
archive log filename=+DATA/testora/1_44_854718629.dbf recid=32 stamp=863216513
archive log filename=+DATA/testora/2_18_854718629.dbf recid=33 stamp=863216513
Finished backup at 09-NOV-14
 
SQL statement: alter system archive log current
 
released channel: d1

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
我的QQ 1749160152
我的邮箱 hongzhuohui@kingsql.com
我的百科 http://baike.sogou.com/v82076725.htm?sp=SST洪卓辉
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28389881/viewspace-1329370/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28389881/viewspace-1329370/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值