NBU 7.X 异机恢复linux oracle RAC 到单机

需要用到命令#查看源端备份集命令/usr/openv/netbackup/bin/bplist -C node1 -t 4 -l -R /#查看源端datefie,logfile     XX第一人民医院RAC异机恢复测试一、环境调研1、目的:将11g RAC库通过NBU备份的数据库备份集用rman 的方式备份并恢复到异机(单机...显示全部
需要用到命令
#查看源端备份集命令
/usr/openv/netbackup/bin/bplist -C node1 -t 4 -l -R /

#查看源端datefie,logfile



     XX第一人民医院RAC异机恢复测试
一、环境调研
1、目的:将11g RAC库通过NBU备份的数据库备份集用rman 的方式备份并恢复到异机(单机;
2、RAC库:redahat6.2 两个节点  racl1(136.1.62.191),racl2(136.1.62.192) 采用ASM+RAW  ;
3、测试机环境:oracle 11.2.0.3enterprise-64bit、redhat6.2 enterprise-64bit、hostname(test 、IP(136.1.62.40 、文件系统。
二、环境搭建
1、刀片服务器40上安装和RAC相同的操作系统版本(redhat6.2;
2、搭建环境,在test安装oracle 版本必须和源oracle一致;
3、在oracle上新建oracle实例,SID:orcl,databasenamen:orcl,;
4、官方建议用参数文件启动数据库,我不会修改spfile,所没用参数文件来启数据库。
三、恢复测试过程
下面是恢复具体过程:
删除测试机数据库文件
shutdown immediate数据库,删除/oradata/ORCL/目录下的所文件。
恢复控制文件
在sqlplus将数据库启动到nomount状态下,恢复控制文件:
SET DBID=1328622703
RMAN> run
2> {
3> allocate channel d1 type 'SBT_TAPE';
4> send 'NB_ORA_SERV=yzhpnbu,NB_ORA_CLIENT=node2';
5> restore controlfile from 'cntrl_636_1_746060628';     
6> release channel d1;
7> }
############node1,test########
[root@test ~]# su - oracle
[oracle@test ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jan 5 19:46:31 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options

SQL> startup nomount
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options
[oracle@test ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jan 5 19:49:52 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size                  2228784 bytes
Variable Size             939527632 bytes
Database Buffers          654311424 bytes
Redo Buffers                7344128 bytes
SQL> exit
[oracle@test ~]$ rman target/

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jan 5 19:50:49 2013

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

connected to target database: ORCL (not mounted)

RMAN> set dbid=1328622703

executing command: SET DBID

RMAN> run
2> {
3> allocate channel d1 type 'SBT_TAPE';
4> SEND 'NB_ORA_SERV=yzhpnbu, NB_ORA_CLIENT=node1';
5> restore controlfile from '/cntrl_90_1_803913137';
6> release channel d1;
7> }

using target database control file instead of recovery catalog
allocated channel: d1
channel d1: SID=156 device type=SBT_TAPE
channel d1: Veritas NetBackup for Oracle - Release 7.1 (2011020316)

sent command to channel: d1

Starting restore at 05-JAN-13

channel d1: restoring control file
channel d1: restore complete, elapsed time: 00:01:04
output file name=/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_8ghwopoj_.ctl
Finished restore at 05-JAN-13

released channel: d1

RMAN> alter database mount;

database mounted

RMAN>
###############################
控制文件恢复后,数据库就可以 mount了
在rman下alter database mount
在源端查看oracle裸设备名称:
分为类,临时文件,数据文件,日志文件
SQL> select name from v$tempfile;                 
###########################临时文件############################################
SQL>  select name from v$tempfile;  
NAME
--------------------------------------------------------------------------------
+DATA/orcl/tempfile/temp.267.800842041
###############################################################################


SQL> select name from v$datafile;               
############################数据文件#######################################
SQL>  select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/orcl/datafile/system.264.800841983
+DATA/orcl/datafile/sysaux.265.800841995
+DATA/orcl/datafile/undotbs1.266.800842005
+DATA/orcl/datafile/undotbs2.268.800842051
+DATA/orcl/datafile/users.269.800842089
+DATA/orcl/datafile/xhlisdb_data1.ora
+DATA/orcl/datafile/xhlisdb_history1.dbf
+DATA/orcl/datafile/xhlisdb_offline1.dbf
+DATA/orcl/datafile/xhlisdb_system1.dbf
+DATA/orcl/datafile/misdb1.dbf
+DATA/orcl/datafile/xhlisdb_report1.dbf
11 rows selected.
###############################################################################


SQL> select member from V$logfile;
###############################日志文件#########################################
   SQL> select member from V$logfile;

MEMBER
--------------------------------------------------------------------------------
+DATA/orcl/onlinelog/group_1.258.800841971
+DATA/orcl/onlinelog/group_1.259.800841971
+DATA/orcl/onlinelog/group_2.260.800841973
+DATA/orcl/onlinelog/group_2.261.800841975
+DATA/orcl/onlinelog/group_5.262.800841977
+DATA/orcl/onlinelog/group_5.263.800841981
+DATA/orcl/onlinelog/group_3.270.800843943
+DATA/orcl/onlinelog/group_3.271.800843945
+DATA/orcl/onlinelog/group_4.272.800843945
+DATA/orcl/onlinelog/group_4.273.800843949
+DATA/orcl/onlinelog/group_6.274.800843951
MEMBER
--------------------------------------------------------------------------------
+DATA/orcl/onlinelog/group_6.275.800843953
12 rows selected.
SQL>     
###############################################################################


在目标端(test存放数据文件的目录下新建相应的文件
路径:/home /oracle/data
创建日志文件
touch log1.log
touch log2.log
touch log3.log
touch log4.log
touch log5.log
touch log6.log
touch log7.log
touch log8.log
touch log9.log
touch log10.log
touch log11.log
touch log12.log

创建数据文件和临时文件
touch system.264.800841983
touch sysaux.265.800841995
touch undotbs1.266.800842005
touch undotbs2.268.800842051
touch users.269.800842089
touch xhlisdb_data1.ora
touch xhlisdb_history1.dbf
touch xhlisdb_offline1.dbf
touch xhlisdb_system1.dbf
touch misdb1.dbf
touch xhlisdb_report1.dbf
对应上面查出的datafile创建
给予该data目录下文件权限:chown oracle:dba *
[root@test ORCL]# chown oracle:dba *
[root@test ORCL]# ls -alt
total 12
drwxr-x--- 3 oracle dba 4096 Jan  5 21:16 .
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 xhlisdb_report1.dbf
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 misdb1.dbf
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 xhlisdb_system1.dbf
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 xhlisdb_offline1.dbf
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 xhlisdb_history1.dbf
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 xhlisdb_data1.ora
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 users.269.800842089
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 undotbs2.268.800842051
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 undotbs1.266.800842005
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 sysaux.265.800841995
-rw-r--r-- 1 oracle dba    0 Jan  5 21:16 system.264.800841983
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log12.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log11.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log10.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log9.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log8.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log7.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log6.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log5.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log4.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:11 log3.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:09 log2.log
-rw-r--r-- 1 oracle dba    0 Jan  5 21:09 log1.log
drwxr-x--- 2 oracle dba 4096 Jan  5 19:56 controlfile
drwxr-x--- 3 oracle dba 4096 Jan  5 17:29 ..
[root@test ORCL]# pwd
/u01/app/oracle/oradata/ORCL
[root@test ORCL]#

在rman下做数据库恢复:
RMAN:
run  {
set newname for datafile 1 to '/home/oracle/data/system.264.800841983';
set newname for datafile 2 to '/home/oracle/data/sysaux.265.800841995';
set newname for datafile 3 to '/home/oracle/data/undotbs1.266.800842005';
set newname for datafile 4 to '/home/oracle/data/undotbs2.268.800842051';
set newname for datafile 5 to '/home/oracle/data/users.269.800842089';
set newname for datafile 6 to '/home/oracle/data/xhlisdb_data1.ora';
set newname for datafile 7 to '/home/oracle/data/xhlisdb_history1.dbf';
set newname for datafile 8 to '/home/oracle/data/xhlisdb_offline1.dbf';
set newname for datafile 9 to '/home/oracle/data/xhlisdb_system1.dbf';
set newname for datafile 10 to '/home/oracle/data/misdb1.dbf';
set newname for datafile 11 to '/home/oracle/data/xhlisdb_report1.dbf';
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_SERV=yzhpnbu,NB_ORA_CLIENT=node2';
restore database;
switch datafile all;
release channel ch00;
release channel ch01;
}

恢复完成
恢复数据库一致性
重置联机日志路径 sqlplus:
SQL>
alter database rename file'+DATA/orcl/onlinelog/group_1.258.800841971' to '/home/oracle/data/log1.log';
alter database rename file'+DATA/orcl/onlinelog/group_1.259.800841971'to'/home/oracle/data/log2.log';
alter database rename file'+DATA/orcl/onlinelog/group_2.260.800841973'to'/home/oracle/data/log3.log';
alter database rename file'+DATA/orcl/onlinelog/group_2.261.800841975'to'/home/oracle/data/log4.log';
alter database rename file'+DATA/orcl/onlinelog/group_5.262.800841977'to'/home/oracle/data/log5.log';
alter database rename file'+DATA/orcl/onlinelog/group_5.263.800841981'to'/home/oracle/data/log6.log';
alter database rename file'+DATA/orcl/onlinelog/group_3.270.800843943'to'/home/oracle/data/log7.log';
alter database rename file'+DATA/orcl/onlinelog/group_3.271.800843945'to'/home/oracle/data/log8.log';
alter database rename file'+DATA/orcl/onlinelog/group_4.272.800843945'to'/home/oracle/data/log9.log';
alter database rename file'+DATA/orcl/onlinelog/group_4.273.800843949'to'/home/oracle/data/log10.log';
alter database rename file'+DATA/orcl/onlinelog/group_6.274.800843951'to'/home/oracle/data/log11.log';
alter database rename file'+DATA/orcl/onlinelog/group_6.275.800843953'to'/home/oracle/data/log12.log';

完成联机日志重置后,进入RMAN recover database:
RMAN:
run  {
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_SERV=yzhpnbu,NB_ORA_CLIENT=node2';
recover database;
release channel ch00;
release channel ch01;
}
using target database control file instead of recovery catalog
allocated channel: ch00
channel ch00: SID=33 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.1 (2011020316)

allocated channel: ch01
channel ch01: SID=65 device type=SBT_TAPE
channel ch01: Veritas NetBackup for Oracle - Release 7.1 (2011020316)

sent command to channel: ch00
sent command to channel: ch01

Starting recover at 06-JAN-13

starting media recovery

channel ch00: starting archived log restore to default destination
channel ch00: restoring archived log
archived log thread=2 sequence=81
channel ch00: restoring archived log
archived log thread=1 sequence=83
channel ch00: reading from backup piece al_108_1_803948860
channel ch01: starting archived log restore to default destination
channel ch01: restoring archived log
archived log thread=1 sequence=84
channel ch01: restoring archived log
archived log thread=2 sequence=82
channel ch01: reading from backup piece al_109_1_803948860
channel ch01: piece handle=al_109_1_803948860 tag=TAG20130105T230740
channel ch01: restored backup piece 1
channel ch01: restore complete, elapsed time: 00:01:05
channel ch00: piece handle=al_108_1_803948860 tag=TAG20130105T230740
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:01:15
archived log file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch2_81_800841967.dbf thread=2 sequence=81
archived log file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_83_800841967.dbf thread=1 sequence=83
archived log file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_84_800841967.dbf thread=1 sequence=84
archived log file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch2_82_800841967.dbf thread=2 sequence=82
unable to find archived log
archived log thread=2 sequence=83
released channel: ch00
released channel: ch01
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/06/2013 17:59:01
RMAN-06054: media recovery requesting unknown archived log for thread 2 with sequence 83 and starting SCN of 2042123289

RMAN> exit   
Recovery Manager complete.
完成recover

打开数据库
Sqlplus
SQL:alter database open resetlogs;
[oracle@test ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sun Jan 6 18:00:45 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options

SQL> alter database open resetlogs;

Database altered.

[oracle@test ~]$ rman target/

Recovery Manager: Release 11.2.0.3.0 - Production on Sun Jan 6 18:09:16 2013

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

connected to target database: ORCL (DBID=1328622703)收起
参与21

查看其它 19 个回答eric_lee的回答

eric_leeeric_lee系统工程师chengdu.cd-comdata
真心没得金
系统集成 · 2015-02-19
浏览3409

回答者

eric_lee
系统工程师chengdu.cd-comdata

eric_lee 最近回答过的问题

回答状态

  • 发布时间:2015-02-19
  • 关注会员:1 人
  • 回答浏览:3409
  • X社区推广