• 24.55 KB
  • 11页

netbackupfororacle备份实施手册

  • 11页
  • 当前文档由用户上传发布,收益归属用户
  1. 1、本文档共5页,可阅读全部内容。
  2. 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
  3. 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
  4. 文档侵权举报电话:19940600175。
'通过rman从NBU备份恢复ORACLE环境:redhat4asupdate7NUB6.5.2Oracle10.2.0.1ORACLESID====LJY1.安装database设置oracle用户及安装目录/usr/sbin/groupaddoinstall/usr/sbin/groupadddba/usr/sbin/useradd-m-goinstall-Gdbaoraclemkdir-p/u01/app/oraclemkdir-p/u02/oradatachown-Roracle:oinstall/u01/app/oracle/u02/oradatachmod-R775/u01/app/oracle/u02/oradata更改主机配置文件i.Root用户vi/etc/sysctl.confkernel.shmall=2097152kernel.shmmax=2147483648kernel.shmmni=4096kernel.sem=25032000100128fs.file-max=65536net.ipv4.ip_local_port_range=102465000net.core.rmem_default=1048576net.core.rmem_max=1048576net.core.wmem_default=262144net.core.wmem_max=262144 vi/etc/security/limits.conforaclesoftnproc2047oraclehardnproc16384oraclesoftnofile1024oraclehardnofile65536vi/etc/pam.d/loginsessionrequired/lib/security/pam_limits.sosessionrequiredpam_limits.sovi/etc/profileif[$USER="oracle"];thenif[$SHELL="/bin/ksh"];thenulimit-p16384ulimit-n65536elseulimit-u16384-n65536fifii.oracle用户su-oraclevi./.bash_profileORACLE_BASE=/u01/app/oracleORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1ORACLE_SID=LJYexportORACLE_HOMEORACLE_BASEORACLE_SIDPATH=$PATH:$HOME/bin:$ORACLE_HOME/bin安装libaio在第4张光盘。否则安装oracle检测出错。 安装oracle应用并创建数据库su-oracle安装oracle应用程序创建数据库配置归档模式shutdownimmediate;startupmount;ALTERDATABASEARCHIVELOG;alterdatabaseopen;1.安装NBUClientsu-root安装ICSbpx安装NBUClient安装DatabaseAgentfororaclesu-oracle运行oracle_link脚本:/usr/openv/netbackup/bin/oracle_link2.配置rman脚本配置策略配置rman脚本send"NB_ORA_SERV=ljy_nbu7,NB_ORA_CLIENT=oracle10a";BACKUP FORMAT"cntrl_%I_%s_%p_%t" 1.完成创建、配置、启动监听器lsnrctlstart2.附录1:nbuoracle备份脚本#!/bin/sh#$Header:hot_database_backup.sh,v1.22002/08/0623:51:42$##bcpyrght#***************************************************************************#*$VRTScprght:Copyright1993-2007SymantecCorporation,AllRightsReserved$*#***************************************************************************#ecpyrght##---------------------------------------------------------------------------#hot_database_backup.sh#---------------------------------------------------------------------------#ThisscriptusesRecoveryManagertotakeahot(inconsistent)database#backup.Ahotbackupisinconsistentbecauseportionsofthedatabaseare#beingmodifiedandwrittentothediskwhilethebackupisprogressing.#YoumustrunyourdatabaseinARCHIVELOGmodetomakehotbackups.Itis#assumedthatthisscriptwillbeexecutedbyuserroot.InorderforRMAN#toworkproperlyweswitchuser(su-)totheoracledbaaccountbefore#execution.IfthisscriptrunsunderauseraccountthathasOracledba#privilege,itwillbeexecutedusingthisuser"saccount.#---------------------------------------------------------------------------#---------------------------------------------------------------------------#Determinetheuserwhichisexecutingthisscript.#---------------------------------------------------------------------------CUSER=`id|cut-d"("-f2|cut-d")"-f1`#---------------------------------------------------------------------------#Putoutputin.out.Changeasdesired.#Note:outputdirectoryrequireswritepermission. #---------------------------------------------------------------------------RMAN_LOG_FILE=${0}.out#---------------------------------------------------------------------------#Youmaywanttodeletetheoutputfilesothatbackupinformationdoes#notaccumulate.Ifnot,deletethefollowinglines.#---------------------------------------------------------------------------if[-f"$RMAN_LOG_FILE"]thenrm-f"$RMAN_LOG_FILE"fi#-----------------------------------------------------------------#Initializethelogfile.#-----------------------------------------------------------------echo>>$RMAN_LOG_FILEchmod666$RMAN_LOG_FILE#---------------------------------------------------------------------------#Logthestartofthisscript.#---------------------------------------------------------------------------echoScript$0>>$RMAN_LOG_FILEecho====startedon`date`====>>$RMAN_LOG_FILEecho>>$RMAN_LOG_FILE#---------------------------------------------------------------------------#Replace/db/oracle/product/ora81,below,withtheOraclehomepath.#---------------------------------------------------------------------------ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1exportORACLE_HOME#---------------------------------------------------------------------------#Replaceora81,below,withtheOracleSIDofthetargetdatabase.#---------------------------------------------------------------------------ORACLE_SID=LJYexportORACLE_SID#--------------------------------------------------------------------------- #Replaceora81,below,withtheOracleDBAuserid(account).#---------------------------------------------------------------------------ORACLE_USER=oracle#---------------------------------------------------------------------------#Setthetargetconnectstring.#Replace"sys/manager",below,withthetargetconnectstring.#---------------------------------------------------------------------------TARGET_CONNECT_STR=sys/sys#---------------------------------------------------------------------------#SettheOracleRecoveryManagername.#---------------------------------------------------------------------------RMAN=$ORACLE_HOME/bin/rman#---------------------------------------------------------------------------#Printoutthevalueofthevariablessetbythisscript.#---------------------------------------------------------------------------echo>>$RMAN_LOG_FILEecho"RMAN:$RMAN">>$RMAN_LOG_FILEecho"ORACLE_SID:$ORACLE_SID">>$RMAN_LOG_FILEecho"ORACLE_USER:$ORACLE_USER">>$RMAN_LOG_FILEecho"ORACLE_HOME:$ORACLE_HOME">>$RMAN_LOG_FILE#---------------------------------------------------------------------------#Printoutthevalueofthevariablessetbybphdb.#---------------------------------------------------------------------------echo>>$RMAN_LOG_FILEecho"NB_ORA_FULL:$NB_ORA_FULL">>$RMAN_LOG_FILEecho"NB_ORA_INCR:$NB_ORA_INCR">>$RMAN_LOG_FILEecho"NB_ORA_CINC:$NB_ORA_CINC">>$RMAN_LOG_FILEecho"NB_ORA_SERV:$NB_ORA_SERV">>$RMAN_LOG_FILEecho"NB_ORA_POLICY:$NB_ORA_POLICY">>$RMAN_LOG_FILE#---------------------------------------------------------------------------#NOTE:Thisscriptassumesthatthedatabaseisproperlyopened.Ifdesired,#thiswouldbetheplacetoverifythat.#--------------------------------------------------------------------------- echo>>$RMAN_LOG_FILE#---------------------------------------------------------------------------#IfthisscriptisexecutedfromaNetBackupschedule,NetBackup#setsanNB_ORAenvironmentvariablebasedonthescheduletype.#TheNB_ORAvariableisthenusedtodynamicallysetBACKUP_TYPE#Forexample,when:#scheduletypeisBACKUP_TYPEis#------------------------------#AutomaticFullINCREMENTALLEVEL=0#AutomaticDifferentialIncrementalINCREMENTALLEVEL=1#AutomaticCumulativeIncrementalINCREMENTALLEVEL=1CUMULATIVE##Foruserinitiatedbackups,BACKUP_TYPEdefaultstoincremental#level0(full).Tochangethedefaultforauserinitiated#backuptoincrementalorincrementalcumulative,uncomment#oneofthefollowingtwolines.#BACKUP_TYPE="INCREMENTALLEVEL=1"#BACKUP_TYPE="INCREMENTALLEVEL=1CUMULATIVE"##Notethatweuseincrementallevel0tospecifyfullbackups.#Thatisbecause,althoughtheyareidenticalincontent,only#theincrementallevel0backupcanhaveincrementalbackupsof#level>0appliedtoit.#---------------------------------------------------------------------------if["$NB_ORA_FULL"="1"]thenecho"Fullbackuprequested">>$RMAN_LOG_FILEBACKUP_TYPE="INCREMENTALLEVEL=0"elif["$NB_ORA_INCR"="1"]thenecho"Differentialincrementalbackuprequested">>$RMAN_LOG_FILEBACKUP_TYPE="INCREMENTALLEVEL=1"elif["$NB_ORA_CINC"="1"]thenecho"Cumulativeincrementalbackuprequested">>$RMAN_LOG_FILEBACKUP_TYPE="INCREMENTALLEVEL=1CUMULATIVE"elif["$BACKUP_TYPE"=""]thenecho"Default-Fullbackuprequested">>$RMAN_LOG_FILEBACKUP_TYPE="INCREMENTALLEVEL=0" fi#---------------------------------------------------------------------------#CallRecoveryManagertoinitiatethebackup.Thisexampledoesnotusea#RecoveryCatalog.Ifyouchoosetouseone,replacetheoption"nocatalog"#fromthermancommandlinebelowwiththe#"rcvcat/@"statement.##Note:AnyenvironmentvariablesneededatruntimebyRMAN#mustbesetandexportedwithintheswitchuser(su)command.#---------------------------------------------------------------------------#Backsupthewholedatabase.Thisbackupispartoftheincremental#strategy(thismeansitcanhaveincrementalbackupsoflevels>0#appliedtoit).##Wedonotneedtoexplicitlyrequestthecontrolfiletobeincluded#inthisbackup,asitisautomaticallyincludedeachtimefile1of#thesystemtablespaceisbackedup(theinference:asitisawhole#databasebackup,file1ofthesystemtablespacewillbebackedup,#hencethecontrolfilewillalsobeincludedautomatically).##Typically,alevel0backupwouldbedoneatleastonceaweek.##Thescenarioassumes:#oyouarebackingyourdatabaseuptotwotapedrives#oyouwanteachbackupsettoincludeamaximumof5files#oyouwishtoincludeofflinedatafiles,andread-onlytablespaces,#inthebackup#oyouwantthebackuptocontinueifanyfilesareinaccessible.#oyouarenotusingaRecoveryCatalog#oyouareexplicitlybackingupthecontrolfile.Sinceyouare#specifyingnocatalog,thecontrolfilebackupthatoccurs#automaticallyastheresultofbackingupthesystemfileis#notsufficient;itwillnotcontainrecordsforthebackupthat#iscurrentlyinprogress.#oyouwanttoarchivethecurrentlog,backupallthe#archivelogsusingtwochannels,puttingamaximumof20logs#inabackupset,anddeletingthemoncethebackupiscomplete.##Notethattheformatstringisconstructedtoguaranteeuniquenessand#toenhanceNetBackupforOraclebackupandrestoreperformance.## #NOTEWHENUSINGTNSALIAS:Whenconnectingtoadatabase#usingaTNSalias,youmustuseasendcommandoraparmsoperandto#specifyenvironmentvariables.Inotherwords,whenaccessingadatabase#throughalistener,theenvironmentvariablessetatthesystemlevelarenot#visiblewhenRMANisrunning.Formoreinformationontheenvironment#variables,pleaserefertotheNetBackupforOracleAdmin.Guide.##---------------------------------------------------------------------------CMD_STR="ORACLE_HOME=$ORACLE_HOMEexportORACLE_HOMEORACLE_SID=$ORACLE_SIDexportORACLE_SID$RMANtarget$TARGET_CONNECT_STRnocatalogmsglog$RMAN_LOG_FILEappend<>$RMAN_LOG_FILERSTAT=$?else/usr/bin/sh-c"$CMD_STR">>$RMAN_LOG_FILERSTAT=$?fi#---------------------------------------------------------------------------#Logthecompletionofthisscript.#---------------------------------------------------------------------------if["$RSTAT"="0"]thenLOGMSG="endedsuccessfully"elseLOGMSG="endedinerror"fiecho>>$RMAN_LOG_FILEechoScript$0>>$RMAN_LOG_FILEecho====$LOGMSGon`date`====>>$RMAN_LOG_FILEecho>>$RMAN_LOG_FILEexit$RSTAT 1.附录2:oracle管理oracle的常用启动与关闭1,启动isqlplus服务端口:5560isqlplusctlstart//启动isqlplusctlstop//停止2,启动数据库dbstartdbshut3,开启企业管理器端口:1158emctlstartdbconsoleemctlstopdbconsole4,启动监听lsnrctlstartlsnrctlstop5,开启代理emctlstartagentemctlstopagent6,启动实例sqlplus/nologconn/assysdbastartup//启动实例shutdownimmediate//关闭实例7,tnsping192.168.111.210//测试Oracle数据库是否通8,http://192.168.111.210:5560/isqlplus/dba//isQL*PlusDBAURL9,http://192.168.111.210:1158/em//EnterpriseManager10gDatabaseControl每次启动时都会报错Failedtoauto-startOracleNetListeneusing/ade/vikrkuma_new/oracle/bin/tnslsnr编辑dbstart文件vidbstar将该行改为exportORACLE_HOME_LISTNER=$ORACLE_HOME想系统启动是自动启动数据库可以通过修改/etc/rc.d/rc.local文件一开始我写的命令是suoracle-lc"ora_App/product/10.2.0/db_1/bin/lsnrctlstart"suoracle-lc"ora_App/product/10.2.0/db_1/bin/dbstart"'