这篇文章主要介绍了怎么恢复在全备后添加了数据文件的数据库,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

参考
How to Recover a Database Having Added a Datafile Since Last Backup (文档 ID 29430.1)

HOWTORECOVERADATABASEHAVINGADDEDADATAFILESINCETHELASTBACKUP-----------------------------------------------------------------------Thisbulletinoutlinesthestepsrequiredinperformingdatabaserecoveryhavingaddedadatafiletothedatabasesincethelastbackupwastaken.SectionAisapplicabletoOraclerelease7.x.SectionBappliesonlytoOraclereleases7.3.xandabove.PLEASEREADTHROUGHALLSTEPSANDWARNINGSBEFOREATTEMPTINGTOUSETHISBULLETIN.A.Currentcontrolfile,backupofdatafileexists(Oraclerelease7.x)===================================================================Avalid(eitherhotorcold)backupofthedatafilesexists,exceptforthedatafilecreatedsincethebackupwastaken.Thecurrentcontrolfileexists.Thedatabaseisinarchivelogmode(seenote(c)atbottomofpage).1.RestoreONLYthedatafiles(thosethathavebeenlostordamaged)fromthelasthotorcoldbackup.Thecurrentonlineredologsandcontrolfile(s)mustbeintact.2.Mountthedatabase3.Createanewdatafileusingthe'ALTERDATABASECREATEDATAFILE'command.a.Thedatafilecanbecreatedwiththesamenameastheoriginalfile.Forexample,SQLDBA>alterdatabasecreatedatafile2>'/dev1/oracle/dbs/testtbs.dbf';Statementprocessed.b.Thedatafilecanbecreatedwithadifferentfilenametotheoriginal.Thisoptionmightbechoseniftheoriginalfilewaslostduetodiskfailureandthefaileddiskwasstillunavailable;thenewfilewouldthenbecreatedonadifferentdevice.Forexample,SQLDBA>alterdatabasecreatedatafile2>'/dev1/oracle/dbs/testtbs.dbf'3>as4>'/dev2/oracle/dbs/testtbs.dbf';Statementprocessed.Theabovecommandcreatesanewdatafileonthedev2device.Thefileiscreatedusinginformation,storedinthecontrolfile,fromtheoriginalfile.Thecommandimplicitlyrenamesthefilenameinthecontrolfile.NOTE:ITISVERYIMPORTANTTOSPECIFYTHECORRECTFILENAMEWHENRECREATINGTHELOSTDATAFILE.IFYOUSPECIFYANEXISTINGORACLEDATAFILE,THATDATAFILEWILLBEINITIALISEDANDWILLITSELFREQUIRERECOVERY.4.Recoverthedatabase.SQLDBA>recoverdatabaseORA-00279:Change6677generatedat06/03/9715:20:24neededforthread1ORA-00289:Suggestion:/dev1/oracle/dbs/arch/arch000074.arcORA-00280:Change6677forthread1isinsequence#74Specifylog:{=suggested|filename|AUTO|CANCEL}Atthispointtherecoveryprocedurewillwaitfortheusertosupplytheinformationrequestedregardingthenameandlocationofthearchivedlogfiles.Forexample,enteringAUTOdirectsOracletoapplythesuggestedredologandanyothersthatitrequirestorecoverthedatafiles.Applyingsuggestedlogfile...Logapplied.::::Mediarecoverycomplete.5.OpenthedatabaseSQLDBA>alterdatabaseopen;Statementprocessed.B.Oldcontrolfile,nobackupofdatafile(Oraclerelease7.3.xandabove)=======================================================================Avalid(eitherhotorcold)backupofthedatafilesexists,exceptforthedatafilecreatedsincethebackupwastaken.Thecontrolfileisabackupfrombeforethecreationofthenewdatafile.Thedatabaseisinarchivelogmode(seenote(c)atbottomofpage).NOTE:'svrmgrl'hasbeenreplacedbySQL*PlusstartingfromOracle8iSothe'SVRMGR>'promptisthanreplacedby'SQL>'1.Restorethedatafiles(thosethathavebeenlostordamaged)fromthelasthotorcoldbackup.Alsorestoretheoldcopyofthecontrolfile.Thecurrentonlineredologsmustbeintact.2.Mountthedatabase3.Startmediarecovery,specifyingbackupcontrolfileSVRMGR>recoverdatabaseusingbackupcontrolfileORA-00279:Change6677generatedat06/03/9715:20:24neededforthread1ORA-00289:Suggestion:/dev1/oracle/dbs/arch/arch000074.arcORA-00280:Change6677forthread1isinsequence#74Specifylog:{=suggested|filename|AUTO|CANCEL}Atthispoint,applythearchivedlogsasrequested.EventuallyOraclewillencounterredotobeappliedtothenon-existentdatafile.Therecoverysessionwillexitwiththefollowingmessage,andwillreturntheusertotheServerManagerprompt:ORA-00283:RecoverysessioncanceledduetoerrorsORA-01244:unnameddatafile(s)addedtocontrolfilebymediarecoveryORA-01110:datafile5:'/dev1/oracle/dbs/testtbs.dbf'4.Recreatethemissingdatafile.Todothis,selecttherelevantfilenamefromv$datafile:SVRMGR>selectnamefromv$datafilewherefile#=5;NAME-------------------------------------------------------UNNAMED0005Nowrecreatethefile:SVRMGR>alterdatabasecreatedatafile2>'UNNAMED0005'3>as4>'/dev1/oracle/dbs/testtbs.dbf';5.RestartrecoverySVRMGR>recoverdatabaseusingbackupcontrolfileORA-00279:Change6747generatedat09/24/9716:57:18neededforthread1ORA-00289:Suggestion:/dev1/oracle/dbs/arch/arch000079.arcORA-00280:Change6747forthread1isinsequence#79Specifylog:{=suggested|filename|AUTO|CANCEL}Applyarchivedlogsasrequested.PriortoOracle8,recoverymustapplythecompletelogwhichwascurrentatthetimeofthedatafilecreation(intheaboveexample,thiswouldbelogsequence79).Arecoverytoapointintimebeforetheendofthislogwouldresultinerrors:ORA-01196:file1isinconsistentduetoafailedmediarecoverysessionORA-01110:datafile1:'/dev1/oracle/dbs/systbs.dbf'Ifthishappens,re-recoverthedatabaseandensurethatthecompletelogisapplied(plusanyfurtherredoifrequired).ThislimitationdoesnotexistfromOracle8.0+.Eventually,Oraclewillrequestthearchivedlogcorrespondingtothecurrentonlinelog.Itdoesthisbecausethe(backup)controlfilehasnoknowledgeofthecurrentlogsequence.Ifanattemptismadetoapplythesuggestedlog,therecoverysessionwillexitwiththefollowingmessage:ORA-00308:cannotopenarchivedlog'/dev1/oracle/dbs/arch/arch000084.arc'ORA-07360:sfifi:staterror,unabletoobtaininformationaboutfile.SVR4Error:2:NosuchfileordirectoryAtthisstage,simplyrestarttherecoverysessionandapplythecurrentonlinelog.ThebestwaytodothisistotryapplyingtheonlineredologsonebyoneuntilOraclecompletesmediarecovery:SVRMGR>recoverdatabaseusingbackupcontrolfileORA-00279:Change6763generatedat09/24/9716:57:59neededforthread1ORA-00289:Suggestion:/dev1/oracle/dbs/arch/arch000084.arcORA-00280:Change6763forthread1isinsequence#84Specifylog:{=suggested|filename|AUTO|CANCEL}/dev1/oracle/dbs/log2.dbfLogapplied.Mediarecoverycomplete.6.OpenthedatabaseSVRMGR>alterdatabaseopenresetlogs;Theresetlogsoptionmustbechosentoresynchronizethecontrolfile.NOTES:======a)Thesetechniquescanbeusedwhetherthedatabasewasclosedeithercleanlyoruncleanly(aborted).b)Ifthedatabaseisrecoveredusinganincompleterecoverytechnique(eithertime-based,cancel-based,orchange-based),andisrecoveredtoapointintimebeforethedatafilewasoriginallycreated,anyreferencestothatdatafilewillberemovedfromthedatabasewhenthedatabaseisopened.Oraclehandlesthissituationasfollows:-The'alterdatabasecreatedatafile....'commandcreatesareferenceinthecontrolfileforthedatafile.-Incompleterecoveryterminatesbeforeapplyingredothatwouldcreateacorrespondingrowforthedatafileinthefile$dictionarytable.-Whenthedatabaseisopened,Oracledetectsaninconsistencybetweenfile$andthecontrolfileandresolvesinfavouroffile$,deletingtheentryfromthecontrolfile.c)Itmaybepossibletorecoverthedatafileusingthistechniqueevenifthedatabaseisnotinarchivelogmode.However,thisreliesontherequiredredobeingavailableintheonlineredologs.

感谢你能够认真阅读完这篇文章,希望小编分享的“怎么恢复在全备后添加了数据文件的数据库”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!