11g新特性之flashback课件_第1页
11g新特性之flashback课件_第2页
11g新特性之flashback课件_第3页
11g新特性之flashback课件_第4页
11g新特性之flashback课件_第5页
已阅读5页,还剩31页未读 继续免费阅读

下载本文档

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

文档简介

FlashbackTechnology,LogMiner,andDataPumpEnhancements.ObjectivesAftercompletingthislesson,youshouldbeableto:UseFlashbackDataArchivetocreate,protect,andusehistorydataPrepareyourdatabaseCreate,change,anddropaflashbackdataarchiveViewflashbackdataarchivemetadataUseFlashbackTransactionBackoutSetupFlashbackTransactionprerequisitesQuerytransactionswithandwithoutdependenciesChoosebackoutoptionsandflashbacktransactionsUseEnterpriseManagerLogMinerUseDataPumplegacymode.FlashbackDataArchive:OverviewTransparentlytrackshistoricalchangestoallOracledatainahighlysecureandefficientmanner:“Secure”NopossibilitytomodifyhistoricaldataRetainedaccordingtoyourspecificationsAutomaticallypurgedbasedonyourretentionpolicy“Efficient”SpecialkerneloptimizationstominimizeperformanceoverheadofcapturinghistoricaldataStoredincompressedformintablespacestominimizestoragerequirementsCompletelytransparenttoapplicationsEasytosetup.FlashbackDataArchive:OverviewOriginaldatainUndodataDMLoperationsbuffercacheFlashbackdataarchivesstoredintablespaces1year2years5yearsExample:Threeflashbackdataarchiveswithretentionof:ForretentionrequirementsexceedingundoFBDA.Historyorarchivetables:-Compressedstorage-WithautomaticdigitalshreddingFlashbackDataArchive:ArchitectureBuffercacheDMLchangesusedbyFBDAOldvaluesUndoFBDAFlashbackdataarchives123.PreparingYourDatabaseCreateoneormoretablespacesfordataarchivesandgrantQUOTAonthetablespaces.GranttheFLASHBACK

ARCHIVEADMINISTERsystemprivilegetocreateandmaintainflashbackarchivestothearchiveadministrator.GranttheFLASHBACKARCHIVEobjectprivilege(toenablehistorytrackingforspecifictablesinthegivenflashbackarchives)tothearchiveuser.GrantFLASHBACKandSELECTprivilegestoqueryspecificobjectsasnecessary...Configuringundo:Createanundotablespace(default:automaticallyextensibletablespace)EnableAutomaticUndoManagement(11gdefault)Understandautomatictuningofundo:Fixed-sizetablespace:AutomatictuningforbestretentionAutomaticallyextensibleundotablespace:Automatictuningforlongest-runningqueryRecommendationforFlashback:Fixed-sizeundotablespacePreparingYourDatabase..FlashbackDataArchive:WorkflowCreatetheflashbackdataarchive.Optionally,specifythedefaultflashbackdataarchive.Enabletheflashbackdataarchive.Viewflashbackdataarchivedata..UsingFlashbackDataArchive1. Createtheflashbackdataarchive:2. Enablehistorytrackingforatableinthearchive:3. Viewthehistoricaldata:CREATEFLASHBACKARCHIVEfla1TABLESPACEtbs1QUOTA10GRETENTION5YEAR;

ALTERTABLEinventoryFLASHBACKARCHIVEfla1;SELECTproduct_number,product_name,countFROMinventoryASOFTIMESTAMPTO_TIMESTAMP('2007-01-0100:00:00','YYYY-MM-DDHH24:MI:SS');.ConfiguringaDefaultFlashbackDataArchiveUsingadefaultflashbackarchive:1. Createadefaultflashbackdataarchive:2. Enablehistorytrackingforatable:

Note:Thenameoftheflashbackdataarchiveisnotneededbecausethedefaultoneisused.3. Disablehistorytracking:CREATEFLASHBACKARCHIVEDEFAULTfla2TABLESPACEtbs1QUOTA10GRETENTION2YEAR;

ALTERTABLEstock_dataFLASHBACKARCHIVE;ALTERTABLEstock_dataNOFLASHBACKARCHIVE;.FillingtheFlashbackDataArchiveSpaceWhathappenswhenyourflashbackdataarchivegetsfull?90%spaceusageRaisingoferrors:ORA-55623

"FlashbackArchive\"%s\"isblockingandtrackingonalltablesissuspended"ORA-55617"FlashbackArchive\"%s\"runsoutofspaceandtrackingon\"%s\"issuspended"GeneratingalertlogentrySuspendingtracking.MaintainingFlashbackDataArchivesAddingspace:Changingretentiontime:Purgingdata:Droppingaflashbackdataarchive:ALTERFLASHBACKARCHIVEfla1ADDTABLESPACEtbs3QUOTA5G;ALTERFLASHBACKARCHIVEfla1PURGEBEFORETIMESTAMP(SYSTIMESTAMP-INTERVAL'1'day);

ALTERFLASHBACKARCHIVEfla1MODIFYRETENTION2YEAR;DROPFLASHBACKARCHIVEfla1;.FlashbackDataArchive:ExamplesToenforcedigitalshredding:Toaccesshistoricaldata:Torecoverdata:CREATEFLASHBACKARCHIVEtax7_archiveTABLESPACEtbs1RETENTION7YEAR;

SELECTsymbol,stock_priceFROMstock_dataASOFTIMESTAMPTO_TIMESTAMP('2006-12-3123:59:00','YYYY-MM-DDHH24:MI:SS')

INSERTINTOemployeesSELECT*FROMemployeesASOFTIMESTAMPTO_TIMESTAMP('2007-06-1211:30:00','YYYY-MM-DDHH24:MI:SS')WHEREname='JOE';

.FlashbackDataArchive:DDLRestrictionsUsinganyofthefollowingDDLstatementsonatableenabledforFlashbackDataArchivecausesanORA-55610error:ALTERTABLEstatementthatdoesanyofthefollowing:PerformspartitionorsubpartitionoperationsConvertsaLONGcolumntoaLOBcolumnIncludesanUPGRADETABLEclause,withorwithoutanINCLUDINGDATAclauseDROPTABLEstatementTRUNCATETABLEstatement.FlashbackDataArchive:SupportingTransparentSchemaEvolutionAdditionalDDLsupported:DROP,RENAME,andMODIFYcolumnDROPandTRUNCATEpartitionRENAMEandTRUNCATEtableFlashbackqueriesworkacrossDDLchanges:Outputispresentedaccordingly.AllotherDDLnotautomaticallysupportedDropColumnAddColumnAddColumntimeFlashbackVersionQuery11.2.FlashbackDataArchive:SupportingFullSchemaEvolutionDBMS_FLASHBACK_ARCHIVE.DISASSOCIATE_FBAandDBMS_FLASHBACK_ARCHIVE.REASSOCIATE_FBADisablesFlashbackDataArchiveonspecifiedtables,allowingmorecomplexDDL(upgrades,splittables)EnforcesschemaintegrityafterassociationBasetableandhistorytableschemasmustbethesame.RequirestheFLASHBACK

ARCHIVE

ADMINISTERprivilegeALTERSCHEMADISASSOCIATEALTERSCHEMAASSOCIATE11.21243HistorytableHistorytableBasetable.ViewingFlashbackDataArchivesViewingtheresults:ViewNameDescription*_FLASHBACK_ARCHIVEDisplaysinformationaboutflashbackdataarchives*_FLASHBACK_ARCHIVE_TSDisplaystablespacesofflashbackdataarchives*_FLASHBACK_ARCHIVE_TABLESDisplaysinformationabouttablesthatareenabledforflashbackarchiving.GuidelinesandUsageTipsCOMMITorROLLBACKbeforequeryingpastdataUseofcurrentsessionsettingsObtainSCNwiththeDBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBERfunction.Computeapasttimewith: (SYSTIMESTAMP-INTERVAL'10'MINUTE)UseSystemChangeNumber(SCN)whereprecisionisneeded(timestampshaveathree-secondgranularity)..QuizWhichofthefollowingarecharacteristicsofaflashbackdataarchive?Aflashbackdataarchiveconsistsofoneormoretablespacesorpartsthereof.Aflashbackdataarchiveconsistsofonlyonetablespace.Youcanhaveonlyoneflashbackdataarchiveineachdatabase.Youcanhavemultipleflashbackdataarchivesineachdatabase..FlashbackTransactionBackoutLogicalrecoveryoptiontorollbackaspecifictransactionandallitsdependenttransactionsUsingredologsandsupplementalloggingCreatingandexecutingcompensatingtransactionsYoufinalizechangeswithcommitorrollback.FasterandeasierthanlaboriousmanualapproachDependenttransactionsinclude:Write-after-write(WAW)andprimarykeyconstraints,butnotforeignkeyconstraints.Prerequisites

…anddatabasemustbeinARCHIVELOGmode11.2update.FlashingBackaTransactionYoucanflashbackatransactionbyusingEnterpriseManagerorthecommandline.EnterpriseManagerusestheFlashbackTransactionWizard,whichcallstheDBMS_FLASHBACK.TRANSACTION_BACKOUTprocedurewiththeNOCASCADEoption.IfthePL/SQLcallfinishessuccessfully,itmeansthatthetransactiondoesnothaveanydependenciesandasingletransaction

is

backedoutsuccessfully..UsingtheFlashbackTransactionWizard.UsingtheDBMS_FLASHBACK.TRANSACTION_BACKOUTProcedureCREATETYPEXID_ARRAYASVARRAY(100)OFRAW(8);CREATEORREPLACEPROCEDURETRANSACTION_BACKOUT(numberOfXIDsNUMBER,--numberoftransactionspassedasinputxidsXID_ARRAY,--thelistoftransactionidsoptionsNUMBERdefaultNOCASCADE,--backoutdependenttxntimeHintTIMESTAMPdefaultMINTIME--timehintonthetxnstart);.ViewingaDependencyReportAfterchoosingyourbackoutoption,thedependencyreportisvisibleintheDBA_FLASHBACK_TXN_STATEandDBA_FLASHBACK_TXN_REPORTviews.Reviewthedependencyreportthatshowsalltransactionswhichwerebackedout.Committhechangestomakethempermanent.Rollbacktodiscardthechanges..ViewingFlashbackTransactionMetadataViewNameDescription*_FLASHBACK_TXN_REPORTDisplaysrelatedXMLinformation*_FLASHBACK_TXN_STATEDisplaysthetransactionidentifiersforbacked-outtransactionsSQL>SELECT*FROMDBA_FLASHBACK_TXN_STATE;COMPENSATING_XIDXIDBACKOUT_MODEDEPENDENT_XIDUSER#-------------------------------------------------------------------050015006905000003000000A905000040

050015006905000005001E0063050000403000000A90500000

.QuizFlashbackTransactionBackoutenablesyoutorollbackaspecifictransactionanddependenttransactionswhilethedatabaseremainsonline.TrueFalse.UsingLogMinerPowerfulaudittoolforOracledatabasesDirectaccesstoredologsUserinterfaces:SQLcommandlineGraphicaluserinterface(GUI)IntegratedwithEnterpriseManager.Review:DataPumpExportandImportexpdp

clientDump

filesetDatabaseDataPump

jobSourceMaster

tableServer

processDump

filesetServer

processTargetDataPump

jobimpdp

clientDatabaseMaster

tableDatabase

link“Networkmode”.MigrationwithDataPumpLegacyModeAssistanceintransitioningfromimpandexputilitiestoimpdpandexpdputilitiesDataPumpinlegacymode:1. Encountersuniqueimporexpparameterandenterslegacymode2. Attemptstomaptheoldsyntaxtothenewsyntax3. Displaysnewsyntax4. ExitslegacymodeBestpracticetip:Oraclestronglyrecommendsthatyouviewthenewsyntaxandmakescriptchangesastimepermits.11.2.DataPumpLegacyModeTheDataPumpexportandimportutilities:ReadandwritefilesonlyinDataPumpformatAcceptexpandimputilitycommandsinlegacymodeLegacymodeparameters:Canbeidenticaltothenewsyntax:FILESIZE=integer[B|K|M|G]Canbesimilar:QUERY=query_clauseAreignored,whenthecommandissupercededbyDataPumpdefaults.BUFFER=integerCOMPRESS={y|n}DIRECT={y|n}Causeanerrorwhenoldandnewsyntaxismixed.11.2.DataPumpLegacyModeLegacymodeparameters(continued):AremappedtoDataPumpparameters,ifpossible:consistent={y|n}->FLASHBACK_TIMEGRANTS=n->EXCLUDE=CONSTRAINTSINDEXES=n->EXCLUDE=INDEXLOG=filename->LOGFILE=filenameFILE=filename->dumpfile=directory-object:filename

Canbesimilar,butnotidentical:FEEDBACK=integer->STATUSCauseanerrorwhenincompatiblewith

温馨提示

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

评论

0/150

提交评论