Oracle英文版培训课件之Backup and Recovery:Les-05-flashback_第1页
Oracle英文版培训课件之Backup and Recovery:Les-05-flashback_第2页
Oracle英文版培训课件之Backup and Recovery:Les-05-flashback_第3页
Oracle英文版培训课件之Backup and Recovery:Les-05-flashback_第4页
Oracle英文版培训课件之Backup and Recovery:Les-05-flashback_第5页
已阅读5页,还剩36页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

UsingOracleFlashbackTechnologiesObjectivesAftercompletingthislesson,youshouldbeableto:UseFlashbackDroptorecoveradroppedtableUseFlashbackQuerytoviewthecontentsofthedatabaseasofanysinglepointintimeUseFlashbackVersionsQuerytoviewversionsofarowovertimeUseFlashbackTransactionQuerytoviewtransactionhistoryofarowUseFlashbackTabletorestorethecontentsofatabletoaspecificpointinthepastConfigureFlashbackDatabasePerformFlashbackDatabasetoapointintimeUsingOracleFlashbackTechnologyFALSEUndodataTransactionInvestigateseveralhistoricalstatesofdataTxFALSEUndodataVersionCompareversionsofarowFALSEUndodataQueryComparecurrentdatawithdatafromthepastUndodataRecyclebinFlashbacklogsUsesTableDatabaseObjectLevelTRUEDatabaseTruncatetable;UndesiredmultitablechangesmadeTRUETableUpdatewiththewrongWHEREclauseDropFlashback

TechnologyTRUEDroptableAffects

DataScenarioExamplesFlashbackDropandtheRecycleBinDropatableRealizeamistakewasmadeRECYCLEBIN=ONDROPTABLEemployees;FLASHBACKTABLE

employees

TOBEFOREDROP;UnderstandingtheRecycleBinDROPTABLEemployees;BIN$zbjra9wy==$0EMPLOYEES_PKEMPLOYEESRecycle

binBIN$zbjrBdpw==$0USER_OBJECTSBIN$zbjrBdpw==$0EMPLOYEES

BIN$zbjra9wy==$0EMPLOYEES_PKObjectsare:RenamedNotmovedDBA_FREE_SPACERestoringTablesfromtheRecycleBinRestoredroppedtablesanddependentobjects.IfmultipleRecycleBinentrieshavethesameoriginalname:Useunique,system-generatednamestorestoreaparticularversionTherestoredtableislastin,firstout(LIFO)Renametheoriginalnameifthatnameiscurrentlyused.FLASHBACKTABLEtable_name

TOBEFOREDROP[RENAMETOnew_name];AutomaticSpaceReclamationintheRecycleBinBIN$zbjrBdpw==$0

BIN$zbjra9wy==$0

BIN$zbjra9wy==$0BIN$zbjrBdpw==$0123RecyclebinDBA_FREE_SPACE-RECYCLEBINAutoextendManualSpaceReclamationintheRecycleBinPURGE{TABLEtable_name|INDEXindex_name}PURGETABLESPACEts_name[USERuser_name]PURGE[USER_|DBA_]RECYCLEBINBypassingtheRecycleBinDROPTABLESPACEts_name

[INCLUDINGCONTENTS];DROPUSERuser_name[CASCADE];DROPTABLEtable_name[PURGE];QueryingtheRecycleBinSELECTowner,original_name,object_name,type,ts_name,droptime,related,spaceFROMdba_recyclebinWHEREcan_undrop='YES';SELECToriginal_name,object_name,type,ts_name,droptime,related,spaceFROMuser_recyclebinWHEREcan_undrop='YES';SQL>SHOWRECYCLEBINQueryingDatainDroppedTablesSELECT...FROM"BIN$zbjrBdpw==$0"WHERE...Recycle

binUSER_INDEXESYESINDEX_NAMEDROPPEDNOSALES_PKUSER_TABLESTABLE_NAMEDROPPEDYESNOSALESBIN$zbjrBdpw==$0EMPLOYEES

BIN$zbjra9wy==$0EMPLOYEES_PKUsingFlashbackTechnologytoQueryDataFlashbackQueryQueryalldataataspecifiedpointintime.FlashbackVersionsQuerySeeallversionsofarowbetweentwotimes.Seethetransactionsthatchangedtherow.FlashbackTransactionQuerySeeallchangesmade

byatransaction.Tx3Tx1Tx2TimeFlashbackConfiguringUndoforFlashbackSYSTEMtablespaceUNDOTBS1tablespaceUNDO_RETENTIONinitializationparameterFlashbackQuery:Overviewt1t2SELECTemployee_id,salaryFROMemployeesASOFTIMESTAMP<t1>WHEREemployee_id=200EmployeesEmployeesUnwanted

updatesUsetoqueryalldataataspecifiedpointintime.FlashbackQuery:Example11:0011:10UPDATEemployeesSETsalary=(SELECTsalaryFROMemployeesASOFTIMESTAMPTO_TIMESTAMP('2005-05-04

11:00:00',

'yyyy-mm-dd

hh24:mi:ss')WHEREemployee_id=200)WHEREemployee_id=200EmployeesEmployeessalary=4,400Employeessalary=4,400salary=4,840FlashbackVersionsQuery:Overviewt1t2Tx1Tx2SELECTversions_xid,salaryFROMemployeesVERSIONSBETWEENTIMESTAMP<t1>and<t2>WHEREemployee_id=200;Tx0Tx0Tx1Tx2EmployeesEmployeesEmployees200UsingEnterpriseManagertoPerform

FlashbackVersionsQueryFlashbackVersionsQuery:ConsiderationsTheVERSIONSclausecannotbeusedtoquery:ExternaltablesTemporarytablesFixedtablesViewsTheVERSIONSclausecannotspanDDLcommands.Segmentshrinkoperationsarefilteredout.FlashbackTransactionQuery:OverviewUndo

SQLFLASHBACK_TRANSACTION_QUERYDBAUserErroneous

DMLUsingEnterpriseManagertoPerform

FlashbackTransactionQueryFlashbackTransactionQuery:ConsiderationsDDLcommandsareseenasdictionaryupdates.Droppedobjectsappearasobjectnumbers.Droppedusersappearasuseridentifiers.FlashbackTable:OverviewFlashbackTablerecoverstablestoaspecificpointintime.FlashbackTableisanin-placeoperation.Thedatabasestaysonline.UserErroneous

DMLsFlashedback

tablesFlashbackTableUsingFlashbackTable,youcanrecoveratableortablestoaspecificpointintimewithoutrestoringabackup.DataisretrievedfromtheundotablespacetoperformaFlashbackTableoperation.TheFLASHBACK

TABLEprivilegeisrequiredtoflashbackatable.Rowmovementmustbeenabledonthetablethatyouareperformingtheflashbackoperationon.EnablingRowMovementonaTableALTERTABLEemployeesENABLEROWMOVEMENT;PerformingFlashbackTableFLASHBACKTABLEhr.employeesTOTIMESTAMP TO_TIMESTAMP('2005-05-05

05:32:00', 'YYYY-MM-DD

HH24:MI:SS');FlashbackTable:ConsiderationsTheFLASHBACK

TABLEcommandexecutesasasingletransaction,acquiringexclusiveDMLlocks.Statisticsarenotflashedback.Currentindexesanddependentobjectsaremaintained.FlashbackTableoperations:CannotbeperformedonsystemtablesCannotspanDDLoperationsGenerateundoandredodataFlashbackDatabase:OverviewTheFlashbackDatabaseoperation:WorkslikearewindbuttonforthedatabaseCanbeusedincasesoflogicaldatacorruptionsmadebyusersThedatabaseiscorrupted.Thedatabaseis“rewound.”FlashbackDatabase:You“pressthe

rewindbutton.”Usersgenerateerrors.FlashbackDatabaseArchitectureFlashback

bufferRedolog

bufferSGALGWRRVWRFlashback

logsRedo

logs……Buffercache1Logblock

before

images

periodically.Backoutchanges

todatabaseusingbeforeimages.Doforwardmediarecovery.

Every

change2ConfiguringFlashbackDatabase1.ConfiguretheFlashRecoveryArea.3.EnableFlashbackDatabase.2.Settheretention

target.SQL>SHUTDOWNIMMEDIATE;SQL>STARTUPMOUNTEXCLUSIVE;SQL>ALTERSYSTEMSET 2 DB_FLASHBACK_RETENTION_TARGET=2880SCOPE=BOTH;SQL>ALTERDATABASEFLASHBACKON;SQL>ALTERDATABASEOPEN;UsingEnterpriseManagertoConfigure

FlashbackDatabaseEnableflashbackloggingandspecifytheFlashRecoveryArea.FlashbackDatabase:ExamplesRMAN>FLASHBACKDATABASETOTIME=2>"TO_DATE('2004-05-2716:00:00',3>'YYYY-MM-DDHH24:MI:SS')";RMAN>FLASHBACKDATABASETOSCN=23565;RMAN>FLASHBACKDATABASE2>TOSEQUENCE=223THREAD=1;SQL>FLASHBACKDATABASE2TOTIMESTAMP(SYSDATE-1/24);SQL>FLASHBACKDATABASETOSCN53943;SQL>FLASHBACKDATABASETORESTOREPOINTb4_load;UsingEnterpriseManagertoPerform

FlashbackDatabaseSelecttheobjectandoperationtype.UsingEnterpriseManagertoPerform

FlashbackDatabaseStartingtheRecoveryWizard:UsingEnterpriseManagertoPerform

FlashbackDatabaseFlashbackDatabaseConsiderationsWhentheFlashbackDatabaseoperationcompletes,openthedatabase:Inread-onlymodetoverifythatthecorrecttargettimeorSCNwasusedWithaRESETLOGSoperationtoallowforDMLYoucannotuseFlashbackDatabaseinthefollowingsituations:Thecontrolfilehasbeenrestoredorre-created.Atablespacehasbeendropped.Adatafilehasbeenshrunk.UsetheTOBEFORERESETLOGStoflashbacktobeforethelastRESETLOGSoperation.MonitoringFlashbackDatabaseTomonitortheabilitytomeetyourretentiontarget:ViewtheFlashRecoveryAreadiskquota:Determinethecurrentflashbackwindow:

MonitorloggingintheFlashbackDatabaselogs:SQL>SELECTestimated_flashback_size,2flashback_size

3FROMv$flashback_database_log;SQL>SELECT*

2FROMv$flashback_database_stat;SQL>SELECToldest_flashback_scn,2oldest_flashback_time3FROMv$flashback_database_log;MonitoringFlashbackDatabase(continued)

(notesonlyslide)MonitoringFlashbackDatabaseTuningConsiderationsforFlashbackDatabasePerformanceoverheadisapproximately2%.Sequentialandoften,bulkwritesareusedforwritingflashbackdata.Inwell-configuredsystems,noprocessneedstowaitforwritingofflashbacklogs.Bestpractices:UseafastfilesystemfortheFlashRecoveryArea,preferablywithoutoperatingsystemfilecaching.ConfigureenoughdiskspindlesforthefilesystemthatholdstheFlashRecoveryArea.Configurethefilesystemontopofstripedstoragevolumes,witharelativelysmallstripesizesuchas128KB.Forlarge,productiondatabases,settheLOG_BUFFERinitializationparametertoatleast8MB.TuningConside

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论