oracle(pcszh)异机恢复方案

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

o r a c l e数据库恢复测试方案
( pcszh)
2010年11月10日
熙菱信息技术有限公司
一、数据库恢复前题
1.原数据库服务器为pcszh(10.84.1.81),新数据库服务器为rac1(10.84.1.85),即需
要将pcszh的oracle数据库(pcszh)备份恢复到xz2上。

2.首先在rac1上安装oracle,并建立和pcszh上相同的数据库环境(如实例名,环境
变量等)。

rac1上的oracle版本和pcszh上保持一致。

Cp 密码文件和init文件到相应位置,编辑监听和tnsnames文件。

3.保证rac1上有足够的空间。

并已经创建好和pcszh等数量的裸设备文件,包括数据
文件、控制文件以及REDO文件。

4.rac1数据库能够连接到rman数据库。

5.需要恢复的数据库有完整的全备份和全备份后的所有归档日志备份。

二、恢复方案和步骤
1、停止所有应用,让应用不再访问数据库。

2、对数据库pcszh做全库备份,全备份后做数据库归档日志备份,并确认备份成功完
成。

3、在rac1上搭建和pcszh一致的数据库环境。

确定rac1能连接rman服务器。

4、连接源数据库,查找该数据库DBID。

SQL>conn sys/xxxx@pcszh;
SQL>select dbid from v$database;
5、shutdown rac1数据库到,恢复rac1数据库控制文件。

脚本内容如下:confilepcszh
set dbid=2924246270
connect target /
connect rcvcat rman/rman@rmanbss
startup nomount;
run
{
allocate channel t1 type 'sbt_tape'
send 'NSR_ENV=(NSR_SERVER=ibss1_5,NSR_CLIENT=pcszh)';
allocate channel t2 type 'sbt_tape'
send 'NSR_ENV=(NSR_SERVER=ibss1_5,NSR_CLIENT=pcszh)';
restore controlfile to '/dev/vgxzb09/rlv_ctl_512m_01';
restore controlfile to '/dev/vgxzb09/rlv_ctl_512m_02';
restore controlfile to '/dev/vgxzb09/rlv_ctl_512m_03';
release channel t1;
release channel t2;
}
6、执行该控制文件恢复脚本,并确认恢复成功。

7、在rac1主机,mount上数据库pcszh,用sqlplus登陆数据库,重命名在新库中的
日志文件名称。

对pcszh数据库更改在线日志文件名称
alter database rename file '/dev/vgbpadm01/rlv_pcszh_redo01' to '/dev/vgxzb11/rlv_pcszh_redo01';
alter database rename file '/dev/vgbpadm01/rlv_pcszh_redo02' to '/dev/vgxzb11/rlv_pcszh_redo02';
alter database rename file '/dev/vgbpadm02/rlv_pcszh_redo03' to '/dev/vgxzb11/rlv_pcszh_redo03';
alter database rename file '/dev/vgbpadm02/rlv_pcszh_redo04' to '/dev/vgxzb11/rlv_pcszh_redo04';
alter database rename file '/dev/vgbpadm03/rlv_pcszh_redo05' to '/dev/vgxzb11/rlv_pcszh_redo05';
检查数据库的在线日志文件名称
SQL> select * from v$logfile;
确认在线日志文件已经修改为新的路径。

8、恢复并重命名数据文件,并recover database,回滚全备份后归档的所有归档日志。

恢复数据库。

脚本如下:
针对pcszh数据库,datafilepcszh
connect target /;
connect rcvcat rman/rman@rmanbss;
run
{
allocate channel t1 type 'sbt_tape'
send 'NSR_ENV=(NSR_SERVER=ibss1_5,NSR_CLIENT=pcszh)';
allocate channel t2 type 'sbt_tape'
send 'NSR_ENV=(NSR_SERVER=ibss1_5,NSR_CLIENT=pcszh)';
allocate channel t3 type 'sbt_tape'
send 'NSR_ENV=(NSR_SERVER=ibss1_5,NSR_CLIENT=pcszh)';
allocate channel t4 type 'sbt_tape'
send 'NSR_ENV=(NSR_SERVER=ibss1_5,NSR_CLIENT=pcszh)';
set newname for datafile '/dev/vgsp01/rlv_Pcszh_index_3g_001' to '/dev/vgxzb09/rlv_Pcszh_index_3g_001';
set newname for datafile '/dev/vgsp01/rlv_Pcszh_index_3g_002' to '/dev/vgxzb09/rlv_Pcszh_index_3g_002';
set newname for datafile '/dev/vgsp01/rlv_Pcszh_index_3g_003' to '/dev/vgxzb09/rlv_Pcszh_index_3g_003';
set newname for datafile '/dev/vgsp01/rlv_Pcszh_index_3g_004' to '/dev/vgxzb09/rlv_Pcszh_index_3g_004';
set newname for datafile '/dev/vgsp01/rlv_Pcszh_index_3g_005' to '/dev/vgxzb09/rlv_Pcszh_index_3g_005';
set newname for datafile '/dev/vgsp01/rlv_Pcszh_index_3g_006' to '/dev/vgxzb09/rlv_Pcszh_index_3g_006';
set newname for datafile '/dev/vgsp01/rlv_pcszh_data_5g_001' to '/dev/vgxzb09/rlv_pcszh_data_5g_001';
set newname for datafile '/dev/vgsp01/rlv_pcszh_data_5g_002' to '/dev/vgxzb09/rlv_pcszh_data_5g_002';
set newname for datafile '/dev/vgsp01/rlv_pcszh_data_5g_003' to '/dev/vgxzb09/rlv_pcszh_data_5g_003';
set newname for datafile '/dev/vgsp01/rlv_pcszh_data_5g_004' to '/dev/vgxzb09/rlv_pcszh_data_5g_004';
set newname for datafile '/dev/vgsp01/rlv_pcszh_data_5g_005' to '/dev/vgxzb09/rlv_pcszh_data_5g_005';
set newname for datafile '/dev/vgsp01/rlv_pcszh_data_5g_006' to '/dev/vgxzb09/rlv_pcszh_data_5g_006';
set newname for datafile '/dev/vgsp01/rlv_pcszh_system_2g' to '/dev/vgxzb09/rlv_pcszh_system_2g';
set newname for datafile '/dev/vgsp01/rlv_pcszh_undo_20g' to '/dev/vgxzb09/rlv_pcszh_undo_20g';
set newname for datafile '/dev/vgsp01/rlv_pcszh_userdefaulttable' to '/dev/vgxzb09/rlv_pcszh_userdefaulttable';
set newname for datafile '/dev/vgsp01/rlv_olcom_3g_001' to '/dev/vgxzb09/rlv_olcom_3g_001';
set newname for datafile '/dev/vgsp01/rlv_olcom_3g_002' to '/dev/vgxzb09/rlv_olcom_3g_002';
set newname for datafile '/dev/vgsp01/rlv_olcom_3g_003' to '/dev/vgxzb09/rlv_olcom_3g_003';
set newname for datafile '/dev/vgsp01/rlv_olcom_3g_004' to '/dev/vgxzb09/rlv_olcom_3g_004';
set newname for datafile '/dev/vgsp01/rlv_olcom_3g_005' to '/dev/vgxzb09/rlv_olcom_3g_005';
set newname for datafile '/dev/vgsp01/rlv_olcom_3g_006' to '/dev/vgxzb09/rlv_olcom_3g_006';
set until time 'Jan 18 2007 08:00:00';
restore database;
switch datafile all;
recover database;
release channel t1;
release channel t2;
release channel t3;
release channel t4;
}
9、指定合适的数据库恢复时间点。

[oracle@rac1#/legato/shell]export NLS_DA TE_FORMA T=’ mon dd yyyy hh24:mi:ss’[oracle@rac1#/legato/shell]echo $NLS_DA TE_FORMA T
mon dd yyyy hh24:mi:ss
10、执行数据文件恢复脚本
[oracle@rac1#/legato/shell]nohup rman cmdfile datafilepcszh
确定数据文件恢复过程没有任何报错,成功恢复数据文件。

确认数据数据库状态。

SQL>show parmeter
Select file_name from dba_data_file;
Select * from v$logfile;
11、连接数据库,用resetlogs打开数据库。

#export ORACLE_SID=testadm
%sqlplus “ / as sysdba”;
SQL>alter database open resetlogs;
Database altered.
12、启数据库,启应用,并验证应用是否正常。

13、重新全备份生产数据库。

14、恢复时间约1.5小时。

相关文档
最新文档