Oracle数据库备份恢复测试报告目录1.背景概述.......................................................................................11.1恢复测试目的......................................................................................11.2恢复测试方法......................................................................................11.3数据库备份架构...................................................................................12.恢复所需资源.................................................................................22.1主机资源.............................................................................................22.2实施环境.............................................................................................23.数据库恢复测试步骤.......................................................................33.1安装配置测试主机................................................................................33.2全库恢复.............................................................................................33.3测试主机-TSM恢复配置.........................................................................33.4测试主机-设定数据库环境变量...............................................................43.5测试主机-启动数据库到NOMOUNT状态.....................................................43.6测试主机-恢复控制文件........................................................................43.7测试主机-更改数据库到MOUNT状态.........................................................53.8测试主机-恢复数据文件........................................................................53.9测试主机-恢复归档日志........................................................................93.10测试主机-以RESETLOGS方法打开数据库...................................................113.11测试主机-重启数据库...........................................................................114.恢复结果......................................................................................12第1页1.背景概述1.1恢复测试目的为了验证数据库的备份有效性,我们进行了此次的数据库恢复测试,用来确保数据库备份的正确性,可恢复性。1.2恢复测试方法异机恢复因为生产数据库已经在使用,我们不能在生产数据库上进行本机恢复测试,为了不影响生产数据库的正常使用,我们将在测试机上进行恢复测试。1.3数据库备份架构1.备份系统采用IBMTivoli备份软件;2.带库使用ADIC磁带库。第2页2.恢复所需资源2.1主机资源需要准备恢复的测试主机,最佳做法是恢复测试主机的硬件架构、操作系统版本和生产主机一致。恢复测试主机信息角色主机名IP地址操作系统测试机ZJB_fwskdb78.20.63.13IBMAIX5.3备份主机shfwskdb178.20.53.13IBMAIX5.32.2实施环境软件版本TSMseverforwindows5.3.2.4Oracle9i9.2.0.7.8第3页3.数据库恢复测试步骤3.1安装配置测试主机因为测试机完全拷贝备份主机,故测试机与生产机环境一致,确保测试主机已经正常运行,并能于要恢复的生产主机,备份主机网络连通。3.2全库恢复利用TSM软件界面,调用原来所备份的数据库,以及相应的数据库恢复工具RMAN的脚本,进行ORACLE数据库系统的全库恢复。3.3测试主机-TSM恢复配置因为测试主机与生产主机架构相同,故只需在TSMSERVER上定义SANserver。如下:defineserversh_fwsk_db_sc_sta_01serverpassword=adminhladdress=78.20.63.13lladdress=1500validateprotocol=alldefinepathsh_fwsk_db_sc_sta_01mt0.2.0.3srctype=serverdesttype=drivelibr=lb0.1.0.3device=/dev/rmt0definepathsh_fwsk_db_sc_sta_01mt0.3.0.3srctype=serverdesttype=drivelibr=lb0.1.0.3device=/dev/rmt1definepathsh_fwsk_db_sc_sta_01mt0.4.0.3srctype=serverdesttype=drivelibr=lb0.1.0.3device=/dev/rmt2definepathsh_fwsk_db_sc_sta_01mt0.5.0.3srctype=serverdesttype=drivelibr=lb0.1.0.3device=/dev/rmt3在客户端/usr/tivoli/tsm/StorageAgent/bin目录下执行以下命令:#dsmstasetstorageservermyname=sh_fwsk_db_sc_sta_01mypassword=adminmyhladdress=78.20.63.13servername=tsmserverserverpassword=adminhladdress=78.20.53.241lladdress=1500启动TSMSANStorageAgent#cd/usr/tivoli/tsm/StorageAgent/bin#nohup./dsmsta&第4页3.4测试主机-设定数据库环境变量接下来的步骤都要求以用户oracle运行,并要求环境变量ORACLE_SID设置为需要恢复的数据库。在测试主机上,设置用户oracle的环境变量ORACLE_SID为需要恢复的数据库:exportORACLE_SID=fwsk13.5测试主机-启动数据库到nomount状态在测试主机上,以oracle用户登陆数据库,以dba权限启动数据库到nomount状态:$rmantarget/RecoveryManager:Release9.2.0.7.0-64bitProductionCopyright(c)1995,2002,OracleCorporation.Allrightsreserved.connectedtotargetdatabase(notstarted)RMANstartupnomount;OracleinstancestartedTotalSystemGlobalArea11027857208bytesFixedSize757560bytesVariableSize2432696320bytesDatabaseBuffers8589934592bytesRedoBuffers4468736bytes3.6测试主机-恢复控制文件在测试主机上,使用工具rman来恢复数据库的控制文件:RMANrun{2allocatechanneld1devicetypesbtparms'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';第5页3Restorecontrolfilefrom'c-1625137697-20110826-01';4releasechanneld1;5}usingtargetdatabasecontrolfileinsteadofrecoverycatalogallocatedchannel:d1channeld1:sid=15devtype=SBT_TAPEchanneld1:TivoliDataProtectionforOracle:version5.2.0.0Startingrestoreat26-AUG-11channeld1:restoringcontrolfilechanneld1:restorecompletereplicatingcontrolfileinputfilename=/dev/rlvfwsk_cntrl1outputfilename=/dev/rlvfwsk_cntrl2outputfilename=/dev/rlvfwsk_cntrl3Finishedrestoreat26-AUG-11releasedchannel:d13.7测试主机-更改数据库到mount状态在测试主机上,等控制文件恢复完成后,更改数据库到mount状态:RMANalterdatabasemount;databasemounted3.8测试主机-恢复数据文件RMANrun{2allocatechanneld1devicetypesbtparms第6页'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';3allocatechanneld2devicetypesbtparms'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';4Restoredatabase;5}allocatedchannel:d1channeld1:sid=15devtype=SBT_TAPEchanneld1:TivoliDataProtectionforOracle:version5.2.0.0allocatedchannel:d2channeld2:sid=17devtype=SBT_TAPEchanneld2:TivoliDataProtectionforOracle:version5.2.0.0Startingrestoreat26-AUG-11channeld1:startingdatafilebackupsetrestorechanneld