rman備份恢復(fù)詳解_第1頁
rman備份恢復(fù)詳解_第2頁
rman備份恢復(fù)詳解_第3頁
rman備份恢復(fù)詳解_第4頁
rman備份恢復(fù)詳解_第5頁
已閱讀5頁,還剩74頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

第一部分,認(rèn)識(shí)[root@director~]#find/-namerman/u01/oracle/10g/sysman/admin/scripts/db/rman/u01/oracle/10g/oc4j/j2ee/oc4j_applications/applications/em/em/WEB-INF/perl/db/rman/u01/oracle/10g/bin/rman調(diào)整順序的話調(diào)整這文[root@directorif[-f];then.~/.bashrcfi#UserspecificstartupprogramsPATHexportORACLE_BASE=/u01/oracleORACLE_SID=TestDBexportexportPATH=$ORACLE_HOME/bin:$PATH;LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;份可以進(jìn)的前提條件是數(shù)據(jù)必須處于歸檔式[oracle@director~]$sqlplus/assysdbaonFriMay04:50:0220161982,Allreserved.Connectedto:OracleDatabaseEnterpriseReleaseProductiontheOLAPandDataoptionsarchivelogarchivalEnabledUSE_DB_RECOVERY_FILE_DESTOldestlogsequence3Nextlogtoarchive5logsequence5強(qiáng)制檔日命令SQL>altersyarchivelogSystemaltersylogfile;System1設(shè)保存略設(shè)置為化項(xiàng)為設(shè)備份介質(zhì)設(shè)自動(dòng)備份控制文件備份通個(gè)盤通道個(gè)1設(shè)置媒家置媒介家庭ltlt一list命1.List當(dāng)所份數(shù)據(jù):1.1.listpmmary;概述可用的份匯總詢--如果備份文多的話多用這兩個(gè)list命可以對(duì)備份文件有個(gè)總體了。B表backupA表Archiv、F表示full、0,1,2表el備A表用、X示這個(gè)命令可以派生出很多類似命令,例listbackummarybackuparchivelogallmmarylistbackutablespacemmary;listpofmmary這些命令可以讓我們對(duì)已有的份文件有一個(gè)整體,直觀的了解。1.2.listbackuby按件類分別列分別為數(shù)據(jù)文件列表歸檔日志列表、控文件列表、表1.3.list這命列已有備份的細(xì)息。列過期的備份文件copy;列文ofcopyofcontrolfile;oftablespacesers;ofcopyarchiveloglistlistuntilsequence2.List相件的息listof{archivelog,controlfile,backupof2.1服參件:listofspfile;2.2制:list2.3據(jù):of2.4表:listof表空對(duì)的2.5日:backupof{all,from,high,like,low,scn,time,backupofofuntillistofsequenceofuntilsequence10;listbackuparchivelogfromofuntilscn200000;archivelogfromscnarchiveloguntilscn2000;listarchivelogfromsequencelistarchiveloguntilsequence12;二report常命令結(jié)忘用判斷數(shù)據(jù)庫當(dāng)可恢復(fù)狀態(tài)、以及數(shù)據(jù)庫有備份的信息最常使的reportschema;need,obsolete,unrecoverable}schema;obsolete;unrecoverable;needreportdays=3;--報(bào)告最近天沒有備的件needredundancy=3;報(bào)余次數(shù)小于的數(shù)據(jù)文件。reportwindow2days;schema;---報(bào)告數(shù)據(jù)庫模式報(bào)告已的備集(配保略)。unrecoverable;---報(bào)當(dāng)數(shù)庫不恢復(fù)數(shù)文(即沒有個(gè)據(jù)件的備份或該數(shù)據(jù)文件備份已經(jīng)過)report告要數(shù)文件(根據(jù)條件不)reportdays=3;--最近天沒有備的數(shù)據(jù)件如果出據(jù)將最近天的檔日志才能恢)needincremental=3;--需要多少增量備份文件才能恢復(fù)的數(shù)據(jù)文(如果出問題,這些數(shù)據(jù)文件將需個(gè)增備才恢)report--報(bào)出余次小于的數(shù)據(jù)文件--例數(shù)文件包2數(shù)文件system01.dbf和users01.dbf.--在次都次備都含system01.dbf這數(shù)據(jù)文而users01.dbf小于次--那,報(bào)出來數(shù)據(jù)件就是users01.dbf--,報(bào)告出據(jù)中余數(shù)于的數(shù)據(jù)文件reportwindow2days;--報(bào)告出恢需天檔日的數(shù)文件三backup常用命令總結(jié)備設(shè)份記backuptag='full_bak1';注:每個(gè)標(biāo)記必須唯一,相同的標(biāo)記可以用于多個(gè)備份只還原最新的備份。2.設(shè)份小(一次份所結(jié)為個(gè)份,要意份大backup注maxsetsize限定備份集大小。所以必須大數(shù)據(jù)庫總數(shù)據(jù)文件的大小,否則會(huì)報(bào)錯(cuò)。orcopylargerthanMAXSETSIZE:file#1/data/oradata/system01.dbf3.設(shè)置備片大小(磁帶文系限)run{allocatechanneltypemaxpicecsizeformatbackuptag='full_0';release}可以在子句中設(shè)定每個(gè)備份片的大,以達(dá)到磁帶或系統(tǒng)限制也以在中置片小channeldevicetypediskmaxpiecesize100m;configuretypeclear;備集策略forever;永備份文件backuptime='sysdate+30';--存?zhèn)浞萏熘豤onfigureexclude命令databasnoexcludetag='testbackup';查數(shù)據(jù)庫誤backup使來掃描數(shù)據(jù)庫的物理/邏輯錯(cuò)誤,并不執(zhí)行實(shí)際備份7.過脫機(jī),不可存取或只讀文件backupskipbackupskipbackupskipbackupskipoffline強(qiáng)制份backupforce;基上次備份時(shí)間備份數(shù)據(jù)文件1>只份添加的新數(shù)據(jù)文件notbacked2>備份"限時(shí)間期"有備的據(jù)文件backupuptime='sysdate-2';10.份操作期間查邏輯錯(cuò)誤database;validatechecklogical11.生成備副backupcopies=2;12.備份控制文deviceinclud四configure常令結(jié)忘4.1示當(dāng)前的置息RMAN>all;參為:CONFIGURERETENTIONPOLICYTOREDUNDANCY1;#defaultBACKUPOPTIMIZATIONOFF;#defaultCONFIGUREDEFAULTDEVICETODISK;#defaultCONFIGURECONTROLFILEdefaultCONTROLFILEFORDEVICETYPEDISK'%F';defaultCONFIGUREDEVICETYPEDISK1BACKUPTOdefaultCONFIGUREBACKUPCOPIESDEVICETYPEDISK1;defaultARCHIVELOGBACKUPCOPIESFORDEVICETYPEDISKTOMAXSETSIZEUNLIMITED;CONFIGUREENCRYPTIONFORDATABASEOFF;#defaultENCRYPTIONALGORITHM#defaultCONFIGUREARCHIVELOGDELETIONTO#CONFIGURESNAPSHOTNAMETO'D:/ORACLE/PRODUCT/10.2.0/DB_1/DATABASE/SNCFDBA.ORA';#default詢RMAN設(shè)置默值:SQL>from4.2.常用configure選4.2.1保存策略(retentionpolicy)recoverywindowofs;retentionpolicytoredundancy5;policyCONFIGURERETENTIONPOLICYTO第種recoverwindow是保持所有足夠備份將數(shù)庫系恢復(fù)最近天內(nèi)任意時(shí)刻。任何超最近七的據(jù)庫備將標(biāo)記為obsolete。第種redundancy是為了??梢曰值男碌姆輸?shù)據(jù)庫備,任何過新份的備份將被標(biāo)記為。的默認(rèn)值是份第三可以把使備保持策失,將復(fù)默認(rèn)的保持策一最安全的方法是采用第二種保持策略份化backupoptimizationbackupoptimizationconfigureoff;configure默認(rèn)值關(guān)閉,如果打,將備份的數(shù)據(jù)文件及歸檔等文件進(jìn)行一種優(yōu)化的算。4.2.3默設(shè)備defaultdefaultdevicetypedisk;devicetypestb;devicetype是定所有操的備類型是硬盤或磁帶,認(rèn)值是硬盤磁帶的置是DEFAULTDEVICETOSBT;4.3.4控文件controlfileautobackupon;configureautobackupformatfordevicetypedisktoconfigureautobackupformatdevicetypediskconfigruesnapshotcontrolfile是配置控制文件的快照文件的存放路徑和文件名,這個(gè)快照文件是在備份期間產(chǎn)生的,用于控制件的讀一致性。configruesnapshotcontrolfile強(qiáng)制數(shù)庫在備份文件者執(zhí)行改變數(shù)據(jù)庫構(gòu)的命令之后控制文件自備份值為關(guān)閉。這樣可以避免控制文件丟后,控制文件仍然可以恢復(fù)。4.3.5行(通數(shù))devicetypedisk|pallelismn;devicetypeconfiguredevicetypedisk|--用上的置configurechanneldevicetypeformat'e/:rmanback_%U';configuredevicetypeconfigurechanneldevicetyperate1200Kconfiguretypeformat'e/:rmanback_%U';configuretypeformat'e/:rmanback_%U';configuretype配數(shù)據(jù)庫設(shè)備型的并行度4.3.6生成備份副本archivelogbackupconfiguredatafilecopiesdeviceto3;configurearchivelogdevicedisk|stbto是設(shè)置數(shù)據(jù)庫的檔志存設(shè)類型configuredatafile|archivelogbackupdeviceBACKUPDEVICETYPEDISKDATABASEFORMAT是配置據(jù)庫的每次備的數(shù)的每一次備份都可以多份完全相同的貝。4.3.7排除項(xiàng)excludefortablespaceconfigrueexcludeclear;此命令用于將指的表空間不備份備份集,令對(duì)只讀表空間是非常有用的。4.3.8備份集大小maxsetsizeconfigureto1G|unlimited;configuremaxsetsizeclear;其它選項(xiàng)auxiliaryCONFIGUREFOR1TO'/oracle/auxfiles/aux_1.f';CONFIGUREFOR2TO'/oracle/auxfiles/aux_2.f';CONFIGUREFOR3TO'/oracle/auxfiles/aux_3.f';CONFIGUREFOR4TO'/oracle/auxfiles/aux_4.f';-CONFIGUREFORCLEAR;CONFIGUREFORCLEAR;CONFIGUREFORCLEAR;CONFIGUREFORCLEAR;五、令刪相關(guān)的備份集或鏡像副本的物理文件將刪除記到控制,如果使恢復(fù)目錄,則清除恢復(fù)目錄內(nèi)的份集。RMAN>deletebackupset;RMAN>deleteRMAN>;RMAN>deleteobsoleteredundancy2;RMAN>deletenopromptRMAN>deletenoprompttagTAG20101016T143521;RMAN>windowofRMAN>piredbackupset;RMAN>deletepiredcopy;RMAN>deletepiredarchivelogall;RMAN>

archiveloguntil'sysdate-5';六命令用檢驗(yàn)存儲(chǔ)倉庫中的備份集或鏡像副本行命令后將更新存儲(chǔ)倉庫中的剛校驗(yàn)的對(duì)狀態(tài),便于續(xù)操作處理份是種:pired:對(duì)象存于盤磁當(dāng)一個(gè)備份處狀則備集所備份片同處ex態(tài)Available:對(duì)處可狀態(tài)。當(dāng)個(gè)份可用則備集內(nèi)的所備片樣可。Unavailable:象處于不可用狀態(tài)。當(dāng)一個(gè)備份可不用,改備份集內(nèi)的所有份片同樣不可RMAN>crosscheckRMAN>;RMAN>backupofcontrolfile;RMAN>backupofall;RMAN>crosscheckbackupdatafile1,2;RMAN>crosscheckbackupofsysaux,syRMAN>backup'13-OCT-10'and'23-OCT-10';RMAN>第二部分rman備份實(shí)創(chuàng)創(chuàng)建用戶和表空間并授權(quán)SQL>rman'/u01/oracle/oradata/orcl/rman01.dbf'size5MAUTOEXTENDON5MMANAGEMENTSQL>rmanTEMPORARYtempTABLESPACEQUOTAONrman;SQL>GRANTrman;SQL>rman/rmanConnected.SQL>selectcount(*)fromuser_objects;0:創(chuàng)建恢復(fù)目錄~]$rmanRecoveryManager:10.2.0.1.0ProductiononFri06:22:3120161982,Allreserved.connectedtocatalogdatabaseSQL>rman/rmanConnected.SQL>selectcountfromuser_objects;195:連注冊(cè)數(shù)據(jù)庫,同步和控制文件修改數(shù)據(jù)庫的加標(biāo)段[oracle@directoradmin]$target/catalogrman/rman@orclRecoveryManager:10.2.0.1.0ProductiononFriMay2009:31:1420161982,Allreserved.totargetdatabase:TESTDB(DBID=2695394133)connectedtocatalogdatabaseRMAN>RMAN>DATABASE;inrecoverycatalogstartingfullrecoveryfullresynccompleteRMAN>RMAN>startingfullrecoveryfullresynccompleteRMAN>RMAN>ofDatabaseIncarnationsKeyDBDBIDResetSCNResetTime------------------------------------1844607515-MAY-161TESTDB57689117-MAY-16的增量備份和級(jí)備份Rman的份信在里有,在控制文件里面也存在一份Cd/u01/oracle/oradata/TestDBTestDB]$Catalog數(shù)庫里面有沒有呢*fromRC_BACKUP_CONTROLFILE_DETAILS;真開始一個(gè)零級(jí)備份backupincrementallevel0database;Startingbackupatchannel:ORA_DISK_1channelORA_DISK_1:sid=141channelstartingincrementallevel0datafilebackupsetchannelORA_DISK_1:ininputfno=00001name=/u01/oracle/oradata/TestDB/system01.dbfinputfno=00003inputname=/u01/oracle/oradata/TestDB/undotbs01.dbffno=00004pieceatchannel1atpiece160520T230822_cmzn96sl_.bkptag=TAG20160520T230822comment=NONEsetcomplete,elapsedtime:backupat20-MAY-16ControlFileandat20-MAY-16piece9_cmznbprw_.bkpFileandatRMAN>再來一增備份RMAN>incrementalStartingbackupatORA_DISK_1channelORA_DISK_1:startingincrementallevel1datafilebackupsetchannelORA_DISK_1:ininputfno=00001name=/u01/oracle/oradata/TestDB/system01.dbfname=/u01/oracle/oradata/TestDB/undotbs01.dbffno=00004pieceatchannelpiece1atpiece160520T231848_cmznws0l_.bkptag=TAG20160520T231848comment=NONEsetcomplete,elapsedtime:backupControlFileandat20-MAY-16pieceFileandatlistbackupset;比較下listbackupset;of===================TypeDeviceTypeElapsedTimeTime------------------------Full535.83MDISK00:00:5245Status:Compressed:Piece

Name:095248_cmy5okm6_.bkpDatafilesinset44LVTypeSCNTimeName--------------------636188/u01/oracle/oradata/TestDB/system01.dbf636188/u01/oracle/oradata/TestDB/undotbs01.dbf636188/u01/oracle/oradata/TestDB/sysaux01.dbf636188TypeDeviceTypeElapsedTimeTime------------------------FullDISK00:00:0161Status:Compressed:Piece

Name:/u01/oracle/flash_recovery_area/TESTDB/autobackup/2016_05_20/o1_mf_s_912333226_cmy5File636215Ckptime:Included:time:TypeDeviceTypeElapsedTimeTime----------------------------------106538.92MDISK00:00:4320-MAY-16109AVAILABLECompressed:Piece

Name:ListofDatafilesbackupset106LVTypeSCNTimeName--------------------1020-MAY-16/u01/oracle/oradata/TestDB/system01.dbf2020-MAY-163020-MAY-16/u01/oracle/oradata/TestDB/sysaux01.dbf4020-MAY-16TypeLVDeviceTimeCompletion------------------------118Full7.11M00:00:0220-MAY-16123AVAILABLECompressed:TAG20160520T230909Piece

Name:/u01/oracle/flash_recovery_area/TESTDB/autobackup/2016_05_20/o1_mf_s_912380949_cmznbFile661349Ckptime:Included:time:TypeLVDeviceTypeElapsedTimeTime------------------------1361DISK00:00:18139AVAILABLECompressed:TAG20160520T231848Piece

Name:ListofDatafilesbackupset136LVTypeSCNTimeName--------------------1120-MAY-16/u01/oracle/oradata/TestDB/system01.dbf2120-MAY-163120-MAY-16/u01/oracle/oradata/TestDB/sysaux01.dbf4120-MAY-16TypeDeviceTypeElapsedTimeTime------------------------150Full7.11M00:00:0120-MAY-16155AVAILABLECompressed:Piece

Name:/u01/oracle/flash_recovery_area/TESTDB/autobackup/2016_05_20/o1_mf_s_912381554_cmznxm2n_.bkpFile661778Ckptime:Included:time:RMAN>現(xiàn)在看系圖對(duì)比上面的備份我們已經(jīng)備份了如下內(nèi)數(shù)據(jù)件控文參數(shù)件口令件不備還差做日文歸檔志件沒備redolog無法備份Archivelog的備backupdatabasedatabaseplusarchivelogdeleteincrementalleveldatabaseplusarchivelogdeleteStartingbackupatcurrentlogarchivedORA_DISK_1ORA_DISK_1:archivelogchannelORA_DISK_1:archiveinbackupsetarchivesequence=1stamp=912070064archivesequence=2stamp=912071208archivesequence=3stamp=912071337archivesequence=4stamp=912071361archivesequence=5stamp=912315146archivesequence=6stamp=912315175archivesequence=7stamp=912384029pieceatchannelORA_DISK_1:finishedpiece1piece160521T000030_cmzqc001_.bkptag=TAG20160521T000030comment=NONEsetcomplete,elapsedtime:channeldeletingarchivelog(s)logfilename=/u01/oracle/flash_recovery_area/TESTDB/archivelog/2016_05_17/o1_mf_1_1_cmp4qhy7_.arcstamp=912070064log82d_.arcrecid=2stamp=912071208logfilename=/u01/oracle/flash_recovery_area/TESTDB/archivelog/2016_05_17/o1_mf_1_3_cmp5z9wc_.arcrecid=3stamp=912071337logrecid=4stamp=912071361log9h1_.arcrecid=5log72l_.arcrecid=6stamp=912315175logw70_.arcrecid=7stamp=912384029backupat21-MAY-16StartingbackupatORA_DISK_1channelORA_DISK_1:startingincrementallevel1datafilebackupsetchannelORA_DISK_1:ininputfno=00001inputfno=00003name=/u01/oracle/oradata/TestDB/undotbs01.dbffno=00004channelORA_DISK_1:1atchannel1atpiece160521T000035_cmzqc49t_.bkptag=TAG20160521T000035comment=NONEsetbackupat21-MAY-16StartingbackupatcurrentlogarchivedORA_DISK_1ORA_DISK_1:archivelogchannelORA_DISK_1:archiveinbackupsetarchivesequence=8stamp=912384060pieceatchannel1atpiece160521T000102_cmzqczp7_.bkptag=TAG20160521T000102comment=NONEsetcomplete,elapsedtime:channelORA_DISK_1:logwq4_.arcrecid=8stamp=912384060backupat21-MAY-16ControlFileandat21-MAY-16piececomment=NONEFileandat2016_05_172016_05_20[oracle@directorarchivelog]$cd[oracle@director2016_05_17]$[oracle@director2016_05_17]$2016_05_20-bash:directory[oracle@director..[oracle@directorarchivelog]$cd[oracle@director2016_05_20]$[oracle@director..[oracle@directorarchivelog]$cd[oracle@director2016_05_21]$[oracle@directorRMAN>分別份份表間reportListofDatafiles===========================RBsegs--------------------------------------------------------1480SYSTEMYES225UNDOTBS1YES3NO/u01/oracle/oradata/TestDB/sysaux01.dbf45USERSofTemporary=======================Tempfile---------------------------------------------------------------120TEMP

32767tablespaceusers;備份控文件currentcontrolfile;includecurrentcontrolfile;的集與reportListofDatafiles===========================RBsegs--------------------------------------------------------1480SYSTEMYES225UNDOTBS1YES3NO/u01/oracle/oradata/TestDB/sysaux01.dbf45USERSofTemporary=======================Tempfile---------------------------------------------------------------120TEMP

32767datafile4to'/u01/oracle/userbak.dbf';StartingbackupatORA_DISK_1startingcopyfno=00004outputtag=TAG20160521T002144recid=4stamp=912385305ORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:01backupat21-MAY-16ControlFileandat21-MAY-16pieceFinishedControlFileandSPFILEspecificationdoesnotarchivelogtherecoverycatalogofKeySTimeCkpSCNTimeName-----------------------------------------------391A663972/u01/oracle/userbak.dbfRMAN>Rman批令Formatofpiece’scopy%ddatabasename(1-31)位當(dāng)月那天month()of%F基于的唯一名稱

其一個(gè)序列1-256of8位,不8位側(cè)填充X字符出8位截andunzip組成一字符稱,可以每個(gè)備份集生成個(gè)唯一名稱%pbackup的編%U利用這可以為個(gè)份片段成個(gè)唯一稱最的名式%s號(hào)%tbackup%T月格(YYYYMMDD)舉例下RMAN>{>allocatechannel>channeltype>backuptagtablespace_backuptablespaceusers;>releasechannel>releasechannel>}channelchar1:channelchar2:Startingbackupatchar1:fullchannelchar1:specifyingbackupsetfno=00004piece1atchannel1atsetcomplete,elapsedtime:00:00:01backupat21-MAY-16ControlFileandat21-MAY-16piece4_cn0hd57m_.bkpFileandatchannel:channel:RMAN>backupofusers;of===================TypeDeviceTypeElapsedTime------------------------Full535.83MDISK00:00:5220-MAY-1645Status:Compressed:Piece

Name:095248_cmy5okm6_.bkpDatafilesinset44LVTypeSCNTimeName--------------------4636188TypeDeviceTypeElapsedTimeTime------------------------458Full432.00KDISK00:00:00461AVAILABLECompressed:PieceName:/u01/oracle/backup/full_0jr64g21_1_1ListofDatafilesbackupset458LVTypeSCNTimeName--------------------468130121-MAY-16寫成樣是以RMAN>run{>channeltypebackuptablespaceusersformat"/u01/oracle/backup/full_%U"tablespace_backup;>releasechannel>}總實(shí)戰(zhàn)[oracle@directorscripts]$catlevel0runbackupincrementallevel0'/u01/oracle/backup/inc0_%u_%T'monday_inc0channelc1;channelc2;}[oracle@directorscripts]$catlevel1runbackupincrementallevel1'/u01/oracle/backup/inc1_%u_%T'tagwensday_inc1channelc1;channelc2;}[oracle@directorscripts]$catlevel2runbackuptagdays_inc2channelc1;channelc2;}[oracle@directorscripts]$oracle@directorscripts]$755*[oracle@directortotal12-rwxr-xr-x.1oracleoinstall20307:26level0-rwxr-xr-x.1oracleoinstall20407:33level1-rwxr-xr-x.1oracleoinstall20107:34level2[oracle@directorscripts]$執(zhí)行本[oracle@directorscripts]$rmantarget/catalogrman/rman@orclmsglog=/u01/oracle/backup/backl0.logcmdfile=/u01/oracle/scripts/level0實(shí)現(xiàn)自備份[root@director]#crontab-e-u2010**6/u01/oracle/scripts/full_backup.sh25*6/u01/oracle/scripts/arch_backup.sh00**/u01/oracle/scripts/maintenance.shscripts]#[root@directorscripts]#[oracle@directorscripts]$full_backup.shmaintenance.rmanarch_backup.shmaintenance.shcron.txtlevel1full_backup.rman[root@directorscripts]#catmaintenance.shsuoracle"rman/cmdfile=/rman/rman_script/maintenance.rman[root@directorscripts]#full_backup.shsu-oracle"rman/log=/u01/oracle/rmanlog/rman_full.log[root@directorscripts]#catarch_backup.shsuoracle"rman/rman/rman@orcllog=/u01/oracle/rmanlog/rman_arch.log[root@directorscripts]#catfull_backup.rmanrun{backupincrementallevel0'/u01/oracle/backup/inc0_%u_%T'monday_inc0backuparchivelogdeleteinput;channelc1;channelc2;}[root@directorscripts]#catrun{backupincrementallevel1'/u01/oracle/backup/inc1_%u_%T'tagwensday_inc1archivelogall'/u01/oracle//backup/arch_%d_%T_%s_%p'deleteinput;currentcontrolfilechannelc1;channelc2;}[root@directorscripts]#allocateformaintenancetypecrosscheckarchivelogcrosscheckbackupset;deletechannel;[root@directorscripts]#

第三部分

rman恢復(fù)實(shí)戰(zhàn)1,丟失[oracle@directororapwdUsage:orapwdforce=<y/n>file-ofpasswordfile(mand),passwordSYS(mand),entriesofdistinctDBAandwhetheroverwriteOPERs(opt),noaroundtheequal-to(=)2,文件丟shutdownimmediatecloseddatabasedismountedOracleinstanceRMAN>startupconnectedstartupfailed:failureprocessingLRM-00109:couldparameterfilestartinginstanceparameterfileretrivalofspfilestartedSystemArea159383552bytesFixedSize1218268bytes54528292bytes100663296bytes2973696bytesRMAN>注這里是的能startupfailureprocessingLRM-00109:couldparameterfileSql就無做這一RMAN>setdbid2695394133;executingdatabaseis"TESTDB"and2695394133RMAN>RMAN>restorespfileStartingrestorechannel:ORA_DISK_1channelORA_DISK_1:channel:ORA_DISK_2channelORA_DISK_2:ORA_DISK_1:lookingforautobackuponday:20160521ORA_DISK_1:lookingforautobackuponday:20160520ORA_DISK_1:lookingforautobackuponday:20160519ORA_DISK_1:lookingforautobackuponday:20160518ORA_DISK_1:lookingforautobackuponday:20160517ORA_DISK_1:lookingforautobackuponday:ORA_DISK_1:lookingforautobackuponday:20160515noin7daysfoundORA_DISK_2:lookingforautobackuponday:20160521lookingforautobackuponday:ORA_DISK_2:lookingforautobackuponday:20160519ORA_DISK_2:lookingforautobackuponday:20160518ORA_DISK_2:lookingforautobackuponday:20160517forautobackuponday:ORA_DISK_2:lookingforautobackuponday:20160515noin7daysfoundRMAN-00571:===============ERRORMESSAGESTACKFOLLOWS===============RMAN-00571:RMAN-03002:failureofrestorecommandat22:31:37foundhandlenotacopyRMAN>RMAN>restorespfilefromStartingrestoreORA_DISK_1ORA_DISK_2ORA_DISK_2:skipped,foundORA_DISK_1:autobackup/u01/oracle/flash_recovery_area/TESTDB/autobackup/2016_05_21/o1_mf_s_912421544_cnchannelORA_DISK_1:SPFILErestorecompleteFinishedatRMAN>shutdownimmediateOracleinstancestartupconnectedstartedmounteddatabaseSystemArea285212672bytesFixedSize1218992bytes104859216bytes176160768bytes2973696bytesRMAN>2,丟失StartupnomountRestorefromautobackupAlterdatabasemountdatabaseAlterdatabaseresetlogscontrol01.ctlsysaux01.dbfundotbs01.dbfcontrol02.ctlusers01.dbfcontrol03.ctl[oracle@directorcontrol0*/home/oracleTestDB]$lsundotbs01.dbfusers01.dbfTestDB]$target/catalogRecoveryManager:10.2.0.1.0ProductiononSatMay22:46:0920161982,Allreserved.RMAN-00571:===============ERRORMESSAGESTACKFOLLOWS===============RMAN-00571:===========================================================RMAN-00554:initializationofinternalpackagefailedRMAN-06003:ORACLEerrortargetcannotcontrolfileORA-00202:file:toopenLinuxError:2:NosuchfileordirectoryAdditionalinformation:3[oracle@directorsqlplus/May212016(c)1982,Oracle.Allreserved.Connectedto:OracleDatabaseEnterpriseRelease-ProductiontheOLAPandDataoptionsshutdowncannotcontrolfileORA-00202:file:'/u01/oracle/oradata/TestDB/control01.ctl'toopenLinuxError:2:NosuchfileordirectoryAdditionalinformation:3SQL>shutdowninstanceshutdown.startupnomount;instancestarted.SystemArea285212672bytesFixedSizebytes104859216bytes176160768bytes2973696bytestargetcatalogRecoveryManager:10.2.0.1.0ProductionMay211982,Allreserved.connectedTestDBmounted)connectedtocatalogdatabaseRMAN>RMAN>fromautobackup;Startingrestorechannel:ORA_DISK_1channelORA_DISK_1:sid=156channel:ORA_DISK_2channelORA_DISK_2:sid=155areadestination:name)forTESTDBautobackupfoundinrecoveryareadestination:(oruniquename)usedforsearch:TESTDBautobackupfoundinrecoveryORA_DISK_1:skipped,foundORA_DISK_2:autobackup/u01/oracle/flash_recovery_area/TESTDB/autobackup/2016_05_21/o1_mf_s_912421544_cnchannelcontrolfilerestorefromoutputoutputoutputFinishedatRMAN>TestDB]$lscontrol01.ctlcontrol02.ctlredo02.logredo03.logsysaux01.dbfusers01.dbfaltermountedchannel:channel:RMAN>alterdatabaseopen;RMAN-00571:===============ERRORMESSAGESTACKFOLLOWS===============RMAN-00571:failureofalterat22:51:35ORA-01589:mustuseoroptionfordatabaseopenalterdatabaseopenresetlogs;RMAN-00571:==========================================================================ERRORMESSAGESTACKFOLLOWS===============RMAN-00571:failureofalterat22:51:49ORA-01194:file1moretobeORA-01110:file1:RMAN>RMAN>recoverStartingimplicitcrosscheckbackupat21-MAY-16channelORA_DISK_1:sid=155channel:ORA_DISK_2channelORA_DISK_2:sid=156Crosschecked7objectsbackupat21-MAY-16implicitatORA_DISK_1ORA_DISK_2copysearchingforinrecoverycatalogingdoneofCataloged=======================Name:/u01/oracle/flash_recovery_area/TESTDB/autobackup/2016_05_21/o1_mf_s_912421544_cnORA_DISK_1ORA_DISK_2startingmedialogthread118isalreadyasarchivefilename=/u01/oracle/oradata/TestDB/redo02.logmediarecoverycomplete,time:00:00:02Finishedrecoverat21-MAY-16alterdatabaseopenresetlogs;databasedatabasestartingfullcatalogfullresynccompleteRMAN>backupdatabase;StartingbackupatORA_DISK_1ORA_DISK_2ORA_DISK_1:fulldatafilechannelinbackupsetinputfno=00001name=/u01/oracle/oradata/TestDB/system01.dbffno=00004pieceatORA_DISK_2:startingchannelORA_DISK_2:ininputfno=00003name=/u01/oracle/oradata/TestDB/undotbs01.dbfpieceatfile丟失ShutdownimmediateStartup下面兩條令sql下執(zhí)行RecoveruntilcancelAlterresetlogs;[oracle@directorTestDB]$rmTestDB]$lscontrol01.ctlsystem01.dbfcontrol02.ctlusers01.dbfrmancatalogrman/rman@orclManager:Release2122:59:08(c)1982,Oracle.reserved.totargetdatabase:TESTDB(DBID=2695394133)connectedtocatalogdatabaseshutdownimmediatecloseddatabasedismountedOracleinstancestartupconnectedtostartedmountedRMAN-00571:===============ERRORMESSAGESTACKFOLLOWS===============RMAN-00571:failureofstartupat22:59:56ORA-00313:failedformembersofgroup1ofthread1log1thread1:'/u01/oracle/oradata/TestDB/redo01.log'RMAN>startupconnectedstartedmountedSystemArea285212672bytesFixedSize1218992bytes109053520bytes2973696bytesalterdatabaseopenresetlogs;RMAN-00571:RMAN-00569:===============ERRORMESSAGESTACKFOLLOWS===============RMAN-00571:failureofalterat23:02:25ORA-01139:RESETLOGSoptionvalidafteranincompletedatabaseRMAN>databaseuntilcancel;RMAN-00571:===============ERRORMESSAGESTACKFOLLOWS===============RMAN-00571:errorwhileparsingsyntaxerror:"cancel":expectingof:"logseq,scn,time"at1column24RMAN-00571:===============ERRORMESSAGESTACKFOLLOWS===============RMAN-00571:errorparsingcommandserror:foundonebackup,beginline,create,crosscheck,configure,delete,drop,exit,endinline,flashback,host,{,mount,open,recover,release,replace,report,resync,run,set,sql,switch,startup,shutdown,send,validate"at1column30RMAN>現(xiàn)在回到sqlplus/assysdbaMay2120161982,Allreserved.Connectedto:OracleDatabaseEnterpriseRelease-ProductiontheOLAPandDataoptionsrecoverdatabasecancel;complete.alteropenresetlogs;altered.趕緊去個(gè)備4,丟失Sqldatafile4offline4注下面這條命令在面執(zhí)行Sqldatafile4onlineTestDB]$-frusers01.dbfTestDB]$lscontrol01.ctlsysaux01.dbfundotbs01.dbfcontrol02.ctlsystem01.dbfcontrol03.ctlTestDB]$sql"alterdatafile4offline"alterdatafile4offlineRMAN>datafile4;Startingrestorechannel:ORA_DISK_1channelORA_DISK_1:sid=143channel:ORA_DISK_2channelORA_DISK_2:sid=159channelstartingdatafilebackupsetrestoredatafile(s)torestorefrom00004/u01/oracle/oradata/TestDB/users01.dbfORA_DISK_1:readingfrombackupORA_DISK_1:restoredpiece1piecehandle=/u01/oracle/flash_recovery_area/TESTDB/backupset/2016_05_21/o1_mf_nnndf_TAG20160521T231032_cn28s8l5_.bkptag=TAG20160521T231032complete,elapsedtime:00:00:02Finishedatdatafile4online;alterdatabasedatafile4*at1:file4mediaORA-01110:datafile4:'/u01/oracle/oradata/TestDB/users01.dbf'SQL>recoverdatafilecomplete.SQL>alterdatabasedatafile4online;altered.5,丟失“alterusersimmediate可在直行命tablespaceuserstablespaceusers”;createhahaidentifiedhahatablespaceUsercreated.SQL>tohaha;SQL>Connected.createtabletab1int,namevarchar(32));created.SQL>into1rowSQL>selectowner,table_n

溫馨提示

  • 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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論