Oracle的NetBackup备份文档(Unix版本)目录1安装OracleAgent...................................................................................................................21.1安装OracleAgent.....................................................................................................21.2更改archivelog模式..................................................................................................32创建Oracle的备份策略.........................................................................................................42.1创建备份策略...........................................................................................................42.2创建备份脚本...........................................................................................................42.3手工执行备份策略...................................................................................................72.4完整的备份方案.......................................................................................................73Oracle数据库的恢复测试....................................................................................................103.1Oracle恢复测试前的准备工作.............................................................................103.2恢复整个数据库.....................................................................................................103.3恢复数据文件.........................................................................................................113.4异机恢复.................................................................................................................1220111安装OracleAgent1.1安装OracleAgentNetbackupforOracleAgent比较简单,可以分为如下两步,安装前先在nbuserver上输入oracleagentlicense。1.安装NetBackupOracleAgent软件Netbackup的所有Agent都集中在一张光盘,插入此光盘。$Mount/mnt/cdrom$/mnt/cdrom/installVERITASInstallationScriptCopyright1993-2003VERITASSoftwareCorporation,AllRightsReserved.InstallationOptions1NetBackupAdd-OnProductSoftware2NetBackupDatabaseAgentSoftwareqToquitfromthisscriptChooseanoption[default:q]:qAtraceoftheinstallcanbefoundin/tmp/install_options_trace.26634Thatfilecanbedeletedafteryouaresuretheinstallwassuccessful.2.link库文件libobk.soLinklibobk需要先shutdown数据库。root@cluster01root]#su-oracle[oracle@cluster01oracle]$/usr/openv/netbackup/bin/oracle_linkMonFeb2709:11:55CST2006AllOracleinstancesshouldbeshutdownbeforerunningthisscript.PleaselogintotheUnixsystemastheOracleownerforrunningthisscriptDoyouwanttocontinue?(y/n)[n]yLIBOBK_PATH:/usr/openv/netbackup/binO_HOME:/oracle/product/10.1.0O_VERSION:10.1.0.3.0linkingOraclev10.1.0.3.0forLinuxRedHatMovinglibobk.sotolibobk.so.backln-s/usr/openv/netbackup/bin/libobk.so/oracle/product/10.1.0/lib/libobk.soDonePleasecheckthetracefilelocatedin/tmp/make_trace.3809tomakesurethelinkingprocesswassuccessful至此安装就结束了,allocateachannel来验证安装是否成功。oracle@cluster01oracle]$rmantarget/nocatalogRecoveryManager:Release10.1.0.3.0-ProductionCopyright(c)1995,2004,Oracle.Allrightsreserved.connectedtotargetdatabase:ORACLE(DBID=1434807386)usingtargetdatabasecontrolfileinsteadofrecoverycatalogRMANrun{allocatechannelc0typesbt_tape;}allocatedchannel:c0channelc0:sid=145devtype=SBT_TAPEchannelc0:VERITASNetBackupforOracle-Release5.1(2005081402)releasedchannel:c01.2更改archivelog模式如果ORACLE现在运行在noarchivemode,执行如下操作改成archivelogmode:#su–oracle$sqlplus“/assysdba”sqlplusaltersystemsetlog_archive_dest=’/oradata/tadsfmp/arch’;sqlplusshutdownimmediatesqlplusstartupmountsqlplusalterdatabasearchivelog;sqlplusalterdatabaseopen;SQLarchiveloglistDatabaselogmodeArchiveModeAutomaticarchivalEnabledArchivedestination/oracle/oradata/arch_logOldestonlinelogsequence70Nextlogsequencetoarchive72Currentlogsequence722创建Oracle的备份策略2.1创建备份策略1.在NetBackupMasterServer上,创建一个新的备份策略,取名oracle_backup_policy。2.输入新策略的名称后,按确定,会提示配置一个完整备份策略的第一部分‘Attributes’,其中:策略类型Policytype选择Oracle。在‘Policystorageunit’中选择需使用的存储单元。在‘Policyvolumepool’中选择已分配用来备份oracle数据的volumepool。并打勾选中Limitjobsperpolicy,然后输入99,其它默认不变。3.点击转向‘Clients’页面点击‘New’来添加一个客户端,输入客户端的名称,也就是需要备份的那台oracle服务器的主机名,选择好主机类型,然后点击OK按钮。4.点击‘Files’页面,然后点击‘New’,来添加需要调用的Oracle备份脚本,输入备份脚本的全路径和脚本的文件名。/usr/openv/netbackup/ext/db_ext/oracle/rman/samples/rman下有现成的模板。更详细的信息请参照2.2章节。5.检查此路径和文件名无误后,点击‘Schedules’页面,然后点击‘New’,来添加一个备份时间计划。在‘Name’中输入新建备份时间计划的名称,如‘ora_full’;在‘Retention’中选择备份内容的保存周期,在‘Frequency’中设定备份作业的执行频率。转向页面‘StartWindow’中设定需要备份的时间段,完成后点击OK。另外,在计划列表中已有一个‘Default-Application-Backup’的备份策略,此策略是OracleAgent的执行策略,不可以随意修改或删除。到此,备份策略已制定完毕。2.2创建备份脚本1.创建备份脚本存放路径;此路径应和之前创建备份策略时写的备份脚本路径一致。2.复制脚本模板;OracleAgent安装完成后,脚本模板放在/usr/openv/netbackup/ext/db_ext/oracle/samples/rman:[root@cluster01data]#cd/usr/openv/netbackup/ext/db_ext/oracle/samples/rman/[root@cluster01rman]#ls-ltotal66-r-xr-xr-x1rootdaemon11883Oct1102:52cold_database_backup.sh-r-xr-xr-xdaemon12582Oct1102:52cold_duplex_database_backup_full.sh-r-xr-xr-x1rootdaemon7163Oct1102:52database_restore.sh-r-xr-xr-x1rootdaemon11546Oct1102:52hot_database_backup.sh-r-xr-xr-x1rootdaemon11162Oct1102:52hot_tablespace_backup.sh-r-xr-xr-x1rootdaemon10315Oct1102:52pit_database_restore.shhot_database_backup.sh用于备份整个数据库的备份(全备,增量)。hot_tabl