nbu恢复 oracle10g rac asm 到单实例asm(恢复某个表空间)

一 检验条件


二 准备工作

1 创建相关目录

mkdir -p /oracle/admin/orcl/adump
mkdir -p /oracle/admin/orcl/bdump
mkdir -p /oracle/admin/orcl/cdump
mkdir -p /oracle/admin/orcl/udump
mkdir -p /oracle/arch
2参数文件
使用oracle用户

vi initorcl.ora

*.audit_file_dest='/oracle/admin/orcl/adump'
*.background_dump_dest='/oracle/admin/orcl/bdump'
*.cluster_database=false
*.compatible='10.2.0.5.0'
*.control_files='+DATA/orcl/controlfile/control01'
*.core_dump_dest='/oracle/admin/orcl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.job_queue_processes=10
*.log_archive_dest_1='location=/oracle/arch'
*.open_cursors=300
*.pga_aggregate_target=263997286
*.processes=1000
*.remote_login_passwordfile='exclusive'
*.sessions=1105
*.sga_max_size=1244245094
*.sga_target=1244245094
*.undo_management='AUTO'
*.undo_retention=0
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/admin/orcl/udump'

 

三 启动实例

$ export ORACLE_SID=orcl
sqlplus / as sysdba
startup nomount pfile='/oracle/initorcl.ora'

四 恢复控制文件

cd $NBU_HOME/bin

./bplist -C rac1 -S nbumaster -t 4 -R /

rman target /

set dbid=1340406187

run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=rac1)';
restore controlfile from '/cntrl_7418_1_888200750';
release channel ch00;
}

NBU报错:
ore
2015-8-20 13:43:57 - 1 images required
2015-8-20 13:43:57 - media 0333L3 required
2015-8-20 13:44:01 - restoring image rac1_1440008524
2015-8-20 13:44:18 - requesting resource 0333L3
2015-8-20 13:44:19 - granted resource 0333L3
2015-8-20 13:44:19 - granted resource IBM.ULT3580-TD3.001
2015-8-20 13:47:58 - Error bpbrm(pid=12513) bpcd on HA-zcqsmzq-tsvm01 exited with status 59: access to the client was not allowed
2015-8-20 13:48:05 - Error bpbrm(pid=12658) bpcd on HA-zcqsmzq-tsvm01 exited with status 59: access to the client was not allowed
2015-8-20 13:48:06 - Error bpbrm(pid=12658) listen for client protocol error - couldn't write necessary information on
/usr/openv/netbackup/logs/user_ops/dbext/logs/1872.0.1440048857
2015-8-20 13:48:06 - Warning bptm(pid=12522) failure logging message to client HA-zcqsmzq-tsvm01 in log
/usr/openv/netbackup/logs/user_ops/dbext/logs/1872.0.1440048857: server not allowed access (46)
解决办法:在NBU客户端目录下bp.conf文件总添加SERVER = rac1 SERVER = rac2

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on ch00 channel at 08/20/2015 13:23:37
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27211: Failed to load Media Management Library
Additional information: 2

解决办法:nbu在备份时需要调用oracle lib库文件,bin目录下提供了此脚本
[root@HA-zcqsmzq-tsvm01 bin]# su - oracle
[oracle@HA-zcqsmzq-tsvm01 ~]$ cd /usr/openv/netbackup/bin/
[oracle@HA-zcqsmzq-tsvm01 bin]$ ls oracle_link
oracle_link
[oracle@HA-zcqsmzq-tsvm01 bin]$ ./oracle_link
Thu Aug 20 13:28:07 CST 2015
All Oracle instances should be shutdown before running this script.

Please log into the Unix system as the Oracle owner for running this script

Do you want to continue? (y/n) [n] y


LIBOBK path: /usr/openv/netbackup/bin
ORACLE_HOME: /oracle/oracle
Oracle version: 10.2.0.5.0
Platform type: x86_64
Linking LIBOBK:
ln -s /usr/openv/netbackup/bin/libobk.so64 /oracle/oracle/lib/libobk.so
Done

Please check the trace file located in /tmp/make_trace.8785
to make sure the linking process was successful.
[oracle@HA-zcqsmzq-tsvm01 bin]$


六 恢复数据库

run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=rac1)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=rac1)';
set newname for datafile '+ORCLDATA/orcl/datafile/system.256.812625405' to '+DATA/orcl/datafile/system01.dbf' ;
set newname for datafile '+ORCLDATA/orcl/datafile/undotbs1.258.812625405' to '+DATA/orcl/datafile/undotbs01.dbf' ;
set newname for datafile '+ORCLDATA/orcl/datafile/sysaux.257.812625405' to '+DATA/orcl/datafile/sysaux01.dbf' ;
set newname for datafile '+ORCLDATA/orcl/datafile/users.259.812625405' to '+DATA/orcl/datafile/users01.dbf' ;
set newname for datafile '+ORCLDATA/orcl/datafile/undotbs2.264.812625489' to '+DATA/orcl/datafile/undotbs02.dbf' ;
set newname for datafile '+ORCLDATA/orcl/datafile/dms_index_01.dbf' to '+DATA/orcl/datafile/dms_index_01.dbf' ;
set newname for datafile '+ORCLDATA/orcl/datafile/system_01.dbf' to '+DATA/orcl/datafile/system_01.dbf' ;
set newname for datafile '+ORCLDATA/orcl/datafile/sysaux_02.dbf' to '+DATA/orcl/datafile/sysaux_02.dbf' ;
set newname for datafile '+ORCLDATA/orcl/datafile/dms_index_02.dbf' to '+DATA/orcl/datafile/dms_index_02.dbf' ;
restore tablespace 'SYSTEM','UNDOTBS1','UNDOTBS2','SYSAUX','USERS','DMS_INDEX' ;
switch datafile all;
release channel ch00;
release channel ch01;
}

run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=rac1)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=rac2)';
recover database skip forever tablespace 'TEMP','HAECM_DATA','HAECM_INDEX','DMS_DATA';
release channel ch00;
release channel ch01;
}

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/20/2015 15:31:52
RMAN-20506: no backup of archivelog found
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 2 seq 22319 lowscn 1626751923 found to restore
RMAN-06025: no backup of log thread 2 seq 22318 lowscn 1626441413 found to restore
提示缺少归档,恢复归档
run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' connect 'sys/password@orcl1';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE' connect 'sys/password@orcl2';
SET ARCHIVELOG DESTINATION TO '/rac_arch2';
RESTORE ARCHIVELOG SEQUENCE between 22318 and 22319 thread 2;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
}

恢复单个归档日志21519

run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' connect 'sys/password@orcl1';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE' connect 'sys/password@orcl2';
SET ARCHIVELOG DESTINATION TO '/rac_arch2';
RESTORE ARCHIVELOG SEQUENCE 21519 thread 2;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
}

补充:删除归档尽量不用操作系统命令rm(若用rm需要在rman中执行crosscheck archivelog all;)要用delete noprompt archivelog 归档的路径和名字
delete noprompt archivelog '/rac_arch2/2_21519_812625454.dbf';
delete noprompt archivelog '/rac_arch2/2_21525_812625454.dbf';

归档放在pfile文件指定的归档路径中,然后rman下注册归档 catalog start with '/oracle/arch';
再次执行recover
run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=rac1)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=rac2)';
recover database skip forever tablespace 'TEMP','HAECM_DATA','HAECM_INDEX','DMS_DATA';
release channel ch00;
release channel ch01;
}


alter database rename file '+ORCLDATA/orcl/onlinelog/group_11.log' to '+DATA/orcl/onlinelog/group_11.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_12.log' to '+DATA/orcl/onlinelog/group_12.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_21.log' to '+DATA/orcl/onlinelog/group_21.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_31.log' to '+DATA/orcl/onlinelog/group_31.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_41.log' to '+DATA/orcl/onlinelog/group_41.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_51.log' to '+DATA/orcl/onlinelog/group_51.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_52.log' to '+DATA/orcl/onlinelog/group_52.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_61.log' to '+DATA/orcl/onlinelog/group_61.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_22.log' to '+DATA/orcl/onlinelog/group_22.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_32.log' to '+DATA/orcl/onlinelog/group_32.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_42.log' to '+DATA/orcl/onlinelog/group_42.log';
alter database rename file '+ORCLDATA/orcl/onlinelog/group_62.log' to '+DATA/orcl/onlinelog/group_62.log';
注意临时表空间整理

六 打开数据库

若不执行alter database rename file '+ORCLDATA/orcl/onlinelog/group_42.log' to '+DATA/orcl/onlinelog/group_11.log'; 这些语句
报错如下:
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00349: failure obtaining block size for
'+ORCLDATA/orcl/onlinelog/group_42.log'
七 数据库整理

set linesize 200 pagesize 200
select GROUP#,THREAD#,STATUS ,ARCHIVED from v$log;
alter database disable thread 2 ;
alter system archive log current;
select GROUP#,THREAD#,STATUS ,ARCHIVED from v$log;
alter database drop logfile group 3;
alter database drop logfile group 4;
alter database drop logfile group 6;
select GROUP#,THREAD#,STATUS ,ARCHIVED from v$log;


监听 、tnsnames.ora

 

你可能感兴趣的:(nbu恢复 oracle10g rac asm 到单实例asm(恢复某个表空间))