版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
備份部署指南備份部署指南(TSM)AIX平臺(tái)部署V1.0目錄TOC\o"1-3"\hHYPERLINKstarttime=08:00active=yesdescription="TSMDatabasebackup"定義tsmserver數(shù)據(jù)庫卷歷史信息刪除調(diào)度:definescheduledelete_volhistorytype=administrativecmd="deletevolhistoryTODate=today-7type=dbbackup"starttime=09:00active=yesdescription="deleteVolhistorybackup"定義tsmserver卷空間回收調(diào)度:definescheduleexpire_inventorytype=administrativecmd="expireinventory"starttime=09:30active=yesdescription="Inventoryexpiration"配置TSMserver的存儲(chǔ)對(duì)象該步驟只在tsmserver1(TSM備份效勞器)上進(jìn)行確認(rèn)磁帶庫已經(jīng)通過光纖交換機(jī)連接上TSM效勞器,并在效勞器上驅(qū)動(dòng)正常。#lsdev-Cctape 可看到三個(gè)設(shè)備rmt0,rmt1,smc0,狀態(tài)必須為Available。進(jìn)入CLI管理控制臺(tái)#dsmadmc〔輸入用戶名和口令admin/admin〕定義磁帶庫和路徑definelibrary3200liblibtype=scsishare=yesdefinepathtsm3200libsrctype=serverdesttype=librarydevice=/dev/smc0online=yes定義驅(qū)動(dòng)器和路徑definedrive3200libdr01definedrive3200libdr02definepathtsmdr01srctype=serverdesttype=drivelibrary=3200libdevice=/dev/rmt0online=yesautod=yesdefinepathtsmdr02srctype=serverdesttype=drivelibrary=3200libdevice=/dev/rmt1online=yesautod=yes定義設(shè)備類definedevclass3200classdevtype=ltolibrary=3200lib定義存儲(chǔ)池definestgpooldbpool3200classmaxscratch=100definestgpoolfilepool3200classmaxscratch=100把磁帶放入磁帶庫中,標(biāo)號(hào)并檢入磁帶卷作為臨時(shí)卷labellibvolume3200libsearch=yeslabelsource=barcodecheckin=scratchoverwrite=yes執(zhí)行完畢此命令后,可以通過qlibv來查看磁帶是否被標(biāo)記創(chuàng)立備份DB〔ORACLE和DB2〕的策略域〔也可以建立兩個(gè)DB策略域,DB2節(jié)點(diǎn)和oracle節(jié)點(diǎn)分別屬于自己的策略域〕definedomaindb_POLICYdescription="DailyBackupDBNodes"創(chuàng)立備份文件的策略域definedomainfile_POLICYdescription="BackupFilesNodes"創(chuàng)立DB策略集definepolicysetdb_POLICYdb_POLICY_POLICYSETdescription="BackupDBNodes"創(chuàng)立FILE策略集definepolicysetfile_POLICYfile_POLICY_POLICYSETdescription="BackupFilesNodes"創(chuàng)立DB管理類〔也可以建立兩個(gè)DB管理類,DB2節(jié)點(diǎn)和oracle節(jié)點(diǎn)分別屬于自己的管理類〕definemgmtclassdb_POLICYdb_POLICY_POLICYSETdb_POLICY_MGMTCLASSmigdestination=dbpoolassigndefmgmtclassdb_POLICYdb_POLICY_POLICYSETdb_POLICY_MGMTCLASS創(chuàng)立FILE管理類definemgmtclassfile_POLICYfile_POLICY_POLICYSETfile_POLICY_MGMTCLASSmigdestination=filepoolassigndefmgmtclassfile_POLICYfile_POLICY_POLICYSETfile_POLICY_MGMTCLASS創(chuàng)立備份DB〔ORACLE和DB2〕的副本組〔如果將DB2和ORACLE節(jié)點(diǎn)注冊(cè)到不同的策略域或管理類,就需要?jiǎng)?chuàng)立兩個(gè)BACKUPCOPYGROUP和ARCHIVECOPYGROUP〕definecopygroupdb_POLICYdb_POLICY_POLICYSETdb_POLICY_MGMTCLASSstandardtype=backupdestination=dbpoolfrequency=0verexists=1VERDELETED=0RETEXTRA=1RETONLY=0mode=absoluteSERIALIZATION=SHRSTATICdefinecopygroupdb_POLICYdb_POLICY_POLICYSETdb_POLICY_MGMTCLASSstandardtype=archivedestination=dbpoolRETVER=365附注:定義TivoliStorageManager策略要求RMAN使用format參數(shù)〔在RMAN腳本中〕來生成唯一的備份文件名。因?yàn)椴迦氲絋ivoliStorageManager備份存儲(chǔ)池的所有備份對(duì)象具有唯一的文件名,所以它們?cè)赥ivoliStorageManager效勞器上永不失效。因此,DataProtectionforOracle需要以下特殊TivoliStorageManager策略域設(shè)置:備份副本組值DataProtectionforOracle提供了tdposync實(shí)用程序,可將不需要的備份對(duì)象從TivoliStorageManager效勞器除去。必須設(shè)置以下TivoliStorageManager備份副本組選項(xiàng):·verdeleted=0·retonly=0然后,當(dāng)DataProtectionforOracle將備份對(duì)象標(biāo)記為非活動(dòng)時(shí),會(huì)在下一次出現(xiàn)失效處理時(shí)從TivoliStorageManager效勞器刪除該對(duì)象。當(dāng)通過RMAN使用DataProtectionforOracle界面或tdposync實(shí)用程序刪除某備份對(duì)象時(shí),該備份對(duì)象即標(biāo)記為非活動(dòng)。注:1.TivoliStorageManager管理員也必須通過指定backdelete=yes來注冊(cè)您的節(jié)點(diǎn),以允許刪除備份對(duì)象。2.以下備份副本組選項(xiàng)不適用于DataProtectionforOracle:ofrequencyoverexistsoretextraomodeoserializationDataProtectionforOracle接受這些選項(xiàng)的缺省值。3.請(qǐng)注意RMANcrosscheck命令將使在屬于不同TivoliStorageManager節(jié)點(diǎn)或文件空間的TivoliStorageManager效勞器上的備份失效。管理類TivoliStorageManager使用管理類來管理TivoliStorageManager效勞器上的備份。備份數(shù)據(jù)庫時(shí),將使用節(jié)點(diǎn)的缺省管理類。因?yàn)镈ataProtectionforOracle的策略要求可能與常規(guī)TivoliStorageManager備份-歸檔客戶機(jī)期望的設(shè)置不同,所以必須為DataProtectionforOracle定義不同的管理類。建議定義獨(dú)立的策略域,在該域中缺省管理類具有所需的設(shè)置,然后將所有DataProtectionforOracle節(jié)點(diǎn)注冊(cè)到該域。如果您選擇在現(xiàn)有策略域中定義新的管理類〔不是該域的缺省管理類〕,那么必須將include語句添加到DataProtectionforOracle選項(xiàng)文件,以將所有對(duì)象綁定至該管理類。以下步驟將管理類名稱orcbackup指定給所有具有缺省文件空間名稱adsmorc的Oracle備份:1.將此inclexcl條目添加到在dsm.sys文件中所使用的效勞器節(jié)下:inclexcl/u01/oracle/include.def2.將此include條目添加到/u01/oracle/include.def文件:include/adsmorc/.../*orcbackup注:包含/排除語句中的文件空間名稱必須與tdpo_fs選項(xiàng)中定義的文件空間名稱匹配。如果使用了不同于缺省值〔adsmorc〕的文件空間名稱:a.必須使用tdpo_fs選項(xiàng)指定文件空間名稱。b.必須在包含/排除語句中指定tdpo_fs選項(xiàng)中定義的文件空間名稱。所有使用缺省文件空間名稱adsmorc備份的文件都分配給管理類orcbackup。DataProtectionforOracle將所有對(duì)象作為備份對(duì)象存儲(chǔ)在TivoliStorageManager存儲(chǔ)器上,這樣就不需要?dú)w檔副本組〔雖然它可以存在〕。創(chuàng)立備份文件的副本組definecopygroupfile_POLICYfile_POLICY_POLICYSETfile_POLICY_MGMTCLASSstandardtype=backupdestination=filepoolfrequency=0verexists=2VERDELETED=1RETEXTRA=7RETONLY=30mode=absolute激活策略集activatepolicysetdb_POLICYdb_POLICY_POLICYSETactivatepolicysetfile_POLICYfile_POLICY_POLICYSET注冊(cè)節(jié)點(diǎn):TSM本地備份客戶端regnodetsmclinetpassworddomain=file_POLICYpassexp=0backdelete=yesmaxnummp=5Oracle備份客戶端regnodeOra_node1_orapassworddomain=db_POLICYpassexp=0BACKDELete=yesmaxnummp=5regnodeOra_node1passworddomain=file_POLICYpassexp=0BACKDELete=yesmaxnummp=5DB2備份客戶端regnodedb2_node1_db2passworddomain=db_POLICYpassexp=0BACKDELete=yesmaxnummp=5regnodedb2_node1passworddomain=file_POLICYpassexp=0BACKDELete=yesmaxnummp=5文件備份客戶端regnodefile_node1passworddomain=file_POLICYpassexp=0BACKDELete=yesmaxnummp=5定義節(jié)點(diǎn)自動(dòng)備份調(diào)度并關(guān)聯(lián)到節(jié)點(diǎn)注:oracle和DB2的備份也可以用crontab執(zhí)行定時(shí)備份:再ora_node1和db2_node1兩個(gè)節(jié)點(diǎn)上用root用戶執(zhí)行:crontab–e參加:分鐘小時(shí)日月周〔備份腳本的絕對(duì)路徑〕/備份腳本的名字>dev/null2>&1例如:00**0/usr/usr_script/tsm/backup_ora.sh>dev/null2>&1表示在每周日的0:00執(zhí)行腳本/usr/tivoli/tsm/client/oracle/script/db_backup.shOracle備份調(diào)度〔用TSM的調(diào)度備份oracle沒有測(cè)試過〕definescheduledb_policyora_weeklytype=clientaction=Commandobjects="/usr/usr_script/tsm/backup_ora.sh"starttime=00:00duration=3durunits=hoursperunits=weeksdayofweek=Sundaydescription="WeeklyBackupScheduleForOracle"defineassociationdb_policyora_weeklyOra_node1_oradefinescheduledb_policyora_Nightlytype=clientaction=Commandobjects="/usr/usr_script/tsm/arch_backup_ora.sh"starttime=04:00duration=1durunits=hoursdescription="NightlyBackupScheduleForOracle"defineassociationdb_policyora_weeklyOra_node1_oraDB2備份調(diào)度definescheduledb_policydb2_nightlytype=clientaction=Commandobjects="/usr/usr_script/tsm/backupdb2.sh"starttime=00:00duration=3durunits=hoursdescription="NightlyBackupScheduleForDB2"defineassociationdb_policydb2_nightlydb2_node1_db2注:因DB2的備份腳本里可以定制哪天作全備,哪天作增量,故用一個(gè)腳本就可以FILE備份調(diào)度defineschedulefile_POLICYfile_nightlytype=clientaction=Commandobjects="/usr/tivoli/tsm/client/ba/bin/dsmcincremental/pdatabak/-subdir=yes-se=tsm"starttime=06:00duration=2durunits=hoursdescription="BackupfileSchedul"defineassociationfile_POLICYfile_nightlyfile_node1配置TSM備份Oracle數(shù)據(jù)庫的客戶端安裝TSMTDPforOracle在節(jié)點(diǎn)ora_node1上安裝TDPforOracle默認(rèn)安裝路徑:DataProtectionforOracle64-bit /usr/tivoli/tsm/client/oracle/bin64DataProtectionforOracleUtilities /usr/tivoli/tsm/client/oracle/bin64TivoliStorageManagerAPI64-bit /usr/tivoli/tsm/client/api/bin64smittyinstall_update—〉InstallandUpdatefromALLAvailableSoftware選擇以下產(chǎn)品安裝:tivoli.tsm.client.oracle.aix.64bit DataProtectionforOracle64-bittivoli.tsm.client.oracle.tools.aix.64bitDataProtectionforOracleUtilitiestivoli.tsm.loc.client.oracle.aix.64bit.ela ElectronicLicenseAgreementtivoli.tsm.client.oracle.msg.aix.64bit.xx_XXDataProtectionforOracleLanguagestivoli.tsm.client.api.aix.64bitTivoli StorageManagerAPI64-bittivoli.tsm.msg.xx_XX.client.api.64bitTivoli StorageManagerAPILanguages注意:acceptthenewlicenseagreements?要選“yes〞設(shè)置ORACLE和TDPFORORACLE的連接切換到oracle用戶并在oracle用戶的.profile文件中設(shè)置環(huán)境變量:exportLD_LIBRARY_PATH=$ORACLE_HOME/lib把此環(huán)境變量放在其他前面。關(guān)閉Oracleinstances #su–oracle$dbshut注:如果是oracle10gRAC,需要用srvctl停止數(shù)據(jù)庫方法如下:#su–oracle$srvctlstopdatabase–dDBname$srvctlstopinstance–dDBname-iinstancename1$srvctlstopinstance–dDBname-iinstancename2符號(hào)聯(lián)接ORACLERMAN和DataProtectionforOracle#su–oracle$cd$ORACLE_HOME/lib$ln-s/usr/lib/libobk64.a$ORACLE_HOME/lib/libobk.a啟動(dòng)Oracle實(shí)例和庫#su–oracle$dbstart注:如果是oracle10gRAC,需要用srvctl停止數(shù)據(jù)庫,方法如下:#su–oracle$srvctlstartinstance–dDBname-iinstancename1$srvctlstartinstance–dDBname-iinstancename2$srvctlstartdatabase–dDBname配置TDPforORACLE客戶端編輯文件/usr/tivoli/tsm/client/ba/bin/dsm.opt添加以下內(nèi)容:servername tsm編輯文件/usr/tivoli/tsm/client/ba/bin/dsm.sys添加以下內(nèi)容:#configforBAclientservername tsmcommmethod tcpiptcpport 1500tcpserveraddress nodename ora_node1passwordaccess generateerrorlogname /usr/tivoli/tsm/client/ba/bin/dsmerror.logschedlogname /usr/tivoli/tsm/client/ba/bin/dsmsched.log#configforTDPclientservername tdpo commmethod tcpip tcpport 1500 tcpserveraddress nodename ora_node1_orapasswordaccess prompterrorlogname /usr/tivoli/tsm/client/ba/bin/dsmerror.logschedlogname /usr/tivoli/tsm/client/ba/bin/dsmsched.log編輯文件/usr/Tivoli/tsm/client/api/bin64/dsm.optservernametdpo編輯文件/usr/Tivoli/tsm/client/api/bin64/dsm.sysservername tdpo commmethod tcpip tcpport 1500 tcpserveraddress nodename ora_node1_orapasswordaccess prompterrorlogname /usr/tivoli/tsm/client/ba/bin/dsmerror.logschedlogname /usr/tivoli/tsm/client/ba/bin/dsmsched.log編輯文件/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt添加以下內(nèi)容:dsmi_orc_config /usr/tivoli/tsm/client/oracle/bin64/dsm.optdsmi_log /usr/tivoli/tsm/client/oracle/bin64/tdpo_node ora_node1_ora編輯文件/usr/tivoli/tsm/client/oracle/bin64/dsm.opt添加以下內(nèi)容:Servernametdpo如果之前沒有注冊(cè)tdpfororacle節(jié)點(diǎn),那么需要注冊(cè)節(jié)點(diǎn)到TSM效勞器檢查確認(rèn)或更改數(shù)據(jù)庫的用戶oracle對(duì)目錄/usr/tivoli/tsm/client/oracle/bin64和/usr/tivoli/tsm/client/api/bin64有全部權(quán)限,對(duì)文件tdpo.opt,dsm.opt,anddsm.sys有讀權(quán)限。chmod-R777/usr/tivoli/tsm/client/api/bin64chmod-R777/usr/tivoli/tsm/client/ba/binchmod-R777/usr/tivoli/tsm/client/oracle/bin64測(cè)試庫連接文件正確性su-oraclesbttesttestThesbtfunctionpointersareloadedfromlibobk.a(shr.o)library.--sbtinitsucceededReturncode-1fromsbtinit,bsercoer=0,bsercerrno=0Message0notfound;product=RDBMS;facility=SBT進(jìn)入/usr/tivoli/tsm/client/oracle/bin64目錄運(yùn)行命令初始化口令,root執(zhí)行#tdpoconfpassword輸入注冊(cè)備份節(jié)點(diǎn)的口令(注冊(cè)節(jié)點(diǎn)時(shí)的密碼password)。此命令會(huì)在/usr/tivoli/tsm/client/oracle/bin64下生成一個(gè)口令文件檢查TDPfororacle配置#tdpoconfshowenvironment例如數(shù)出:Belowisanoutputexampleofthetdpoconfshowenvironmentcommand:DATAPROTECTIONFORORACLEINFORMATION:Version:5Release:5Level:1Sublevel:0Platform:64bitTDPOAIXTSMSERVERINFORMATION:LicenseInformation:LicensefileexistsandcontainsvalidlicensedataServerName:TSMSERVER1ServerType:AIX-RS/6000ServerPort:1500CommunicationMethod:TCP/IPSESSIONINFORMATIONOwnerName:oracleNodeName:ora_node1_oraNodeType:TDPOAIXDSMI_DIR:/usr/tivoli/tsm/client/oracle/bin64/DSMI_ORC_CONFIG:/usr/tivoli/tsm/client/oracle/bin64/dsm.optTDPO_OPTFILE:/usr/tivoli/tsm/client/oracle/bin64/tdpo.optCompression:NO用RMAN測(cè)試備份和恢復(fù)備份測(cè)試su-oracle$rmantarget/nocatalog全備份測(cè)試:RMAN〉run{allocatechannelt1type'sbt_tape'parms'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';Backupincrementallevel0format'db_%d_%T_%t_%s_%p'atabase;releasechannelt1;}備份USER表空間測(cè)試:run{allocatechannelt1type'sbt_tape'parms'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';backuptablespace"USERS"filesperset1format'db_%d_%t_%s_%p';releasechannelt1;}RMAN恢復(fù)測(cè)試-例如下面的例子僅供參考:TSM環(huán)境使用RMAN恢復(fù)Oracle的測(cè)試數(shù)據(jù)庫恢復(fù)案例歸檔模式下喪失或損壞一個(gè)數(shù)據(jù)文件〔系統(tǒng)表空間不含在內(nèi)〕RMAN備份恢復(fù)案例RMAN也可以進(jìn)行聯(lián)機(jī)備份,而且備份與恢復(fù)方法將比OS備份更簡(jiǎn)單可靠。1、連接數(shù)據(jù)庫,創(chuàng)立測(cè)試表并插入記錄SQL>connectsys/oracle@orclassysdba;Connected.SQL>createtabletest(aint)tablespaceusers;TablecreatedSQL>insertintotestvalues(1);1rowinsertedSQL>commit;Commitcomplete2、備份數(shù)據(jù)庫表空間usersSQL>altersystemswitchlogfile;Systemaltered.SQL>r1*altersystemswitchlogfile;Systemaltered.C:\>rmantargetsys/oracle@orclcatalogrman/rman@catalogRMAN>run{2>allocatechannelc1type'sbt_tape'parms'ENV=(TDPO_OPTFILE=c:/tivoli/tsm/client/oracle/bin/tdpo.opt)';3>backuptag'tsuser'format'd:\backup\tsuser_%u_%s_%p'4>tablespaceusers;5>releasechannelc1;6>}3、繼續(xù)在測(cè)試表中插入記錄SQL>insertintotestvalues(2);1rowinsertedSQL>commit;CommitcompleteSQL>select*fromtest;A---------------------------------------124、關(guān)閉數(shù)據(jù)庫,模擬喪失數(shù)據(jù)文件SQL>shutdownimmediate;Databaseclosed.Databasedismounted.ORACLEinstanceshutdownC:\>delD:\ORACLE\product\10.2.0\ORADATA\orcl\USER01.DBF5、啟動(dòng)數(shù)據(jù)庫,檢查錯(cuò)誤SQL>startupORACLEinstancestarted.TotalSystemGlobalArea102023364bytesFixedSize70924bytesVariableSize85487616bytesDatabaseBuffers16384000bytesRedoBuffers77824bytesDatabasemounted.ORA-01157:cannotidentify/lockdatafile3-seeDBWRtracefileORA-01110:datafile3:'D:\ORACLE\product\10.2.0\ORADATA\orcl\USER01.DBF'6、先翻開數(shù)據(jù)庫SQL>alterdatabasedatafile3offlinedrop;Databasealtered.SQL>alterdatabaseopen;Databasealtered.7、恢復(fù)該表空間恢復(fù)腳本可以是恢復(fù)單個(gè)數(shù)據(jù)文件run{allocatechannelc1type'sbt_tape'parms'ENV=(TDPO_OPTFILE=c:/tivoli/tsm/client/oracle/bin/tdpo.opt)';restoredatafile3;recoverdatafile3;sql'alterdatabasedatafile3online';releasechannelc1;}也可以是,恢復(fù)表空間run{allocatechannelc1type'sbt_tape'parms'ENV=(TDPO_OPTFILE=c:/tivoli/tsm/client/oracle/bin/tdpo.opt)';restoretablespaceusers;recovertablespaceusers;sql'alterdatabasedatafile3online';releasechannelc1;}8、檢查數(shù)據(jù)是否完整SQL>alterdatabaseopen;Databasealtered.SQL>select*fromtest;A---------------------------------------12說明:1、RMAN也可以實(shí)現(xiàn)單個(gè)表空間或數(shù)據(jù)文件的恢復(fù),恢復(fù)過程可以在mount下或open方式下,如果在open方式下恢復(fù),可以減少down機(jī)時(shí)間2、如果損壞的是一個(gè)數(shù)據(jù)文件,建議offline并在open方式下恢復(fù)3、這里可以看到,RMAN進(jìn)行數(shù)據(jù)文件與表空間恢復(fù)的時(shí)候,代碼都比擬簡(jiǎn)單,建議采用RMAN的備份與恢復(fù)Oracle備份腳本Oracle數(shù)據(jù)庫的備份策略為每周中的一天做全備份,其它六天作歸檔日志的備份,歸檔日志每周刪除一次,備份集保存兩份,保存7天下面是實(shí)際備份腳本(包含了刪除備份集和歸檔日志)全備份腳本:/usr/usr_script/tsm/backup_ora.shsu-oracle-c'rmantarget/nocatalog'<<EOFrun{allocatechannelt1type'sbt_tape'parms'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';backupincrementallevel0format'db_%d_%T_%t_%s_%p'database;releasechannelt1;}allocatechannelformaintenancetype'sbt_tape'parms'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';crosscheckarchivelogall;deletenopromptobsolete;releasechannel;exit>>EOF歸檔日志備份腳本:/usr/usr_script/tsm/arch_backup_ora.shsu-oracle-c'rmantarget/nocatalog'<<EOFrun{allocatechannela1type'sbt_tape'parms'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';sql'altersystemarchivelogcurrent';backupformat'arch_%d_%T_%t_%s_%p'archivelogalldeleteinput;releasechannela1;}exit>>EOF注意:設(shè)置RMAN備份集的保存?zhèn)€數(shù)為兩個(gè)#su–oracle$RMAN:rmanTARGET/nocatalog'RMAN>CONFIGURERETENTIONPOLICYTOREDUNDANCY2;設(shè)置自動(dòng)備份控制文件#su–oracle$RMAN:rmanTARGET/nocatalog'RMAN〉CONFIGURECONTROLFILEAUTOBACKUPON利用AIXCRONTAB進(jìn)行備份的方法#su–root#crontab–e參加以下兩行00**0/usr/usr_script/tsm/backup_ora.sh>/dev/console2>&1#FullBackupOracleat00:00atSunday03**1,2,3,4,5,6/usr/usr_script/tsm/arch_backup_ora.sh>dev/console2>&1#ArchBackupOracleat03:00配置備份ORACLE客戶端進(jìn)程的啟動(dòng)和停止在ora_node1效勞器上在inittab里參加下面內(nèi)容,使其自動(dòng)啟動(dòng)客戶端進(jìn)程:once:/usr/bin/dsmcsched-se=tsm>/dev/null2>&1#TSMschedulerforbackupfileonce:/usr/bin/dsmcsched-se=tdpo>/dev/null2>&1#TSMschedulerforbackuporacle如果是HACMP環(huán)境需要寫dsmc_sched腳本,將其加到oracle資源組,使其跟隨oracle啟動(dòng):nohupdsmcsched-se=tsm2>/dev/null&nohupdsmcsched-se=tdpo2>/dev/null&同時(shí)在oracle的停止腳本里參加:kill-9$(ps-ef|grepdsmc|grep-vgrep|cut-c10-15)Oracle數(shù)據(jù)庫啟用歸檔模式#su–oracle$sqlplus/assysdba1.關(guān)閉databaseinstance.Sql>SHUTDOWN或shutdownimmediate;2.備份database.3.配置pfile指定archivelogfiles的存放路徑〔可選〕如果不指定,oracle會(huì)存放在默認(rèn)位置USE_DB_RECOVERY_FILE_DEST4.啟動(dòng)數(shù)據(jù)mount模式sql>STARTUPMOUNT5.改變數(shù)據(jù)庫為archivingmode.然后open數(shù)據(jù)庫到正常模式SQL>ALTERDATABASEARCHIVELOG;SQL>ALTERDATABASEOPEN;SQL>archiveloglist輸出為:DatabaselogmodeArchiveModeAutomaticarchivalEnabledArchivedestinationUSE_DB_RECOVERY_FILE_DESTOldestonlinelogsequence25Nextlogsequencetoarchive27Currentlogsequence276.關(guān)閉數(shù)據(jù)庫SQL>SHUTDOWNIMMEDIATE7.備份數(shù)據(jù)庫配置TSM備份DB2數(shù)據(jù)庫的客戶端配置TDPforDB客戶端編輯文件/usr/tivoli/tsm/client/ba/bin/dsm.opt添加以下內(nèi)容:servername tsm編輯文件/usr/tivoli/tsm/client/ba/bin/dsm.sys添加以下內(nèi)容:#configforBAclientservername tsmcommmethod tcpiptcpport 1500tcpserveraddress nodename db2_node1passwordaccess generateerrorlogname /usr/tivoli/tsm/client/ba/bin/dsmerror.logschedlogname /usr/tivoli/tsm/client/ba/bin/dsmsched.log#configforTDPclientservername tdpdb2 commmethod tcpip tcpport 1500 tcpserveraddress nodename db2_node1_db2passwordaccess generateerrorlogname /usr/tivoli/tsm/client/ba/bin/dsmerror.logschedlogname /usr/tivoli/tsm/client/ba/bin/dsmsched.log編輯文件/usr/Tivoli/tsm/client/api/bin64/dsm.optservernametdpdb2編輯文件/usr/Tivoli/tsm/client/api/bin64/dsm.sysservername tdpdb2 commmethod tcpip tcpport 1500 tcpserveraddress nodename odb2_node1_db2passwordaccess prompterrorlogname /usr/tivoli/tsm/client/ba/bin/dsmerror.logschedlogname /usr/tivoli/tsm/client/ba/bin/dsmsched.log創(chuàng)立db2數(shù)據(jù)庫備份腳本創(chuàng)立/usr/usr_script/tsm/backupdb2.sh,內(nèi)容為:su-db2inst1-c/usr/usr_script/tsm/backupdb2.sh>>/usr/usr_script/tsm/backupdb2.outbackupdb2.sh調(diào)用連兩個(gè)腳本,db2_backup_db和db2_del_backup,分為執(zhí)行備份和刪除備份集其內(nèi)容為:CMDDIR="/usr/usr_script/tsm"forDBinIUFONCDB〔IUFO和NCDB為數(shù)據(jù)庫的名字〕do"$CMDDIR"/db2_backup_db$DBSun〔變量Sun表示周日作全備份,其他時(shí)間作增量備份〕doneforDBinIUFONCDB〔IUFO和NCDB為數(shù)據(jù)庫的名字〕do"$CMDDIR"/db2_del_backup$DB7〔變量60表示備份集保存7天〕donedb2_backup_db和db2_del_backup的內(nèi)容見附件配置備份DB2客戶端進(jìn)程啟動(dòng)和停止在db2_node1效勞器上在inittab里參加下面內(nèi)容,使其自動(dòng)啟動(dòng)客戶端進(jìn)程:once:/usr/bin/dsmcsched-se=tsm>/dev/null2>&1#TSMschedulerforbackupfileonce:/usr/bin/dsmcsched-se=tdpdb2>/dev/null2>&1#TSMschedulerforbackupDB2如果是HACMP環(huán)境需要寫dsmc_sched腳本,將其加到DB2資源組,使其跟隨DB2啟動(dòng):nohupdsmcsched-se=tsm2>/dev/null&nohupdsmcsched-se=tdpdb22>/dev/null&同時(shí)在DB2的停止腳本里參加:kill-9$(ps-ef|grepdsmc|grep-vgrep|cut-c10-15)配置TDP備份DB2數(shù)據(jù)庫設(shè)置root用戶系統(tǒng)環(huán)境變量#vi/.profile〔root用戶〕編輯系統(tǒng)環(huán)境設(shè)置文件,添加以下內(nèi)容:exportPATH=$PATH:/usr/tivoli/tsm/client/ba/binexportDSMI_DIR=/usr/tivoli/tsm/client/api/bin64exportDSMI_CONFIG=/usr/tivoli/tsm/client/api/bin64/dsm.optexportDSMI_LOG=/db2_home/db2inst1/tsm/tsmdb2logexportDSM_DIR=/usr/tivoli/tsm/client/ba/binexportDSM_CONFIG=/usr/tivoli/tsm/client/ba/bin/dsm.optexportDSM_LOG=/usr/tivoli/tsm/client/ba/bin設(shè)置db2實(shí)例用戶的環(huán)境變量#vi/db2_home/db2inst1/sqllib/db2profile〔db2實(shí)例用戶〕編輯用戶環(huán)境設(shè)置文件:exportDSMI_DIR=/usr/tivoli/tsm/client/api/bin64exportDSMI_CONFIG=/usr/tivoli/tsm/client/api/bin64/dsm.optexportDSMI_LOG=/db2_home/db2inst1/tsm/tsmdb2log生成TSM節(jié)點(diǎn)的加密密碼生成密碼文件:#/db2_home/db2inst1/sqllib/adsm/dsmapipwEnteryourcurrentpassword:passwordEnteryournewpassword:passwordEnteryournewpasswordagain:password新生成的密碼文件位于目錄/etc/security/adsm下:#ls/etc/security/adsmTSM.PWD也可以運(yùn)行命令db2adutlquery查看配置修改/db2_home/db2inst1/tsm的屬性#chmod–R777/db2_home/db2inst1/tsm/修改/usr/tivoli/tsm/client/ba/bin/dsmerror.log的屬性#chmod–R777/usr/tivoli/tsm/client/ba/bin/dsmerror.log使用db2用戶生成日志文件:〔db2inst1用戶〕$cd/db2_home/db2inst1/tsm/tsmdb2log$>tsmdb2.log$>dsmsched.log更改db2數(shù)據(jù)庫配置使數(shù)據(jù)庫能夠在線備份〔2個(gè)節(jié)點(diǎn)都要做〕su–db2inst1db2updatedbcfgforncdbusinglogretainondb2updatedbcfgforncdbusinglogarchmeth1tsmdb2updatedbcfgforncdbusingtrackmodondb2updatedbcfgforiufousinglogretainondb2updatedbcfgforiufousinglogarchmeth1tsmdb2updatedbcfgforiufousingtrackmodondb2stopdb2startDB2備份恢復(fù)測(cè)試測(cè)試數(shù)據(jù)庫備份:〔db2實(shí)例用戶〕在數(shù)據(jù)庫DB2的節(jié)點(diǎn)db_node1上執(zhí)行如下命令#su–db2inst1$db2backupdbiufousetsmBackupsuccessful.Thetimestampforthisbackupimageis:20051229093918說明數(shù)據(jù)庫備份成功,恢復(fù)之前,先drop庫,執(zhí)行db2dropdbiufo最后進(jìn)行測(cè)試恢復(fù):$db2restoredbiufousetsmtakenat20051229093918SQL2539WWarning!Restoringtoanexistingdatabasethatisthesameasthebackupimagedatabase.Thedatabasefileswillbedeleted.Doyouwanttocontinue?(y/n)yDB20000ITheRESTOREDATABASEcommandcompletedsuccessfully.數(shù)據(jù)庫備份恢復(fù)成功。測(cè)試數(shù)據(jù)庫在線備份:〔db2實(shí)例用戶〕執(zhí)行如下命令#su–db2inst1$db2backupdbiufoonlineusetsm Backupsuccessful.Thetimestampforthisbackupimageis:20051229093938數(shù)據(jù)庫備份成功,測(cè)試恢復(fù)數(shù)據(jù)庫:$db2restoredbiufousetsmtakenat20051229093918數(shù)據(jù)庫恢復(fù)成功,回滾數(shù)據(jù)庫日志:$db2rollforwarddbiufotoendoflogsandcompleteRollforwardStatus Inputdatabasealias=iufo Numberofnodeshavereturnedstatus=1Nodenumber=0 Rollforwardstatus=notpendingNextlogfiletoberead=Logfilesprocessed=S0000000.LOG-S0000001.LOGDB20000ITheROLLFORWARDcommandcompletedsuccessfully.連接到恢復(fù)的數(shù)據(jù)庫:$db2connecttoiufo$db2listtablesforall可以列出數(shù)據(jù)庫中存在的表,說明備份恢復(fù)成功。配置TSM備份File客戶端編輯文件/usr/tivoli/tsm/client/ba/bin/dsm.opt添加以下內(nèi)容:servername tsm編輯文件/usr/tivoli/tsm/client/ba/bin/dsm.sys添加以下內(nèi)容:#configforBAclientservername tsmcommmethod tcpiptcpport 1500tcpserveraddress nodename file_node1passwordaccess generateerrorlogname /usr/tivoli/tsm/client/ba/bin/dsmerror.logschedlogname /usr/tivoli/tsm/client/ba/bin/dsmsched.log配置備份file客戶端進(jìn)程啟動(dòng)和停止在file_node1效勞器上在inittab里參加下面內(nèi)容,使其自動(dòng)啟動(dòng)客戶端進(jìn)程:once:/usr/bin/dsmcsched-se=tsm>/dev/null2>&1#TSMschedulerforbackupfile如果是HACMP環(huán)境需要寫dsmc_sched啟動(dòng)腳本nohupdsmcsched-se=tsm2>/dev/null&同時(shí)在資源組的停止腳本里參加:kill-9$(ps-ef|grepdsmc|grep-vgrep|cut-c10-15)安裝TivoliStorageManagerforSAN(LAN-FREE可選)確定LAN和SAN網(wǎng)絡(luò)連接正常,在TSM效勞器上和要進(jìn)行備份的LAN-FREE客戶端上都可以看到磁帶庫設(shè)備。#lsdev–Cctape出現(xiàn)三個(gè)設(shè)備。rmt0Available08-08-01IBM3580UltriumTapeDrive(FCP)rmt1Available08-08-01IBM3580UltriumTapeDrive(FCP)smc0Available08-08-01IBM3573TapeMediumChanger(FCP)在要進(jìn)行LAN-FREE備份的客戶端上安裝StorageAgent,安裝路徑/usr/tivoli/tsm/StorageAgent,選擇安裝包:編輯文件/usr/tivoli/tsm/StorageAgent/bin/dsmsta.optDEVCONFIGdevconfig.outVOLHISTORYvolhistory.out在效勞器上定義要進(jìn)行備份的StorageAgent效勞器defineserverAGENT_ora_node1serverpassword=passwordhladdress=0lladdress=1500validateprotocol=alldefineserverAGENT_db2_node1serverpassword=passwordhladdress=0lladdress=1500validateprotocol=alldefineserverAGENT_file_node1serverpassword=passwordhladdress=lladdress=1500validateprotocol=all在StorageAgent上設(shè)置效勞器信息在LAN–free客戶端效勞器/usr/tivoli/StorageAgent/bin下執(zhí)行dsmstasetstorageservermyname=AGENT_ora_node1mypassword=passwordmyhladdress=0servername=tsmserverpassword=passwordhladdress=lladdress=1500dsmstasetstorageservermyname=AGENT_db2_node1mypassword=passwordmyhladdress=servername=tsmserverpassword=passwordhladdress=lladdress=1500dsmstasetstorageservermyname=AGENT_file_node1mypassword=passwordmyhladdress=servername=tsmserverpassword=passwordhladdress=lladdress=1500./dsmsta登陸至SAN后,設(shè)置如下參數(shù)Setoptcommtimeout3600Setoptidletimeout60此命令在設(shè)備配置文件devconfig.out中產(chǎn)生以下內(nèi)容:setstanamestoragntSETSTAPASSWORDxxxxxxxSETSTAHLADDRESSXXXXXXDEFINESERVERtsmserverpassword=xxxxxxxxxxxHLADDRESS=TSMserverIPLLADDRESS=1500在存儲(chǔ)代理上定義磁帶庫驅(qū)動(dòng)器路徑definepathAGENT_ora_node13200libsrctype=serverdesttype=librarydevice=/dev/smc0online=yesdefinepathAGENT_db2_node13200libsrctype=serverdesttype=librarydevice=/dev/smc0online=yesdefinepathAGENT_file_node13200libsrctype=serverdesttype=librarydevice=/dev/smc0online=yesdefinepathAGENT_ora_node1drive1srctype=serverdesttype=drivelibrary=3200libdevice=/dev/rmt0definepathAGENT_ora_node1drive2srctype=serverdesttype=drivelibrary=3200libdevice=/dev/rmt1definepathAGENT_db2_node1drive1srctype=serverdesttype=drivelibrary=3200libdevice=/dev/rmt0definepathAGENT_db2_node1drive2srctype=serverdesttype=drivelibrary=3200libdevice=/dev/rmt1definepathAGENT_file_node1drive1srctype=serverdesttype=drivelibrary=3200libdevice=/dev/rmt0definepathAGENT_file_node1drive2srctype=serverdesttype=drivelibrary=3200libdevice=/dev/rmt1在存儲(chǔ)代理上輸入以下命令啟動(dòng)存儲(chǔ)代理#/usr/Tivoli/tsm/Storagentagent/bin/dsmstaquiet&在客戶端上執(zhí)行dsm啟動(dòng)備份驗(yàn)證LANFREE是否配置成功。附件DB2備份腳本#!/bin/ksh#####################################################Moduledb2_backup_db#HuShaobo#-------------------------------------------#Description:thisscriptbackupdb2databasefullorincremental##Usage:db2_backup_dbdb_nameday_of_week[num_of_sessions]"#Input:db_name:thedatebasenameneedtobebackuped."#day_of_week:thepossiblevaluesshouldbe:"#Full:fullbackup."#Inc:Incrementalbackup."#Sat:fullbackupatSaterday,otherdaysareincrementalbackupbasedonSaterday."#Sun:fullbackupatSunday,otherdaysareincrementalbackupbasedonSunday."#Mon:fullbackupatMonday,otherdaysareincrementalbackupbasedonMonday."#Tue:fullbackupatThuesday,otherdaysareincrementalbackupbasedonTuesday."#Wed:fullbackupatWednesday,otherdaysareincrementalbackupbasedonWednesday."#Thu:fullbackupatThurday,otherdaysareincrementalbackupbasedonThurday."#Fri:fullbackupatFriday,otherdaysareincrementalbackupbasedonFriday."#num_of_session:howmanydrivesyouwanttousewhenbackup,thedefaultis1."######################################################./$HOME/.profileLOG=$HOME/tsm/logs/db2_backup_db.logif["$1"==""-o"$2"==""];thenecho"Wrongparameters!"echo"----------------------------------------------------------"echo"Usage:db2_backup_dbdb_nameday_of_week[num_of_sessions]"echo"Input:db_name:thedatebasenameneedtobebackuped."echo"day_of_week:thepossiblevaluesshouldbe:"echo"Full:fullbackup."echo"Inc:Incrementalbackup."echo"Sat:fullbackupatSaterday,otherdaysareincrementalbackupbasedonSaterday."echo"Sun:fullbackupatSunday,otherdaysareincrementalbackupbasedonSunday."echo"Mon:fullbackupatMonday,otherdaysareincrementalbackupbasedonMonday."echo"Tue:fullbackupatThuesday,otherdaysareincrementalbackupbasedonTuesday."echo"Wed:fullbackupatWednesday,otherdaysareincrementalbackupbasedonWednesday."echo"Thu:fullbackupatThurday,otherdaysareincrementalbackupbasedonThurday."echo"Fri:fullbackupatFriday,otherdaysareincr
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 四川省蒼溪中學(xué)2025屆物理高一上期末考試模擬試題含解析
- 江功省睢寧縣第一中學(xué)北校2025屆高二物理第一學(xué)期期末經(jīng)典模擬試題含解析
- 2025屆吉林省高中學(xué)校高二物理第一學(xué)期期末監(jiān)測(cè)模擬試題含解析
- 陜西省西安市新城區(qū)西安中學(xué)2025屆高二物理第一學(xué)期期末監(jiān)測(cè)模擬試題含解析
- 江蘇省宿遷市泗洪中學(xué)2025屆物理高三上期末統(tǒng)考試題含解析
- 2025屆浙江省樂清外國(guó)語學(xué)院物理高一上期末質(zhì)量跟蹤監(jiān)視試題含解析
- 2025屆浙江省鎮(zhèn)海中學(xué)物理高二上期末質(zhì)量檢測(cè)試題含解析
- 2025屆上海市四中物理高三上期中質(zhì)量檢測(cè)模擬試題含解析
- 大流量羅茨鼓風(fēng)機(jī)相關(guān)行業(yè)投資方案范本
- 11大會(huì)日程和籌備方案
- 家畜繁殖學(xué)課件
- 浙江森馬服飾股份有限公司營(yíng)運(yùn)能力分析及提升策略研究
- 《數(shù)字化測(cè)圖》教學(xué)教案
- 圖像數(shù)據(jù)預(yù)處理詳述
- 室顫的搶救與護(hù)理課件
- 人教版 九年級(jí)化學(xué)上冊(cè) 第六單元 碳和碳的氧化物 課題2 二氧化碳的制取研究 說課稿
- 2023人民音樂出版社招聘7人筆試參考題庫(共500題)答案詳解版
- 第19課《小站》課件(共18張)(五四學(xué)制)語文六年級(jí)上冊(cè)
- 智慧醫(yī)療人工智能的應(yīng)用
- 行業(yè)變革下的專業(yè)知識(shí)更新與迭代
- 內(nèi)蒙古自治區(qū)2021-2022學(xué)年普通高中學(xué)業(yè)水平考試(高二會(huì)考)英語真題
評(píng)論
0/150
提交評(píng)論