Académique Documents
Professionnel Documents
Culture Documents
Contents
Introduction Introduction to LogMiner LogMiner Configuration Constraints Requirements LogMiner Com onents Ho! LogMiner "or#s $urt%er Reading About t%e Aut%or
Introduction
&'ery instance of an (rac)e database *c)ustered or non+c)ustered, records c%anges made to database b)oc#s in redo )og fi)es. -%e (rac)e instance !rites t%ese c%anges in t%e form of redo records *a)so #no!n as redo entries, to its associated online redo logs. (n)ine redo )og fi)es are !ritten to in a circu)ar manner. (nce an on)ine redo )og fi))s, (rac)e mo'es to t%e ne.t one. If t%e database is in arc%i'ed redo )og mode, (rac)e !i)) ma#e a co y of t%e on)ine redo )og to !%at is #no!n as an archived redo log before t%e on)ine 'ersion gets reused and o'er!ritten by t%e circu)ar nature of t%e )ogging rocess. Redo )og fi)es are common)y used for t%e ur ose of reco'ering a database as t%e resu)t of some ty e of fai)ure or !%en refres%ing a %ysica) standby database. /ut !%at if you !anted to read t%e actua) redo records direct)y from t%e redo )og fi)es0 $or e.am )e, an organi1ation may need to ca ture a)) c%anges made to t%e database for auditing ur oses or data ana)ysis. 2rior to
(rac)e3i, t%is ro'ed to be a ainfu) e.ercise as t%e redo )og fi)es use an un ub)is%ed format t%at is not %uman+readab)e. -%e on)y so)ution t%en !as for t%e D/A to send a dum fi)e of t%e redo )og fi)es to (rac)e su ort. In (rac)e3i, LogMiner !as introduced as a too) ca ab)e of reading redo records found in t%e redo )og fi)es using a re)ationa) interface. "%i)e LogMiner can be used for t%e aforementioned needs of auditing or data ana)ysis, it can a)so used to reco'er from user errors4 sometimes referred to as logical corruption. Un)i#e %ysica) database corru tion from media fai)ure or b)oc# corru tion, )ogica) corru tion occurs as t%e resu)t of %uman or a )ication mista#es !it% t%e data rat%er t%an %ard!are or soft!are ma)function. $or e.am )e, an a )ication u dates or de)etes from a tab)e !it% an incorrect WHERE c)ause or e'en !orse, a critica) ob5ect )i#e a tab)e gets dro ed from t%e database. In situations )i#e t%is, LogMiner can be used to not on)y in oint !%en t%e )ogica) corru tion to t%e database occurred, but to a)so construct t%e S6L needed to re'erse or UNDO t%e c%anges. -%is can drastica))y reduce t%e Mean Time To Recovery *M--R, o'er re'ious met%ods suc% as oint+in+ time reco'ery or restoring from an e. ort. -%is artic)e ro'ides insig%t into t%e t%e LogMiner uti)ity and t%e different com onents t%at ma#e it u . -o see a co))ection of e.am )es using LogMiner, consu)t t%e fo))o!ing tutoria)7
LogMiner by &.am )e
Introduction to LogMiner
(rac)e LogMiner is a uti)ity introduced in (rac)e3i t%at ro'ides a re)ationa) interface to redo records found in redo )og fi)es. LogMiner enab)es users to query on)ine or arc%i'ed redo )og fi)es t%roug% standard S6L statements or using a 8UI ro'ided t%roug% (rac)e &nter rise Manager *(&M,. -%e benefits to LogMiner inc)ude identifying t%e time of a articu)ar database e'ent, generating t%e S6L statements needed to re'erse incorrect c%anges made to t%e database, gat%ering data for ca acity )anning, or auditing certain o erations run against t%e database. -%e LogMiner uti)ity can be accessed t%roug% S6L statements *command+)ine, or t%roug% t%e (rac)e LogMiner 9ie!er gra %ica) user interface !%ic% is art of (rac)e &nter rise Manager. Oracle LogMiner vs Oracle Flashback Do not confuse LogMiner !it% anot%er o u)ar feature introduced in (rac)e Database :;g ca))ed (rac)e $)as%bac#. LogMiner and (rac)e $)as%bac# bot% use t%e redo )og fi)es but for different ur oses. "%i)e LogMiner uses t%e redo )og fi)es to read data c%anges and reconstruct %o! data !as c%anged, (rac)e $)as%bac# actua))y erforms t%e
reconstruction and resents t%e finis%ed resu)ts of suc% c%anges, gi'ing a 'ie! of t%e database at some oint in time.
LogMiner Configuration
A LogMiner configuration consists of four basic com onents7 t%e source database, t%e mining database, t%e redo )og fi)es containing t%e data c%anges of interest, and t%e LogMiner data dictionary. Source Database Mining Database -%e database t%at roduces t%e redo )og fi)es you !ant LogMiner to ana)y1e. -%e database t%at LogMiner uses to erform its ana)ysis on. -%is can be t%e source database or a remote database. -%e redo )og fi)es contain a)) c%anges made to t%e database !%ic% inc)udes user data and t%e data dictionary. A LogMiner data dictionary consists of t%e memory data structures and t%e database tab)es t%at are used to store and retrie'e information about ob5ects in t%e database and t%eir 'ersions. -%is information is used by t%e LogMiner too) to trans)ate interna) ob5ect identifiers, data ty es, and binary data 'a)ues found in t%e redo )og fi)es into readab)e ob5ect names, e.terna) data formats, and data 'a)ues. -%e LogMiner data dictionary is a)so referred to as sim )y t%e LogMiner dictionary. LogMiner can e.tract t%e dictionary from t%ree different sources during t%e ana)ysis %ase4 from an e.terna) f)at fi)e, t%e redo )og fi)es, or using t%e on)ine cata)og.
!tracting the LogMiner Dictionary to a Flat File 2rior to (rac)e<i, t%is !as t%e on)y met%od a'ai)ab)e to create t%e dictionary. -%is o tion is maintained for bac#!ard com atibi)ity !it% re'ious re)eases. -%is o tion does not guarantee transactiona) consistency. (rac)e recommends t%at you use eit%er t%e on)ine cata)og or e.tract t%e dictionary from redo )og fi)es instead.
!tracting a LogMiner Dictionary to the "edo Log Files (rac)e recommends t%at you use t%is o tion !%en you do not e. ect to %a'e access to t%e source database from !%ic% t%e redo )og fi)es !ere created, or if you antici ate t%at c%anges !i)) be made to t%e
#sing the Online Catalog (rac)e recommends t%at you use t%is o tion !%en you !i)) %a'e access to t%e source database from !%ic% t%e redo )og fi)es !ere created and !%en no c%anges to t%e co)umn definitions in t%e tab)es of interest are antici ated. -%is is t%e most efficient and easy+to+use o tion.
"it%out a dictionary, LogMiner returns interna) ob5ect IDs and resents data as binary data. $or e.am )e, consider t%e fo))o!ing S6L statement t%at got !ritten to t%e redo )og fi)e7
insert into hr.departments(department_id, department_name, manager_id, location_id) values(hr.departments_seq.nextval, 'Engineering', null, 1 !!)"
"it%out a dictionary, LogMiner !i)) return t%e fo))o!ing cry tic redo statement7
insert into #$%&%'W%#.#'()* +,-./#(#0'1 1#,#0'1 .#,#0'1 2#,#0'1 /#) values (HE34'R5W('c.!267'),HE34'R5W('/6+e+ +-+e+6+6 .+-+e+ '),%$11, HE34'R5W('c.1.'))"
"it% a dictionary a'ai)ab)e, LogMiner is ab)e to trans)ate t%e interna) ob5ect identifiers and binary data 'a)ues from t%e redo )og fi)es into somet%ing more readab)e7
insert into #HR#.#8E95R4:E%4;#(#8E95R4:E%4_<8#,#8E95R4:E%4_%5:E#,#:5%5=E R_<8#,#1'054<'%_<8#) values ('.-!','Engineering',%$11,'1 !!')"
$igure : be)o! s%o!s an e.am )e LogMiner configuration. In t%is configuration, t%e source database named racdb generates redo )og fi)es t%at are arc%i'ed and s%i ed to anot%er database named testdb. A LogMiner dictionary %as been e.tracted to t%ese redo )og fi)es. -%e mining database, testdb, is !%ere LogMiner !i)) erform t%e !or# of ana)y1ing t%e redo )og fi)es.
Figure $7 &.am )e LogMiner Configuration -%e configuration described abo'e is 5ust one of many 'a)id LogMiner configurations. $or e.am )e, it is ossib)e to use t%e same database for t%e source and mining database, or using anot%er met%od to ro'ide t%e LogMiner dictionary.
Constraints
(rac)e LogMiner %as a number of constraints re)ated to t%e source and mining database, t%e data dictionary, and t%e redo )og fi)es t%at LogMiner !i)) ana)y1e.
Source and mining database o /ot% t%e source database and t%e mining database must be running on t%e same %ard!are )atform.
o
-%e mining database can be t%e same as, or com )ete)y se arate from, t%e source database. -%e mining database must run t%e same re)ease or a )ater re)ease of t%e (rac)e Database soft!are as t%e source database. -%e mining database must use t%e same c%aracter set *or a su er+set of t%e c%aracter set, used by t%e source database.
LogMiner dictionary
o
-%e dictionary must be roduced by t%e same source database t%at generates t%e redo )og fi)es t%at LogMiner !i)) ana)y1e.
Must be roduced by t%e same source database. Must be associated !it% t%e same database R&S&-L(8S SC=. Must be from a re)ease 3.; or )ater (rac)e Database. Ho!e'er, se'era) of t%e LogMiner features introduced as of re)ease <.;.: !or# on)y !it% redo )og fi)es roduced on an (rac)e<i or )ater database.
LogMiner does not a))o! you to mi. redo )og fi)es from different databases or to use a dictionary from a different database t%an t%e one t%at generated t%e redo )og fi)es to be ana)y1ed.
"e%uire&ents
Archivelog Mode
Arc%i'e)og mode must be enab)ed in order to generate usab)e redo )og fi)es.
;>1? select log_mode from v$database; 1'=_:'8E @@@@@@@@@@@@ %'5R0H<AE1'= ;>1? shutdown immediate 8ata7ase closed. 8ata7ase dismounted. 'R501E instance shut doBn. ;>1? startup mount 'R501E instance started. 4otal ;Cstem =lo7al 5rea 1+6261,22+ 7Ctes Dixed ;iEe ...,-!/ 7Ctes Aaria7le ;iEe 1.-1,/-!/, 7Ctes 8ata7ase (uFFers 26.2.162+ 7Ctes Redo (uFFers 11,,/, 7Ctes 8ata7ase mounted. ;>1? alter database archivelog; 8ata7ase altered. ;>1? alter database open; 8ata7ase altered. ;>1? select log_mode from v$database; 1'=_:'8E @@@@@@@@@@@@ 5R0H<AE1'=
'ecurity
Users need to be a!are of t%e system and ob5ect )e'e) ri'i)eges required to use LogMiner. In most cases, t%e D/A !i)) create a s ecia) user and ro)e to erform LogMiner o erations. In t%is e.am )e, a ne! ro)e named 1'=:%R_58:<% !i)) be created and assigned t%e a ro riate ri'i)eges for LogMiner. -%is ro)e !i)) be assigned to a ne! user named :<%ER t%at !i)) be used to erform a)) LogMiner ana)ysis.
grants t%e e.ecution ri'i)eges on t%e 2L>S6L LogMiner ac#ages. -%ese ac#ages a)) be)ong to t%e ;G; sc%ema. -%e ;E1E04 5%G 8<04<'%5RG system ri'i)ege is required for t%e )og miner user to )og in to (rac)e &nter rise Manager. Se)ect ri'i)eges are granted to access t%e AH1'=:%R_0'%4E%4; 'ie! and se'era) ot%er LogMiner o erationa) 'ie!s. -%e ;E1E04 5%G 4R5%;504<'% system ri'i)ege is required to access t%e AH1'=:%R_0'%4E%4; 'ie!. -%e ;E1E04 5%G 45(1E system ri'i)ege is required for t%e )og miner user to %a'e access to t%e ob5ects mined in a LogMiner session. $or e.am )e, if t%e miner user reads redo records created by t%e HR user, t%e miner user !ou)d need se)ect access to t%ose tab)es. -%e 0RE54E 45(1E;950E and 8R'9 45(1E;950E system ri'i)eges a))o! t%e user to re+ create a)) LogMiner tab)es in an a)ternate tab)es ace ot%er t%an t%e defau)t S?SAU@ tab)es ace *discussed in t%e ne.t section,.
'upple&ental Logging
LogMiner is a redo+based a )ication and as suc%, requires at )east minima) su )ementa) )ogging be enab)ed on t%e source database. (rac)e does not enab)e any su )ementa) )ogging by defau)t. Su )ementa) )ogging must be enab)ed on t%e source database before generating redo )og fi)es t%at !i)) be ana)y1ed by LogMiner. "%en minima) su )ementa) )ogging is enab)ed, information about some se)ected co)umns or a)) co)umns *in addition to t%e co)umns being modified, !i)) be added to t%e redo stream and !ritten to t%e redo )og fi)es to unique)y identify a ro!. -%is additiona) information is needed by LogMiner to identify, grou , and merge t%e redo o erations associated !it% DML c%anges. "it%
minima) su )ementa) )ogging enab)ed, LogMiner is ab)e to reconstruct DML statements t%at unique)y identify a ro! !it%out %a'ing to use a R("ID and ro'ides LogMiner !it% information necessary to su ort c%ained ro!s and 'arious storage arrangements *for e.am )e, c)ustered tab)es,. Starting !it% (rac)e Database ::g, (rac)e LogMiner 9ie!er %as been incor orated into t%e (rac)e &nter rise Manager !eb+based interface and a)so integrated !it% t%e ne! $)as%bac# -ransaction feature, ma#ing it sim )e to reco'er transactions t%at may %a'e been modified by mista#e. $)as%bac# -ransaction a))o!s t%e c%anges made by a transaction to be undone, o tiona))y inc)uding c%anges made by de endent transactions. Su )ementa) )ogging for rimary #ey co)umns must be enab)ed for $)as%bac# -ransaction to !or#. At t%e 'ery )east, enab)e minima) su )ementa) )ogging on t%e source database. In order for t%e integrated $)as%bac# -ransaction feature to !or# !it% LogMiner, su )ementa) )ogging for rimary #ey co)umns must a)so be enab)ed.
;>1? alter database add supplemental log data; 8ata7ase altered. ;>1? alter database add supplemental log data (primary key) columns; 8ata7ase altered.
9erify t%at su )ementa) )ogging is enab)ed. If t%e query be)o! returns a 'a)ue of GE; or <:91<0<4, su )ementa) )ogging is enab)ed.
;>1? select supplemental_log_data_min, supplemental_log_data_pk from v$database; ;$991E:E%451_1'=_8545_:<% ;$991E:E%451_1'=_8545_9& @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ GE; GE;
In order for t%e ne! su )ementa) )og configuration to begin arc%i'ing t%e additiona) co)umn data to t%e redo )ogs, force a )og s!itc%.
;>1? alter system switch logfile; ;Cstem altered.
LogMiner Co&ponents
LogMiner is a set of t!o 2L>S6L ac#ages and se'era) 'ie!s. -%e LogMiner ac#ages are used to re are a LogMiner session and to erform ana)ysis on t%e redo )og fi)es of interest. -%e resu)ts of t%e LogMiner ana)ysis, #no!n as t%e LogMiner contents, are a'ai)ab)e t%roug% t%e ri'ate 'ie! AH1'=:%R_0'%4E%4;.
-%e ;E4_45(1E;950E rocedure is an o tiona) rocedure t%at a))o!s you to re+ create a)) LogMiner tab)es in an a)ternate tab)es ace ot%er t%an t%e defau)t ;G;5$3 tab)es ace.
8(:;_1'=:%R_8.;E4_45(1E;950E ( neB_ta7lespace <% A5R0H5R. )"
($<18
-%e ($<18 rocedure e.tracts t%e LogMiner data dictionary to eit%er a f)at fi)e or one or more redo )og fi)es. -%e ($<18 rocedure is not used if t%e LogMiner session !i)) be using t%e on)ine cata)og.
$igure B s%o!s a decision tree to %e) you se)ect a LogMiner dictionary e.traction met%od de ending on t%e ty e of LogMiner ana)ysis being erformed.
Figure +7 Decision -ree for Data Dictionary &.traction !tract LogMiner Dictionary to a Flat File -o e.tract t%e dictionary to a f)at fi)e, set t%e dictionarC_Filename arameter to t%e name of t%e fi)e, t%e dictionarC_location set to a directory on t%e database mac%ine s ecified in $41_D<1E_8<R, and o tiona))y set t%e options arameter to t%e constant 8(:;_1'=:%R_8.;4'RE_<%_D154_D<1E. Using t%ese o tions, t%e ($<18 rocedure !i)) query t%e data dictionary tab)es of t%e current database and create a te.t+based fi)e containing t%e contents of t%e tab)es. -%e directory s ecified in dictionarC_location must e.ist as a 'a)ue in t%e $41_D<1E_8<R initia)i1ation arameter. After setting t%is arameter, t%e instance
!i)) need to be restarted in order to ta#e effect. (n)y e.tract t%e dictionary to a f)at fi)e after a)) DDL statements %a'e been run and rior to t%e creation of any redo )og fi)es t%at !i)) be ana)y1ed. Do not run 8(:;_1'=:%R_8.($<18 !%i)e DDL o erations are occurring in t%e database, e)se t%e sna s%ot of t%e dictionary !i)) not be consistent. -%e 881_8<04_4R50&<%= o tion to t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure *e. )ained )ater, is on)y su orted on f)at fi)e dictionaries created !it% (rac)e<i and )ater.
(E=<% 8(:;_1'=:%R_8.($<18 ( dictionarC_Filename J? 'dictionarC.ora', dictionarC_location J? 'Ku!/KappKoracleKlogmnr', options J? 8(:;_1'=:%R_8.;4'RE_<%_D154_D<1E )" E%8" K 91K;>1 procedure successFullC completed. ;>1? Lls @l Ku!/KappKoracleKlogmnrKdictionarC.ora @rB@r@@r@@ 1 oracle asmadmin 2-.6!+./ ;ep / 1,M6, Ku!/KappKoracleKlogmnrKdictionarC.ora
!tract LogMiner Dictionary to "edo Log Files -o e.tract t%e dictionary to t%e redo )og fi)es, s ecify on)y t%e options arameter !it% t%e 'a)ue set to t%e constant 8(:;_1'=:%R_8.;4'RE_<%_RE8'_1'=;. Do not s ecify t%e dictionarC_Filename or dictionarC_location arameters !%en e.tracting t%e dictionary to t%e redo )og fi)es. -%e si1e of t%e LogMiner dictionary may cause it to be contained in mu)ti )e redo )og fi)es. &.tracting t%e dictionary to t%e redo )og fi)es requires t%e fo))o!ing7
(rac)e<i database or )ater -%e 0':954<(1E initia)i1ation arameter must be set to <.B.; or %ig%er Arc%i'e)og mode enab)ed in order to generate usab)e redo )og fi)es Su )ementa) )ogging *at )east t%e minimum )e'e), s%ou)d be enab)ed in
Determine t%e redo )og fi)es containing t%e LogMiner dictionary and any ot%er )og fi)es to be ana)y1ed by LogMiner.
514ER ;E;;<'% ;E4 %1;_854E_D'R:54 J '88@:'%@GGGG HH./M:<M;;'" ;ession altered. 0'1$:% 0'1$:% 0'1$:% 0'1$:% name First_time dictionarC_7egin dictionarC_end D'R:54 D'R:54 D'R:54 D'R:54 5+6 5.! 56 56 HE58 HE58 HE58 HE58 #1og Dile %ame# #Dirst 4ime# #8ictN(egin# #8ictNEnd#
;E1E04 name , First_time , dictionarC_7egin , dictionarC_end DR': vHarchived_log WHERE name <; %'4 %$11 5%8 First_time (E4WEE% '!+@;E9@.!1. !!M!!M!!' and '!+@;E9@ .!1. !!M2!M!!' 'R8ER (G sequence*" 8ict 8ict 1og Dile %ame Dirst 4ime (egin End @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@ @@@@@@@@@@@@@@@@@@@@ @@@@@ @@@@@ ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_.,+6.1!/.. -2.2, / 2 !+@;E9@.!1. !!M!!M6 %' %' ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_.,++.1!- . -2.2, +6 !+@;E9@.!1. !!M!1M1. %' %' ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_.,+ .1111. -2.2, +6 !+@;E9@.!1. !!M!/M1+ %' %' ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_.,+,..++. -2.2,+ +1 !+@;E9@.!1. !!M!/M1 GE; %' ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_.,+-.1!16. -2.2,
++2 !+@;E9@.!1. !!M!/M.1 %' GE; ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., ,1 !+@;E9@.!1. !!M!/M.2 %' %' ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., +- !+@;E9@.!1. !!M!+M.! %' %' ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., / 6 !+@;E9@.!1. !!M!-M.- %' %' ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., ! !+@;E9@.!1. !!M1 M66 %' %' ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., 1/1 !+@;E9@.!1. !!M.1M/ %' %' ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., -6 !+@;E9@.!1. !!M.-M!! %' %'
D/MSAL(8M=R Contains t%e rocedures used to initia)i1e t%e LogMiner too) and to begin and end a LogMiner session. -%e rocedures used most often are described be)o!.
588_1'=D<1E
-%e 588_1'=D<1E rocedure is used to add a redo )og fi)e to an e.isting or ne!)y created )ist of )og fi)es for LogMiner to ana)y1e.
8(:;_1'=:%R.588_1'=D<1E ( 1ogDile%ame <% A5R0H5R., options <% (<%5RG_<%4E=ER deFault 588D<1E )"
Add First "edo Log File "%en adding t%e first redo )og fi)e to t%e )ist, s ecify t%e name and )ocation of t%e )og fi)e and set t%e options arameter to t%e constant 8(:;_1'=:%R.%EW. -%is !i)) start a ne! LogMiner session and a ne! )ist of redo )og fi)es for ana)ysis. -%e %EW o tion im )icit)y ca))s t%e 8(:;_1'=:%R.E%8_1'=:%R rocedure to end t%e current LogMiner session and t%en creates a ne! session. -%e ne! LogMiner session starts a ne! )ist of redo )og fi)es to be ana)y1ed, beginning !it% t%e s ecified redo )og fi)e. -%e fo))o!ing e.am )e adds t%e first arc%i'ed redo )og fi)e t%at contains t%e start of t%e LogMiner dictionary.
(E=<% 8(:;_1'=:%R.588_1'=D<1E ( 1ogDile%ame J? 'ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_.,+,..++. -2.2,
options J? 8(:;_1'=:%R.%EW
Add Additional "edo Log Files "%en adding additiona) redo )og fi)es to t%e LogMiner session, s ecify t%e name and )ocation of t%e )og fi)e and set t%e options arameter to 8(:;_1'=:%R.588D<1E *or )ea'e uns ecified to acce t t%e defau)t 'a)ue of 588D<1E,.
(E=<% 8(:;_1'=:%R.588_1'=D<1E ( 1ogDile%ame J? 'ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_.,+-.1!16. -2.2 ,++2', options J? 8(:;_1'=:%R.588D<1E )" E%8" K 91K;>1 procedure successFullC completed. (E=<% 8(:;_1'=:%R.588_1'=D<1E ( 1ogDile%ame J? 'ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., !.22!. -2.2, ,1', options J? 8(:;_1'=:%R.588D<1E )" E%8" K 91K;>1 procedure successFullC completed. (E=<% 8(:;_1'=:%R.588_1'=D<1E ( 1ogDile%ame J? 'ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., 1.-+,. -2.2, -+-', options J? 8(:;_1'=:%R.588D<1E )" E%8" K 91K;>1 procedure successFullC completed.
(E=<% 8(:;_1'=:%R.588_1'=D<1E ( 1ogDile%ame J? 'ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., ..1! 6. -2.2 -/ 6', options J? 8(:;_1'=:%R.588D<1E )" E%8" K 91K;>1 procedure successFullC completed. (E=<% 8(:;_1'=:%R.588_1'=D<1E ( 1ogDile%ame J? 'ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., 2.22,. -2.2! ', options J? 8(:;_1'=:%R.588D<1E )" E%8" K 91K;>1 procedure successFullC completed.
RE:'AE_1'=D<1E
-%e RE:'AE_1'=D<1E rocedure remo'es a redo )og fi)e t%at !as accidenta))y added from t%e e.isting )ist of redo )og fi)es for LogMiner to rocess.
8(:;_1'=:%R.RE:'AE_1'=D<1E ( 1ogDile%ame <% A5R0H5R. )"
-%e fo))o!ing e.am )e remo'es an unnecessary redo )og fi)e from t%e current LogMiner session.
(E=<% 8(:;_1'=:%R.RE:'AE_1'=D<1E ( 1ogDile%ame J? 'ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., 2.22,. -2.2! ' )" E%8" K 91K;>1 procedure successFullC completed.
;45R4_1'=:%R
-%e ;45R4_1'=:%R rocedure starts LogMiner by )oading t%e dictionary t%at LogMiner !i)) use to trans)ate interna) ob5ect identifiers to %uman+readab)e names. -%is rocedure must be ca))ed before reading t%e )og entries from t%e AH1'=:%R_0'%4E%4; 'ie! *described be)o!,.
8(:;_1'=:%R.;45R4_1'=:%R ( start;cn <% %$:(ER deFault !, end;cn <% %$:(ER deFault !, start4ime <% 854E deFault '!1@Pan@1-,,', end4ime <% 854E deFault '21@dec@.11!', 8ictDile%ame <% A5R0H5R. deFault '', 'ptions <% (<%5RG_<%4E=ER deFault ! )"
Dictionary fro& "edo Log Files If reading t%e dictionary from t%e redo )og fi)es, s ecify t%e options arameter !it% t%e 'a)ue set to t%e constant 8(:;_1'=:%R.8<04_DR':_RE8'_1'=;. -%e redo )og fi)e*s, inc)uding t%e LogMiner dictionary from t%e 8(:;_1'=:%R_8.($<18 rocedure need to %a'e been e. )icit)y )oaded for t%e current LogMiner session t%roug% t%e 8(:;_1'=:%R.588_1'=D<1E rocedure. LogMiner !i)) e. ect to find t%e LogMiner dictionary in t%e redo )og fi)es s ecified for t%e current LogMiner session.
(E=<% 8(:;_1'=:%R.;45R4_1'=:%R ( options J? 8(:;_1'=:%R.8<04_DR':_RE8'_1'=; )" E%8" K 91K;>1 procedure successFullC completed.
Dictionary fro& Online Catalog If reading t%e dictionary from t%e current on)ine cata)og, s ecify t%e options arameter !it% t%e 'a)ue set to t%e constant 8(:;_1'=:%R.8<04_DR':_'%1<%E_05451'=. In t%is case, it is not necessary to %a'e re'ious)y e.tracted t%e LogMiner dictionary to a f)at fi)e or in t%e redo )og fi)es being ana)y1ed for t%e current LogMiner sessions t%roug% t%e 8(:;_1'=:%R_8.($<18 rocedure.
(E=<% 8(:;_1'=:%R.;45R4_1'=:%R ( options J? 8(:;_1'=:%R.8<04_DR':_'%1<%E_05451'= )" E%8" K 91K;>1 procedure successFullC completed.
In addition to using t%e on)ine cata)og to ana)y1e on)ine redo )og fi)es, you can use it to ana)y1e arc%i'ed redo )og fi)es, if you are on t%e same system t%at generated t%e arc%i'ed redo )og fi)es. -%e on)ine cata)og contains t%e )atest information about t%e database and may be t%e fastest !ay to start your ana)ysis. /ecause DDL o erations t%at c%ange im ortant tab)es are some!%at rare, t%e on)ine cata)og genera))y contains t%e information you need for your ana)ysis. Remember, %o!e'er, t%at t%e on)ine cata)og can on)y reconstruct S6L statements t%at are e.ecuted on t%e )atest 'ersion of a tab)e. As soon as a tab)e is a)tered, t%e on)ine cata)og is u dated and no )onger ref)ects t%e re'ious 'ersion of t%e tab)e. -%is means t%at LogMiner !i)) not be ab)e to reconstruct any S6L statements t%at !ere e.ecuted on t%e re'ious 'ersion of t%e tab)e. Instead, LogMiner generates non+e.ecutab)e S6L *inc)uding %e.adecima)+to+ra! formatting of binary 'a)ues, in t%e ;>1_RE8' co)umn of t%e AH1'=:%R_0'%4E%4; 'ie! simi)ar to t%e fo))o!ing e.am )e7
insert into HR.E:91'GEE;(#0'1 1#,#0'1 .#,#0'1 2#,#0'1 /#) values (HE34'R5W('c.!267'),HE34'R5W('/6+e+ +-+e+6+6 .+-+e+ '),%$11,HE 34'R5W('c.1.'))"
&. ect to see a 'a)ue of + in t%e ;454$; co)umn of t%e AH1'=:%R_0'%4E%4; 'ie! if t%e tab)e definition in t%e database does not matc% t%e tab)e definition in t%e redo )og fi)e. -%e on)ine cata)og o tion requires t%at t%e database be o en. -%e on)ine cata)og o tion is not 'a)id !it% t%e 881_8<04_4R50&<%= o tion of 8(:;_1'=:%R.;45R4_1'=:%R. Dictionary fro& Flat File If reading t%e dictionary from a f)at fi)e )ocated on t%e database mac%ine, s ecify t%e name and )ocation of t%e fi)e using t%e 8ictDile%ame arameter. -%is fi)e must %a'e been created re'ious)y t%roug% t%e 8(:;_1'=:%R_8.($<18
rocedure. -%e dictFilename arameter is on)y 'a)id !%en reading t%e dictionary from a f)at fi)e and s%ou)d not be set !%en reading t%e dictionary from t%e on)ine cata)og or t%e redo )og fi)es.
(E=<% 8(:;_1'=:%R.;45R4_1'=:%R ( 8ictDile%ame J? 'Ku!/KappKoracleKlogmnrKdictionarC.ora' )" E%8" K 91K;>1 procedure successFullC completed.
'pecifying 'earch Li&it Options ?ou can )imit t%e searc% to a s ecific date and time range using t%e start4ime and end4ime arameters. -%is can be usefu) to fi)ter on)y t%ose c%anges made by someone, for e.am )e, t%at occurred during a certain time frame. =ote t%at t%e start;cn and end;cn arameters be%a'e in a simi)ar fas%ion but fi)ters records based on t%e System Change Number *SC=,.
514ER ;E;;<'% ;E4 %1;_854E_D'R:54 J '88@:'%@GGGG HH./M:<M;;'" ;ession altered. (E=<% 8(:;_1'=:%R.;45R4_1'=:%R ( start4ime J? '!+@;E9@.!1. !!M!/M1 ', end4ime J? '!+@;E9@.!1. !!M!+M.!', options J? 8(:;_1'=:%R.8<04_DR':_RE8'_1'=; )" E%8" K 91K;>1 procedure successFullC completed.
'pecifying Multiple Options -%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure can be e.ecuted !it% se'era) ot%er o tions *s ecified t%roug% t%e options arameter,, t%at contro) t%e be%a'iour of t%e LogMiner session. C)ic# %ere for a )ist of a)) a'ai)ab)e constants t%at can be s ecified for t%e options arameter in t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure. -o ca)) mu)ti )e o tions at one time using t%e 8(:;_1'=:%R.;45R4_1'=:%R
About DDL dictionary tracking If t%e LogMiner dictionary in use is a f)at fi)e or in t%e redo )og fi)es, use t%e 8(:;_1'=:%R.881_8<04_4R50&<%= o tion to t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure rocedure so LogMiner can u date its interna) dictionary if a DDL e'ent occurs. -%is ensures t%at correct ;>1_RE8' and ;>1_$%8' information is maintained for ob5ects t%at are modified after t%e LogMiner interna) dictionary is bui)t. -%e database to !%ic% LogMiner is connected must be o en. /e a!are t%at t%e 881_8<04_4R50&<%= o tion to t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure is not su orted for f)at fi)e dictionaries created rior to (rac)e<i. If you attem t to use t%e 881_8<04_4R50&<%= o tion !it% a LogMiner database e.tracted to a f)at fi)e rior to (rac)e<i, t%e 'R5@!122! error * rob)em )oading a required bui)d tab)e, is returned. -%e fo))o!ing )ist describes t%e requirements for s ecifying t%e 881_8<04_4R50&<%= o tion !it% t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure.
-%e 881_8<04_4R50&<%= o tion is not 'a)id !it% t%e 8<04_DR':_'%1<%E_05451'= o tion. -%e 881_8<04_4R50&<%= o tion requires t%at t%e database be o en. Su )ementa) )ogging must be enab)ed database+!ide, or )og grou s must %a'e been created for t%e tab)es of interest.
-o re'ent t%e dictionary from being re)oaded at t%e beginning of eac% ;E1E04 o eration on t%e AH1'=:%R_0'%4E%4; 'ie!, a)so inc)ude t%e 8(:;_1'=:%R.%'_8<04_RE;E4_'%;E1E04 o tion to t%e ;45R4_1'=:%R rocedure.
E%8_1'=:%R
-%e E%8_1'=:%R rocedure finis%es a LogMiner session. /ecause t%is rocedure erforms c)eanu o erations t%at may not ot%er!ise be done, you must use it to ro er)y end a LogMiner session. -%is rocedure is ca))ed automatica))y !%en you )og out of a database session or !%en you ca)) 8(:;_1'=:%R.588_1'=D<1E and s ecify t%e %EW o tion.
8(:;_1'=:%R.E%8_1'=:%R"
-%e fo))o!ing e.am )e ends a LogMiner session and erforms a)) c)eanu o erations.
(E=<% 8(:;_1'=:%R.E%8_1'=:%R" E%8" K 91K;>1 procedure successFullC completed.
LogMiner ,ie-s
9CL(8M=RAC(=-&=-S -%e redo entries mined from t%e redo )og fi)es by LogMiner are made a'ai)ab)e t%roug% t%e AH1'=:%R_0'%4E%4; 'ie! for t%e current LogMiner session. (ut of a)) of t%e LogMiner 'ie!s, t%is is t%e one t%at you !i)) use most often. LogMiner uses t%e redo records embedded in t%e redo )og fi)es and t%e LogMiner dictionary to re+generate equi'a)ent S6L statements e.ecuted on t%e database. -%e resu)ts of t%e LogMiner ana)ysis, #no!n as t%e LogMiner contents, are made a'ai)ab)e t%roug% a re)ation interface ro'ided by t%e AH1'=:%R_0'%4E%4; ri'ate 'ie!. -%is S6L interface can be used to query S6L statements e.ecuted on t%e database during any oint in time you %a'e redo )og fi)es for. -o query t%is 'ie!, you must %a'e t%e ;E1E04 5%G 4R5%;504<'% ri'i)ege. "%en a ;E1E04 statement is e.ecuted against t%e AH1'=:%R_0'%4E%4; 'ie!, t%e redo )og fi)es are read sequentia))y. -rans)ated records from t%e redo )og fi)es are returned as ro!s in t%e AH1'=:%R_0'%4E%4; 'ie!. -%is continues unti) eit%er t%e fi)ter criteria s ecified at startu *End4ime or end;cn, are met or t%e end of t%e redo )og fi)e is reac%ed.
It is im ortant to note t%at LogMiner is a )ied at t%e session level so t%at no one can 'ie! t%e LogMiner contents t%roug% anot%er session. -%e resu)ts in AH1'=:%R_0'%4E%4; are on)y 'isib)e during t%e )ife of t%e session !%ic% runs t%e rocedure 8(:;_1'=:R%.;45R4_1'=:%R. -%is is because a)) t%e LogMiner memory is in 28A memory, so it is neit%er 'isib)e to ot%er sessions, nor is it ersistent after disconnecting t%e session. Users !i)) often combine t%e ;>1_RE8', 0'::<4_4<:E;45:9, and ;0% co)umns to identify acti'ity !it% a articu)ar transaction t%at occurred in t%e database. -%e ;>1_$%8' can t%en be used to generate a S6L statement t%at can be used to undo t%e effect of t%e origina) statement t%at made t%e c%ange. In addition, t%e AH1'=:%R_0'%4E%4; 'ie! contains t%e segment name and o!ner !%ic% is usefu) in furt%er identification of t%e ob5ects being a)tered. C)ic# t%e fo))o!ing )in# for a descri tion of t%e co)umns a'ai)ab)e !it% t%e AH1'=:%R_0'%4E%4; 'ie! *'ersion ::.B,. 9CL(8M=RAC(=-&=-S An e.am )e query against AH1'=:%R_0'%4E%4; may )oo# )i#e7
514ER ;E;;<'% ;E4 nls_date_Format J '88@:'%@GGGG HH./M:<M;;'" ;ession altered. 0'1$:% 0'1$:% 0'1$:% 0'1$:% 0'1$:% username operation sql_redo sql_undo timestamp D'R:54 D'R:54 D'R:54 D'R:54 D'R:54 5, 55.6 W'R8_WR599E8 5.6 W'R8_WR599E8 5.!
;E1E04 username , operation , sql_redo , sql_undo , timestamp , scn DR': vHlogmnr_contents WHERE username J ';0'44' 5%8 operation J '<%;ER4' 5%8 seg_oBner J 'HR'"
$;ER%5:E '9ER54<'% ;>1_RE8' ;>1_$%8' 4<:E;45:9 ;0% @@@@@@@@ @@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@ @@@@@@@@@ ;0'44 <%;ER4 insert into delete From !+@;E9@.!1. !!M! M2, ,+!22-.6 #HR#.#8E95R4:E%4;#(#8E95R #HR#.#8E95R4:E%4;# Bhere 4:E%4_<8#,#8E95R4:E%4_%5: #8E95R4:E%4_<8# J '21!' E#,#:5%5=ER_<8#,#1'054<'% and #8E95R4:E%4_%5:E# J _<8#) values 'Engineering' and ('21!','Engineering',%$11 #:5%5=ER_<8# <; %$11 and ,'1 !!')" #1'054<'%_<8# J '1 !!' and R'W<8 J '555>!,55E55550v55c'"
9CL(8M=RADIC-I(=AR -%e AH1'=:%R_8<04<'%5RG o erationa) 'ie! s%o!s information about ? a LogMiner dictionary t%at !as created using t%e ;4'RE_<%_D154_D<1E o tion to 8(:;_1'=:%R.;45R4_1'=:%R. -%e information s%o!n inc)udes information about t%e database from !%ic% t%e LogMiner dictionary !as created. C)ic# t%e fo))o!ing )in# for a descri tion of t%e co)umns a'ai)ab)e !it% t%e AH1'=:%R_8<04<'%5RG 'ie! *'ersion ::.B,. 9CL(8M=RADIC-I(=AR? An e.am )e query against AH1'=:%R_8<04<'%5RG to obtain information about a dictionary creating using t%e ;4'RE_<%_D154_D<1E o tion to 8(:;_1'=:%R.;45R4_1'=:%R may )oo# )i#e7
514ER ;E;;<'% ;E4 nls_date_Format J '88@:'%@GGGG HH./M:<M;;'" ;ession altered. 0'1$:% timestamp 0'1$:% Filename ;E1E04 timestamp D'R:54 5.! D'R:54 52,
, Filename , dictionarC_scn , %A1(inFo, 'A51<8') as 8<04<'%5RG_;454$; DR': vHlogmnr_dictionarC" 4<:E;45:9 D<1E%5:E 8<04<'%5RG_;0% 8<04<'%5RG_;454$; @@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@ .,@5$=@.!1. .!M1/M6/ Ku!/KappKoracleKlogmnrKdictionarC.ora --261, A51<8
9CL(8M=RA2ARAM&-& -%e AH1'=:%R_95R5:E4ER; o erationa) 'ie! contains information RS about t%e current LogMiner session as s ecified in t%e ca)) to t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure. C)ic# t%e fo))o!ing )in# for a descri tion of t%e co)umns a'ai)ab)e !it% t%e AH1'=:%R_95R5:E4ER; 'ie! *'ersion ::.B,. 9CL(8M=RA2ARAM&-&RS
514ER ;E;;<'% ;E4 nls_date_Format J '88@:'%@GGGG HH./M:<M;;'" ;ession altered. 0'1$:% start_date 0'1$:% end_date D'R:54 5.! D'R:54 5.!
;E1E04 start_date , end_date , start_scn , end_scn , options DR': vHlogmnr_parameters" ;45R4_854E E%8_854E ;45R4_;0% E%8_;0% '94<'%; @@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@@@@@@@@ @@@@@@@@@@ !1@)5%@.111 !!M6-M6,+!.-/,2 ! /!
9CL(8M=RAL(8S
Use t%e AH1'=:%R_1'=; o erationa) 'ie! to determine !%ic% redo )og fi)es are being ana)y1ed in t%e current LogMiner session. -%is 'ie! contains one ro! for eac% redo )og fi)e t%at !as )oaded using t%e
8(:;_1'=:%R.588_1'=D<1E
rocedure.
C)ic# t%e fo))o!ing )in# for a descri tion of t%e co)umns a'ai)ab)e !it% t%e AH1'=:%R_1'=; 'ie! *'ersion ::.B,. 9CL(8M=RAL(8S An e.am )e query against AH1'=:%R_1'=; may )oo# )i#e7
514ER ;E;;<'% ;E4 nls_date_Format J '88@:'%@GGGG HH./M:<M;;'" ;ession altered. 0'1$:% 0'1$:% 0'1$:% 0'1$:% 0'1$:% Filename loB_time high_time dictionarC_7egin dictionarC_end D'R:54 D'R:54 D'R:54 D'R:54 D'R:54 5+6 5.! 5.! 51! 5,
;E1E04 log_id , Filename , loB_time , high_time , dictionarC_7egin , dictionarC_end DR': vHlogmnr_logs" 1'=_<8 D<1E%5:E 1'W_4<:E H<=H_4<:E 8<04_(E=<% 8<04_E%8 @@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@@@@@@ .,+, ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_.,+,..++ . -2.2,++1 !+@;E9@.!1. !!M!/M1 !+@;E9@.!1. !!M!/M.1 GE; %' .,+ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_.,+-.1!1 6. -2.2,++2 !+@;E9@.!1. !!M!/M.1 !+@;E9@.!1. !!M!/M.2 %' GE; ., ! ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., !.22! . -2.2, ,1 !+@;E9@.!1. !!M!/M.2 !+@;E9@.!1. !!M!+M.! %' %' ., 1 ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., 1.-+, . -2.2,-+- !+@;E9@.!1. !!M!+M.! !+@;E9@.!1. !!M!-M.%' %'
., . ODR5Kracd7KarchivelogK.!1._!-_!+Kthread_1_seq_., ..1! 6. -2.2-/ 6 !+@;E9@.!1. !!M!-M.- !+@;E9@.!1. !!M1 M66 %' %'
t%e 8(:;_1'=:%R.588_1'=D<1E rocedure or direct LogMiner to create a )ist of )og fi)es for ana)ysis automatica))y !%en you start LogMiner using t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure. A LogMiner session begins !it% a ca)) to t%e 8(:;_1'=:%R.588_1'=D<1E rocedure *if you )an to e. )icit)y s ecify )og fi)es, or t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure *if you )an to use continuous mining,.
5. Start LogMiner by ca))ing t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure !%ic% )oads t%e
dictionary t%at LogMiner !i)) use to trans)ate interna) ob5ect identifiers to %uman+ readab)e names. ?ou can o tiona))y fi)ter t%e searc% to a s ecific date and time range using t%e start4ime and end4ime arameters or by SC= using t%e start;cn and end;cn arameters of t%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure. -%e 8(:;_1'=:%R.;45R4_1'=:%R rocedure must be ca))ed before reading t%e )og entries from t%e AH1'=:%R_0'%4E%4; 'ie! *described ne.t,.
6. 6uery t%e resu)ts of t%e LogMiner ana)ysis rocess t%roug% t%e AH1'=:%R_0'%4E%4;
'ie!.
7. A LogMiner session ends !it% a ca)) to t%e 8(:;_1'=:%R.E%8_1'=:%R rocedure.
-o see a co))ection of e.am )es using LogMiner, consu)t t%e fo))o!ing tutoria)7
LogMiner by &.am )e
Further "eading
"%i)e t%is guide contained an o'er'ie! to become fami)iar !it% (rac)e LogMiner, it is by no means a substitute for t%e officia) (rac)e documentation *see )ist be)o!,. In addition to t%is guide, users s%ou)d a)so consu)t t%e fo))o!ing (rac)e documents to gain a fu)) understanding of a)ternati'e configuration o tions and additiona) constraints !it% (rac)e LogMiner. (rac)eEs officia) documentation site is docs.orac)e.com.
Using LogMiner to Ana)y1e Redo Log $i)es + 11g Release 2 (11.2 Using LogMiner to Ana)y1e Redo Log $i)es + 1!g Release 2 (1!.2
!%ic% may arise from re)ying on it. I !i)) in no case be )iab)e for any monetary damages arising from suc% )oss, damage or destruction. Last modified on $riday, :<+(ct+B;:B :D7;B7:; &D2age Count7 :H3I: