当前位置:文档之家› ORACLE 11G HA NBU异机恢复过程

ORACLE 11G HA NBU异机恢复过程

ORACLE 11G AIX HA ----NBU异机恢复过程恢复前提1.两台机器上NUB软件都已经安装好2.指定Master SERVER 上的/usr/openv/netbackup/bp.conf恢复源FORCE_RESTORE_MEDIA_SERVER = 生产库hostname 测试库hostname从生产库恢复到测试库。

操作目的节点POTLDB01 数据库恢复到POTLDB02即在节点POTLDB01上运行,并在节点POTLDB01上备份,恢复到POTLDB02上节点POTLDB01机器检查过程1.检查环境变量检查root@POTLDB01:/usr/openv/rmanscript#ps -ef |grep smonroot 385272 467274 0 10:40:22 pts/2 0:00 grep smonoracle 655484 1 0 Jul 25 - 0:06 ora_smon_portaldb机器名字root@POTLDB01:/usr/openv/rmanscript#hostnamePOTLDB01root@POTLDB01:/usr/openv/rmanscript#pwd ---rman脚本位置/usr/openv/rmanscriptroot@POTLDB01:/usr/openv/rmanscript#lshot_database_portaldb.sh hot_database_portaldb.sh.out hot_database_portaldb.sh_bak/etc/hosts文件172.16.3.115 POTLDB01_boot172.16.3.116 POTLDB02_boot172.16.3.116 POTLDB02172.16.3.115 POTLDB011.1.3.115 POTLDB01_stby1.1.3.116 POTLDB02_stby172.16.3.117 POTLDB_svc172.16.7.142 SHYQ-PS-MV-SV03-POTLDB01-nbu172.16.7.143 SHYQ-PS-MV-SV03-POTLDB02-nbu 网关IP10.11.233.124 nbumaster172.16.10.250 yqbf原备份脚本:$RMAN target $TARGET_CONNECT_STR nocatalog msglog $RMAN_LOG_FILE append << EOFRUN {ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';send 'NB_ORA_CLIENT=SHYQ-PS-MV-SV03-POTLDB01-nbu';BACKUP$BACKUP_TYPESKIP INACCESSIBLETAG hot_db_bk_level0FILESPERSET 5# recommended formatFORMAT 'bk_%s_%p_%t'DATABASE;sql 'alter system archive log current';RELEASE CHANNEL ch00;加入后的脚本如下:BACKUP# recommended formatFORMAT '/oradata/rman_bak/controlfile/ portal_bak _%s_%p_%t'CURRENT CONTROLFILE;在节点POTLDB01成功备份后发现控制文件如下:root@POTLDB02:/usr/openv/rmanscript#ls -l /oradata/rman_bak/controlfiletotal 131072-rw-r----- 1 oracle 1001 13402112 Jul 28 11:38 portal_bak_25_1_757683479-rw-r----- 1 oracle 1001 13434880 Jul 28 11:36 portal_control_c-603295704-20110728-03 -rw-r----- 1 oracle 1001 13434880 Jul 28 11:38 portal_control_c-603295704-20110728-04 -rw-r----- 1 oracle dba 13434880 Jul 28 13:46 portal_control_c-603295704-20110728-05 -rw-r----- 1 oracle 1001 13402112 Jul 28 11:36 portaldb_controlfile_bak_23_1_757683366 获取DBIDSQL> select dbid from v$database;DBID----------603295704查看备份记录root@POTLDB01:/usr/openv/netbackup/bin#./bplist -C SHYQ-PS-MV-SV03-POTLDB01-nbu -S nbumaster -t 4 -R //c-603295704-20110728-02/cntrl_21_1_757683165/c-603295704-20110728-01/al_bk_19_1_757682964/c-603295704-20110728-00/bk_17_1_757682762/bk_16_1_757682227/bk_603295704_11_1_757680386/cntrl_10_1_757680271/al_bk_603295704_8_1_757680166/bk_603295704_7_1_757680069/bk_603295704_6_1_757679974/cntrl_5_1_757679319/al_4_1_757679223/bk_3_1_757679124/bk_2_1_757678789模拟数据库文件被删掉root@POTLDB01:/oradata/datafiles/portaldb#pwd/oradata/datafiles/portaldbroot@POTLDB01:/oradata/datafiles/portaldb#lsarchives control02.ctl redo101.log redo201.log redo301.log redo401.log redo501.log sysaux01.dbf temp01.dbf users01.dbfcontrol01.ctl control03.ctl redo102.log redo202.log redo302.log redo402.log redo502.log system01.dbf undotbs01.dbfroot@POTLDB01:/oradata/datafiles/portaldb#cd ../root@POTLDB01:/oradata/datafiles#lsportaldbroot@POTLDB01:/oradata/datafiles#lsportaldbroot@POTLDB01:/oradata/datafiles#mv portaldb portal_colroot@POTLDB01:/oradata/datafiles#mkdir portaldbroot@POTLDB01:/oradata/datafiles#cd portaldbroot@POTLDB01:/oradata/datafiles/portaldb#lsroot@POTLDB01:/oradata/datafiles/portaldb#mkdir archivesroot@POTLDB01:/oradata/datafiles/portaldb#chown –R oracle:dba /oradata/datafiles异机恢复到POTLDB02过程root@POTLDB02:/#lspvhdisk0 00c5c5666830b3fa rootvg active hdisk1 00c5c5666c01952b rootvg active hdisk2 00c5c5366a63d937 datavghdisk3 00c5c5366a65b992 hbvgroot@POTLDB02:/#varyonvg datavgroot@POTLDB02:/#mount /dev/data_lv /oradataroot@POTLDB02:/#su - oracleoracle@POTLDB02:/home/oracle$sqlplus /nologconnSQL*Plus: Release 11.1.0.7.0 - Production on Thu Jul 28 13:32:28 2011Copyright (c) 1982, 2008, Oracle. All rights reserved.SQL> /as sysdba;Connected to an idle instance.SQL>SQL>SQL>SQL> exitDisconnectedoracle@POTLDB02:/home/oracle$rman target /Recovery Manager: Release 11.1.0.7.0 - Production on Thu Jul 28 13:32:49 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved.connected to target database (not started)RMAN> startup nomount;Oracle instance startedTotal System Global Area 43025158144 bytesFixed Size 2156784 bytesVariable Size 20669531920 bytesDatabase Buffers 22280142848 bytesRedo Buffers 73326592 bytesRMAN> set dbid=603295704executing command: SET DBIDRMAN> restore controlfile from '/oradata/rman_bak/controlfile/portal_bak_25_1_757683479';Starting restore at 28-JUL-11using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=2188 device type=DISKchannel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:01output file name=/oradata/datafiles/portaldb/control01.ctloutput file name=/oradata/datafiles/portaldb/control02.ctloutput file name=/oradata/datafiles/portaldb/control03.ctlFinished restore at 28-JUL-11RMAN> alter database mount;database mountedRMAN>RMAN>RMAN> run2> {3> allocate channel t1 type 'sbt_tape' parms 'ENV=(NB_ORA_SERVER=nbumaster,NB_ORA_CLIENT=SHYQ-PS-MV-SV03-POTLDB01-nbu)';4> allocate channel t2 type 'sbt_tape' parms 'ENV=(NB_ORA_SERVER=nbumaster,NB_ORA_CLIENT=SHYQ-PS-MV-SV03-POTLDB01-nbu)';5> restore database;6> switch datafile all;7> recover database;8> sql 'alter database open resetlogs';9> release channel t1;10> release channel t2;11> }allocated channel: t1channel t1: SID=2187 device type=SBT_TAPEchannel t1: Veritas NetBackup for Oracle - Release 6.5 (2009050106)allocated channel: t2channel t2: SID=2188 device type=SBT_TAPEchannel t2: Veritas NetBackup for Oracle - Release 6.5 (2009050106)Starting restore at 28-JUL-11channel t1: starting datafile backup set restorechannel t1: specifying datafile(s) to restore from backup setchannel t1: restoring datafile 00001 to /oradata/datafiles/portaldb/system01.dbfchannel t1: restoring datafile 00002 to /oradata/datafiles/portaldb/sysaux01.dbfchannel t1: restoring datafile 00003 to /oradata/datafiles/portaldb/undotbs01.dbfchannel t1: restoring datafile 00004 to /oradata/datafiles/portaldb/users01.dbfchannel t1: reading from backup piece bk_16_1_757682227channel t1: piece handle=bk_16_1_757682227 tag=HOT_DB_BK_LEVEL0channel t1: restored backup piece 1channel t1: restore complete, elapsed time: 00:03:55Finished restore at 28-JUL-11Starting recover at 28-JUL-11starting media recoverychannel t1: starting archived log restore to default destinationchannel t1: restoring archived logarchived log thread=1 sequence=11channel t1: restoring archived logarchived log thread=1 sequence=12channel t1: reading from backup piece al_bk_19_1_757682964channel t1: piece handle=al_bk_19_1_757682964 tag=TAG20110728T112924channel t1: restored backup piece 1channel t1: restore complete, elapsed time: 00:01:25archived log file name=/oradata/datafiles/portaldb/archives/1_11_756554328.dbf thread=1 sequence=11 archived log file name=/oradata/datafiles/portaldb/archives/1_12_756554328.dbf thread=1 sequence=12 unable to find archived logarchived log thread=1 sequence=13released channel: t1released channel: t2RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 07/28/2011 13:44:17RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 13 and starting SCN of 436680RMAN> alter database open;RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of alter db command at 07/28/2011 13:45:00ORA-01589: must use RESETLOGS or NORESETLOGS option for database open RMAN> sql 'alter database open resetlogs';sql statement: alter database open resetlogs成功检查oracle@POTLDB02:/home/oracle$sqlplus /nologSQL*Plus: Release 11.1.0.7.0 - Production on Thu Jul 28 14:04:12 2011Copyright (c) 1982, 2008, Oracle. All rights reserved.SQL> conn /as sysdba;Connected.SQL>SQL>SQL> select status,instance_name from v$instance;STATUS INSTANCE_NAME------------ ----------------OPEN portaldbSQL>。

相关主题