




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 水产品采购合同范本
- 融资租赁合同本模板
- 2025企业采购代理合同协议示范文本
- 2025年海口年货运从业资格证考试试题
- 主材大包合同标准文本
- 保底扣合同标准文本
- 写给妈妈的一封信(7篇)
- 乙方租房东合同标准文本
- 企业股权期权合同标准文本
- 企业废钢收购合同标准文本
- 2024年第四季度 国家电网工程设备材料信息参考价
- (八省联考)内蒙古2025年高考综合改革适应性演练 化学试卷(含答案逐题解析)
- 化验室用气瓶管理制度(3篇)
- 工业园物业服务项目管理规章制度
- 工程力学 第5版 课件 第2章 平面力系
- 签医废合同申请书
- 金融门店经理竞聘
- 《步进式抛雪机》
- 手术室无菌技术原则和操作
- 南京理工大学泰州科技学院《电路》2022-2023学年第一学期期末试卷
- 2023年中央戏剧学院招聘考试真题
评论
0/150
提交评论