0D%P0D(#T location #triping dis$ space over sufficient dis$s
About sql_trace parameter SQL_TRACE enables or disables the #- trace facility. #etting this parameter to true provides
information on tuning that you can use to improve performance. Kou can change the value using the DBMS_SYSTEM pac$age
o" to turn on the #- trace, 8MU event in Oracle database and trcsess, t$prof utility Tracing is a important part for Oracle database tuning. This "ill help capture all the problem statement , "ait event "hich are responsible for slo" running of the session. Oracle has provided has many &uic$est "ays to trace the local session, other user session and format the trace to ma$e readable.
-et us ta$e some loo$ at ho" to turn on #- trace, 8MU event in Oracle database and trcsess, t$prof utlity
#- Trace ,8MU event If you "ant to trace in local session,here are the steps to turn on #- trace
!ormal trace
alter session set s&l0trace 1 true4 Z To put trace on alter session set s&l0trace 1 false4 Z To put trace off (ull le/el with wait e/ent %nd bind trace
alter session set events 1 28MU trace name conte)t forever, level 8534 To put tracing off alter session set events 1 28MU trace name conte)t off34 Same as !ormal trace
e)ec DB%#0#(##IO/.set0s&l0trace's&l0trace 19 T>(+4 e)ec DB%#0#(##IO/.set0s&l0trace's&l0trace 19 =A-#(+4 If you "ant to trace in other running session,here are the steps !ormal trace
e)ecute dbms0system.set0s&l0trace0in0session '2sid3,3serial3,true+4 Z To put tracing on e)ecute dbms0system.set0s&l0trace0in0session '2sid3,3serial3,true+4 Z To put tracing off (ull le/el with wait e/ent %nd bind trace
e)ecute dbms0system.set0ev'2sid3,3serial3,8MU,85,33+4 To put trace off
e)ecute dbms0system.set0ev'2sid3,3serial3,8MU,,33+4 Kou must have seen using 85, in various statement above.They are tracing levels.Oracle Tracing has tracing levels .ere are the valid values
/o trace. -i$e s"itching s&l0trace off. The e&uivalent of regular s&l0trace
5 It Provides e)ecution path,ro" counts,smallest flat file M
The same as 5, but "ith the addition of bind variable values The same as 5, but "ith the addition of "ait events
N >egular Trace plus database operation timings that the #- "aited to have done in order to complete. =or e)ampleE dis$ access timings. The same as 5, but "ith both bind variable values and "ait events
85
>egular trace "ith the both the "ait and bind information.
There are other "ays to do the tracing also. ere are some of these 8+ O>AD(B This re&uires login as sysdba
oradebug setospid 8888 Z Debug session "ith the specified Oracle process id
oradebug setorapid 8888 Z Debug session "ith the specified O# process oradebug event 8MU trace name conte)t forever, level M4 oradebug event 8MU trace name conte)t off4 Z This disable the trace oradebug close0trace Z This closes the trace file Oradebug T>A<(=I-(0/A%(4 5+ ith Oracle 8g the #- tracing options have been e)tended using the DB%#0%O/ITO> pac$age (C(<T( dbms0monitor.session0trace0enable
hich is similar A-T(> #(##IO/ #(T ([(/T# 28MU trace name conte)t forever, level 534 (C(<T( dbms0monitor.session0trace0enable 'binds19true+4 hich is similar A-T(> #(##IO/ #(T ([(/T# 28MU trace name conte)t forever, level M34 (C(<T( dbms0monitor.session0trace0enable '"aits19true+4 hich is similar A-T(> #(##IO/ #(T ([(/T# 28MU trace name conte)t forever, level N34 (C(<T( dbms0monitor.session0trace0enable'2sid3,3serialR3+ hich is similar e)ecute dbms0system.set0ev'2sid3,3serial3,8MU,5,33+4 (C(<T( dbms0monitor.session0trace0enable '2sid3,3serialR3,binds19true+4 hich is similar e)ecute dbms0system.set0ev'2sid3,3serial3,8MU,M,33+4
(C(<T( dbms0monitor.session0trace0enable '2sid3,3serialR3,"aits19true+4 hich is similar e)ecute dbms0system.set0ev'2sid3,3serial3,8MU,N,33+4 There are many other functionality available in dbms0monitor. e can enable trace based on client identifier and multiple "ays How to identif. the Trace files
e can identify the trace files using the spid of the session. Also the trace file "ill contain sid,serialR pair at the start of the trace file. Belo" &uery can be used to find the local session trace file select c.value 77 2?3 77 d.instance0name 7730ora03 77 a.spid 77 2.trc3 trace from v\process a, v\session b, v\parameter c, v\instance d "here a.addr 1 b.paddr and b.audsid 1 userenv'2sessionid3+ and c.name 1 2user0dump0dest3 ? There is another easy "ay to identify the trace file "hich is called trace identifier alter session set tracefile0identifer13O>A<34 This is identifier Example trace file
Trace file ?app?oracle?T(#T?diag?rdbms?test?T(#T?trace?T(#T0ora08;5W0ID(/.trc Oracle Database 88g (nterprise (dition >elease 88.5..M. F UMbit Production ith the Partitioning, >eal Application
#unO#85
/ode nameE sun85>eleaseE W.8[ersionE eneric08MMMNN*88 %achineE sunMu Instance nameE T(#T >edo thread mounted by this instanceE 8 Oracle process numberE 55
ni) process pidE 8;5W, imageE oracleV #unO#85 666 58;*8*58 85E5NEWU.MU8 666 #(##IO/ IDE';NXW.8X;M8+ 58;*8*58 85E5NEWU.MU8666 <-I(/T IDE'+ 58;*8*58 85E5NEWU.MU8 666 #(>[I<( /A%(E'T(#T+ 58;*8*58 85E5NEWU.MU8 666 %OD-( /A%(E'#TA/DA>DVsunO#85'T/# [8*[;++ 58;*8*58 85E5NEWU.MU8 666 A
<-O#( RWEc1,e1W,dep18,type1;,tim1NNUUNS88;NW; 111111111111111111111PA>#I/ I/ <>#O> RM len15; dep18 uid18X; oct1; lid18X; tim1NNUUNS88;NU;M hv1;WXWWS5MW8 ad13;aeea;da] s&lid13WWdcXUXajydh;] #(-(
oacdty15 m)l155'58+ m)lc1 mal1 scl1 pre1 oacflg1; fl5185U8 frm1 csi1 si:1 off1X5 $)sbbbfp1ffffffffXdUXXbb bln155 avl18 flg18 value1 (C(< RMEc1,e1;XX,p1,cr1,cu1,mis1,r1,dep18,og18,plh15N5SXWU8,tim1NNUUNS88;NSXN =(T< RMEc1,e15U,p1,cr1;,cu1,mis1,r1,dep18,og18,plh15N5SXWU8,tim1NNUUNS88;SW <-O#( RMEc1,e15,dep18,type1;,tim1NNUUNS88;S88U 111111111111111111111 PA>#I/ I/ <>#O> RW len18S8 dep18 uid18X; oct1; lid18X; tim1NNUUNS88;S;N hv1;;;;N;W ad13;bedfeMN] s&lid13X&sXf)NS8SMu8] #(-(
BindR5 oacdty15 m)l155'58+ m)lc1 mal1 scl1 pre1 oacflg1; fl5185U8 frm1 csi1 si:1 off1MN $)sbbbfp1ffffffffXdUX;baN bln155 avl1M flg18 value188 BindR; oacdty15 m)l155'58+ m)lc1 mal1 scl1 pre1 oacflg1; fl5185U8 frm1 csi1 si:1 off1X5 $)sbbbfp1ffffffffXdUX;bc bln155 avl18 flg18 value1 (C(< RWEc1,e1;XX,p1,cr1,cu1,mis1,r1,dep18,og18,plh15N5SXWU8,tim1NNUUNS88;SU5M =(T< RWEc1,e15U,p1,cr1M,cu1,mis1,r18,dep18,og18,plh15N5SXWU8,tim1NNUUNS88;SUS5 <-O#( RWEc1,e1X,dep18,type1;,tim1NNUUNS88;SX;S111111111111111111111PA>#I/ I/ <>#O> RM len1;WU dep18 uid18X; oct1; lid18X; tim1NNUUNS88;SSW5 hv15MUNXN;8N5 ad13McXeM;SN] s&lid13"m"sjyS$dS5f3 #(-(
oacflg1; fl5185U8 frm18 csi1NX8 si:185N off1 $)sbbbfp1ffffffffXdUX;bWN bln185N avl15; flg1W value1P(>0#(<>ITK0P>O=I-(0ID (C(< RMEc1,e18UM,p1,cr1,cu1,mis1,r1,dep18,og18,plh18;XMSNWMN8,tim1NNUUNS88MSX =(T< RMEc1,e15N,p1,cr1;,cu1,mis1,r18,dep18,og18,plh18;XMSNWMN8,tim1NNUUNS88M8X8 <-O#( RMEc1,e15,dep18,type1;,tim1NNUUNS88M58N 111111111111111111111 PA>#I/ I/ <>#O> RW len15; dep18 uid18X; oct1; lid18X; tim1NNUUNS88M5S hv1;WXWWS5MW8 ad13;aeea;da] s&lid13WWdcXUXajydh;] #(-(
BindR5 oacdty15 m)l155'58+ m)lc1 mal1 scl1 pre1 oacflg1; fl5185U8 frm1 csi1 si:1 off1MN $)sbbbfp1ffffffffXdUX;baN bln155 avl1M flg18 value1W;;M BindR; oacdty15 m)l155'58+ m)lc1 mal1 scl1 pre1 oacflg1; fl5185U8 frm1 csi1 si:1 off1X5 $)sbbbfp1ffffffffXdUX;bc bln155 avl18 flg18 value1 (C(< RWEc1,e1;5W,p1,cr1,cu1,mis1,r1,dep18,og18,plh15N5SXWU8,tim1NNUUNS88MWSS =(T< RWEc1,e18S,p1,cr1;,cu1,mis1,r1,dep18,og18,plh15N5SXWU8,tim1NNUUNS88MUWS<-O#( RWEc1,e18,dep18,type1;,tim1NNUUNS88MX8 111111111111111111111 PA>#I/ I/ <>#O> RM len18S8 dep18 uid18X; oct1; lid18X; tim1NNUUNS88MNM; hv1;;;;N;W ad13;bedfeMN] s&lid13X&sXf)NS8SMu83#(-(
$)sbbbfp1ffffffffXdUX;bXN bln155 avl1; flg1W value158SS BindR8 oacdty15 m)l155'58+ m)lc1 mal1 scl1 pre1 oacflg1; fl5185U8 frm1 csi1 si:1 off15M $)sbbbfp1ffffffffXdUX;bS bln155 avl15 flg18 value1N BindR5 oacdty15 m)l155'58+ m)lc1 mal1 scl1 pre1 oacflg1; fl5185U8 frm1 csi1 si:1 off1MN $)sbbbfp1ffffffffXdUX;baN bln155 avl1M flg18 value188 BindR; oacdty15 m)l155'58+ m)lc1 mal1 scl1 pre1 oacflg1; fl5185U8 frm1 csi1 si:1 off1X5 $)sbbbfp1ffffffffXdUX;bc bln155 avl18 flg18 value1 (C(< RMEc1,e1;5M,p1,cr1,cu1,mis1,r1,dep18,og18,plh15N5SXWU8,tim1NNUUNS88M88W5=(T< RMEc1,e18X,p1,cr1M,cu1,mis1,r18,dep18,og18,plh15N5SXWU8,tim1NNUUNS88M85N <-O#( RMEc1,e1X,dep18,type1;,tim1NNUUNS88M85WU
t$prof utility The trace files obtained from above method is in ra" form "hich can be converted into more readable format using t$prof utility 'Transient !ernel P>O=ile utility+
t$prof sageE t$prof tracefile outputfile e)plain1 J table1 J print1 J insert1 J sys1 J sort1 J table1schema.tablename se 2schema.tablename3 "ith 2e)plain13 option. e)plain1user?pass"ord print1integer
-ist only the first 2integer3 #- statements.
aggregate1yes7no insert1filename -ist #- statements and data inside I/#(>T statements. sys1no
T!P>O= does not list #- statements run as user #K#.
record1filename >ecord non*recursive statements found in the trace file. "aits1yes7no sort1option
>ecord summary for any "ait events found in the trace file. #et of :ero or more of the follo"ing sort optionsE
prscnt number of times parse "as called prscpu cpu time parsing prsela elapsed time parsing
prsds$ number of dis$ reads during parseprs&ry number of
buffers for consistent read during parseprscu number of buffers for current read during parseprsmis number of misses in library cache during parse
e)ecnt number of e)ecute "as called e)ecpu cpu time spent e)ecuting e)eela elapsed time e)ecuting e)eds$ number of dis$ reads during e)ecute e)e&ry number of buffers for consistent read during e)ecute e)ecu number of buffers for current read during e)ecute e)ero" number of ro"s processed during e)ecute
e)emis number of library cache misses during e)ecute fchcnt number of times fetch "as called fchcpu cpu time spent fetching fchela elapsed time fetching fchds$ number of dis$ reads during fetch fch&ry number of buffers for consistent read during fetch fchcu number of buffers for current read during fetch fchro" number of ro"s fetched userid userid of user that parsed the cursor Some examples t$prof file.trc file.t)t sys1no e)plain1userid?pass"ord sort1prsela,e)eela,fchela t$prof file.trc file.t)t sys1no e)plain1userid?pass"ord sort1prsela,e)eela,fchela t$prof file.trc file.t)t sys1no t$prof file.trc file.t)t sys1no e)plain1userid?pass"ord sort1prsela,e)eela,fchela Example content of tkprof file
T!P>O=E >elease 88.5..M. F Production on Tue @an 8X 8ME85EM8 58;
1 number of times O
cpu
1 cpu time in seconds e)ecuting
elapsed 1 elapsed time in seconds e)ecuting dis$ &uery
1 number of physical reads of buffers from dis$ 1 number of buffers gotten for consistent read
current 1 number of buffers gotten in current mode 'usually for update+
ro"s
1 number of ro"s processed by the fetch or e)ecute call
66666666666666666666666666666666666666666666666666666666666666666666666666666666 #- IDE U"N58sggrtys) Plan ashE 5;5WXXUXXW#(-(
=>O% =/D0#(>0D(#!TOP0OB@(
(>( #(>0ID 1 Eb8 A/D APP-I
count
cpu
elapsed
dis$
&uery
current
ro"s
ZZ* ZZ ZZF ZZZ* ZZZ* ZZZ* ZZZ* ZZZ* Parse
8
()ecute
.
8
=etch
5
. .
.
.
.
M
8
ZZ* ZZ ZZF ZZZ* ZZZ* ZZZ* ZZZ* ZZZ* total
M
.
.
M
8
%isses in library cache during parseE Optimi:er modeE A--0>O# Parsing user idE 8X; 'APP#+ /umber of plan statistics capturedE 8 >o"s '8st+ >o"s 'avg+ >o"s 'ma)+ >o" #ource Operation ZZZ* ZZZ* ZZZ* ZZZZZZZZZZZZZZZZZ 8
8
8 #O>T O>D(> BK 'cr1M pr1 p"1 time1 us cost1U si:e1M8 card18+
8
8
8
8
8
8
TAB-( A<<(## BK I/D(C >OID =/D0#(>0D(#!TOP0OB@(
p"1 time1 us cost1W si:e1M8 card18+ 8
8
8
I/D(C >A/( #
can starve for , increasing 2log file sync3 "aits. After all, these system calls and I?O calls must use can also be paged out. This can lead to slo"er response from -> too.
Performance -esson Ehat is a Bind [ariable hat is a Bind [ariableQ *It is a placeholder for a value *In P-?#- it is called a local or global variable. D(<-A>( l0empl0id D(PT.emp0idYTKP(4 B(I/ select first0name from D(PT "here id 1 l0empl0id4 (/D4 *in #-6Plus it is a variable variable a number B(I/ Ea 1 84 dbms0output.put0line'a+4 (/D4* #&l "ithout binds #(-(
o" to create ADD% tas$ and chec$ its report In this post, I "ill e)plain o" to create ADD% tas$ and chec$ its report e are using start snapshot as S And end snapshots as SW B(I/ Z
Z #et the start and end snapshots. DB%#0AD[I#O>.set0tas$0parameter ' tas$0name 19 2S0SW0A>0#/AP#OT3, parameter 19 2#TA>T0#/AP#OT3, value 19 S+4 DB%#0AD[I#O>.set0tas$0parameter ' tas$0name 19 2S0SW0A>0#/AP#OT3, parameter 19 2(/D0#/AP#OT3, value 19 SW+4 Z ()ecute the tas$. DB%#0AD[I#O>.e)ecute0tas$'tas$0name 19 2S0SW0A>0#/AP#OT3,+4 (/D4 ? Z Display the report. #(T -O/ 8 #(T PA(#I_( W #(-(
Oracle A#'Active #ession istory+ seful &ueries %cti/e Session Histor. 'A#+ "as introduced in Oracle 8g. It samples the activity of each active database session every second. The data is held in a buffer in memory in the database.The design goal is to $eep about an hour 'your mileage "ill vary+. If a session is not active it "ill not be sampled. The in*memory buffer is e)posed via a vie" called v\active0session0history. hen an A> snapshot is ta$en, 8 ro" in 8 from the A# buffer is copied do"n into the A> repository. It can also be flushed to dis$ bet"een snapshots "hen the buffer reaches UUY full, so there is no missed data.The data is stored in >\0A
alter system set “_ash_enable”=False; I "ant to emphasi:e that if the session is not active it "ill not be sampled. Kou can actually set a parameter 0ash0enable0all 1 T>( to force all sessions, including idle sessions, to be
sampledSome important points in this regard 8+Oracle has provided a pac$age called DB%#0APP-I
SELECT sql_id,COUNT(!,"OUN#(COUNT(!$SU%(COUNT(!! O&E"(!, '! CTLO)# F"O% *+a-ti+e_sessi.n_hist.ry /0E"E sam1le_time 2 S3S#)TE 4 5$'6 )N# sessi.n_ty1e = 78)C9:"OUN# :"OU 83 sql_id O"#E" 83 COUNT(! #ESC; SELECT sql_id,COUNT(!,"OUN#(COUNT(!$SU%(COUNT(!! O&E"(!, '! CTLO)# F"O% *+a-ti+e_sessi.n_hist.ry /0E"E sam1le_time 2 S3S#)TE 4 5$'6 )N# sessi.n_ty1e = 7FO"E:"OUN# :"OU 83 sql_id O"#E" 83 COUNT(! #ESC; ;+ To find out the wait e/ents for which this session
SELECT sam1le_time, e+ent,
=>O% gv\active0session0history (>( sample0time 9 #K#DAT( F 8?5M A/D session0type 1 2BAO/D3 >OP BK s&l0id O>D(> BK
W+ #ost 67O intensi/e s0l in last : hour #(-(
U+"ocking information in last : min
col event for a55
col bloc$0type for a8N col objn for a8N col otype for a8 col fn for SS col sid for SSSS col bsid for SSSS col lm for SS col p; for SSSSS col bloc$n for SSSSS select to0char'sample0time,3E%I3+ st, substr'event,,5+ event, a.session0id sid, mod'a.p8,8U+ lm, a.p5, a.p;, nvl'o.object0name,ash.current0objR+ objn, substr'o.object0type,,8+ otype, <>>(/T0=I-(R fn, <>>(/T0B-O
all0objects o "here event li$e 2en&E TCY3 and o.object0id '`+1 a.<>>(/T0OB@R and sample0time 9 sysdate F M?'U65M+ Order by sample0time ?
X+ top s0ls spent more on cpu7wait7io select
ash.#-0ID , sum'decode'a.session0state,3O/
How To 4enerate %SH Report
Oracle Provide a standard script just li$e A> to analy:e the A#% data I "ill e)plain ho" to generate A#'Active #ession istory+ reports from #-P-#. The same can be done using (nterprise %anager also.
#cript -ocation is same as other standard script \O>A<-(0O%(?rdbms?admin? #-9 V\O>A<-(0O%(?rdbms?admin?ashrpt.s&l
All about A> ' Automatic or$load >epository+ What is %WR?
Automatic or$load >epository 'A>+ is a collection of persistent system performance statistics o"ned by the #K# user. It resides in #K#AC tablespace. By default snapshot are generated once every Umin and maintained for X days.A> report are used to investigate performance and other issues. Script %/ailabe in 9OR%2"E;HO#E7rdbms7admin awrrpt.sql EDepending on the reasons for collecting the report, the default can be used, or for a more focused vie", a short 8*8W minute snapshot could be used.awrrpti.sql EDisplays statistics for a range of snapshot Ids on a specified database and instance. awrsqrpt.sql EDisplays statistics of a particular #- statement for a range of snapshot Ids. >un this report to inspect or debug the performance of a particular #- statement. awrsqrpi.sql EDisplays statistics of a particular #- statement for a range of snapshot Ids on a specified #-. awrddrpt.sql E
-seful Operations on %WR
a+ o" to %odify the a"r snapshot settings. B(I/ DB%#0O>!-OAD0>(PO#ITO>K.modify0snapshot0settings' retention 19 58U, Z %inutes '58U 1 8W Days+. Z
b+ Dropping the A> snaps in rangeE B(I/ DB%#0O>!-OAD0>(PO#ITO>K.drop0snapshot0range' 'lo"0snap0id19M, igh0snap0id19N+4 (/D4 ?
c+
Oracle DBAE anganaly:e and system state dump %any times Oracle database get hangs due to loc$s or latching issue and /obody can login to the system. It becomes critical and And sually "e do shutdo"n abort to immediately resolve the issue. But it is good to ta$e system state dump?hanganaly:e at 8 min interval to analy:e the loc$ing or latching issue after"ards before doing shutdo"n abort so that "e can find the fi) for the problem and avoid that in future.Oracle #upport also usually as$ for these "hen the database hangs for some reason Here are the steps to take s.stem state dump
In >A< system this need to be e)ecuted on all the instance #ynta) for system state dumpE -ogon to s&lplus as sysdba #-9 oradebug setmypid #-9 oradebug unlimit #-9 oradebug dump systemstate 8 .. ait at least 8 min #-9 oradebug dump systemstate 8 .. ait at lease 8 min #-9 oradebug dump systemstate 8 #imilarly anganaly:e is a good utility to analysis. Here are the steps
#ynta) for hangaanaly:e for single instance -ogon to s&lplus as sysdba oradebug setmypid4 oradebug unlimit4 oradebug hanganaly:e ;4 #ynta) for hanganaly:e for >A< -ogon to s&lplus as sysdba oradebug setmypid4 oradebug unlimit4 oradebug setinst all oradebug *g def hanganaly:e ; #ometimes it is not possible to even login "ith s&lplus ? as sysdba at the time of hang, In that situation "e can use belo" command to enter "ith 88g on"ards s&lplus *prelim ? as sysdba
Oracle ait (vents That (veryone #hould !no" Part *8 This is part I in series of Oracle ait (vents That (veryone #hould !no" ere are some of the
I am trying to e)plain fe" common Oracle "ait events ,there causes and resolutions en0ueue
The process is "aiting on an en&ueue 'a loc$ you can see in v\loc$+. This commonly occurs "hen one user is trying to update a ro" in a table that is currently being updated by another user. The bloc$ers can be find out by using follo"ing &uery select 6 from dba0"aiters librar. cache pin The process "ants to pin an object in memory in the library cache for e)amination, ensuring no other processes can update the object at the same time. This happens "hen you are compiling or parsing a P-?#- object or a vie". Avoid compiling P-?#- object or vie" at high usage time to avoid this "ait event
librar. cache load lock The process is "aiting for the opportunity to load an object or a piece of an object into the library cache. 'Only one process can load an object or a piece of an object at a time.+ latch free The process is "aiting for a latch held by another process. 'This "ait event does not apply to processes that are spinning "hile "aiting for a latch4 "hen a process is spinning, it is not "aiting.+.-atches are light"eight seriali:ation devices used to coordinate multiuser access to shared data structures, objects, and files. -atches are loc$s designed to be held for e)tremely short periods of time for e)ample, the time it ta$es to modify an in*memory data structure. They are used to protect certain memory structures, such as the database bloc$ buffer cache or the library cache in the shared pool. -atches are typically re&uested internally in a 2"illing to "ait3 mode. This means that if the latch is not available, the re&uesting session "ill sleep for a short period of time and retry the operation later. Other latches may be re&uested in an 2immediate3 mode, "hich is similar in concept to a #(-(
Oracle ait (vents That (veryone #hould !no" part*II This is part II in series of Oracle ait (vents That (veryone #hould !no" control file se0uential read The process is "aiting for bloc$s to be read from a control file. This happens generally • • • •
ma$ing a bac$up of the controlfiles sharing information 'bet"een instances+ from the controlfile reading other bloc$s from the controlfiles reading the header bloc$
If this is major "aiting event, it means control file location need to changed to faster dis$ location
control file parallel write The process has issued multiple I?O re&uests in parallel to "rite bloc$s to all control files, and is "aiting for all of the "rites to complete. log buffer space The process is "aiting for space to become available in the log buffer '#pace becomes available only after -> has "ritten the current contents of the log buffer to dis$.+ This typically happens "hen applications generate redo faster than -> can "rite it to dis$.
This can also happen, if the I?O to dis$ "here redo logs are located is slo" There should be no log buffer space "aits as such in the database.
A slo" -> process can introduce log file sync "aits "hich ma$es the user to e)perience "ait times during commit or rollbac$. The log file parallel "rite and log file sync "ait events are interrelated and must be dealt simultaneously.
e must try to allocate the redo logs to high performance dis$'#olid state dis$+. Also "e should try to reduce the load on -> by reducing commits in the applications. The manual hotbac$up piece can also introduce stress in the system by generating lot of redo stuff,#o avoid that during pea$ time #ometimes -> is starving for
Oracle ait (vents That (veryone #hould !no" Part *III -ets get going "ith the Third part db file scattered read The process has issued an I?O re&uest to read a series of contiguous bloc$s from a data file into the buffer cache, and is "aiting for the operation to complete. This typically happens during a full table scan or full inde) scan.
e should chec$ if the &uery should be using full table scan. %a$e sure optimi:er stats are p to date. se Partition pruning to reduce number of bloc$s visited If an &uery that has been running fine for a "hile suddenly cloc$s a lot of time on the db file scattered read event and there hasn3t been a code change, you might "ant to chec$ to see if one or more inde)es has been dropped or become unusable. db file se0uential read The process has issued an I?O re&uest to read one bloc$ from a data file into the buffer cache, and is "aiting for the operation to complete. This typically happens during an inde) loo$up or a fetch from a table by >OID "hen the re&uired data bloc$ is not already in memory. Do not be misled by the confusing name of this "ait eventL
e should be chec$ing if the right inde)es are being used. A "rong inde) can ma$e the &uery perform badly.%a$e sure optimi:er stats are p to date. db file parallel read The process has issued multiple I?O re&uests in parallel to read bloc$s from data files into memory, and is "aiting for all re&uests to complete. The documentation says this "ait event occurs only during recovery, but in fact it also occurs during regular activity "hen a process batches many single bloc$ I?O re&uests together and issues them in parallel. 'In spite of the
name, you "ill not see this "ait event during parallel &uery or parallel D%-. In those cases "ait events "ith PC in their names occur instead.+ db file parallel write The process, typically DB>, has issued multiple I?O re&uests in par allel to "rite dirty bloc$s from the buffer cache to dis$, and is "aiting for all re&uests to complete. direct path read< direct path write The process has issued asynchronous I?O re&uests that bypass the buffer cache, and is "aiting for them to complete. These "ait events typically involve sort segments.
#- statements "ith functions that re&uire sorts, such as O>D(> BK, >OP BK, /IO/, DI#TI/
The shared pool latch is used to protect critical operations "hen allocating and freeing memory in the shared pool.
o" to find "hich sid is doing full table scan %any times the 1er?.rman-e .? the database
-.lAmn r.
Optimi=er
/e" Optimi:er =eature "ith 88g !ew Optimi=er (eature with ::g
8+ Invisible inde)es ith 88g release,inde) can be made invisible. They "ill be maintained all the time and can be made visible any time alter inde) ! invisible4 Optimi:er "ill not use the inde) if it is invisible alter inde) ! visible If "ant one &uery to use invisible inde),"e can set this parameter in the session optimi:er0use0invisible0inde)1true Then the &uery in the session "ill use the invisible inde) 5+()tented stats on the table If "e use any function on the predicate in the &uery,the optimi:er is not able to get the selectivity properly.ith 88g "e can create e)tented stats on the column for the function .
e)ec dbms0stats.create0e)tented0stats'o"nname 19 2O/3,tab0name19 2TAB3 ,e)tension19 2func'col+3+4 Then optimi:er "ill be able to find the correct selectivity
o" to use Optimi:er hints What is Optimi=er? hen a &uery is submitted in Oracle server. optimi:er attempts to generate the best e)ecution plan for a #- statement. The best e)ecution plan is defined as the plan "ith the lo"est cost among all considered candidate plans. The cost computation accounts for factors of &uery e)ecution such as I?O,
The best method of e)ecution depends on myriad conditions including ho" the &uery is "ritten, the si:e of the data set, the layout of the data, and "hich access structures e)ist. The optimi:er determines the best plan for a #- statement by e)amining multiple access methods, such as full table scan or inde) scans, and different join methods such as nested loops and hash joins. What is a Optimi=er Hint Q Optimi:er ints are clause that used in s&l &ueries to force the optimi:er to ta$e particular route li$e using inde),nested loop join.S.ntax to use hint
?6` ^ int name96? Some of commonl. used hint
#(-(
[arious @oins %ethod in Oracle Performance is $ey for O-TP system and "e should have good information about @oins %ethod in Oracle to increase performance for s&l &ueries ere are the @oins %ethod in Oracle available in Oracle database
!ested "oops *=or each ro" in the first ro" source access all the ro"s from the second ro" source. *Best for O-TP type transactions *it "ill be =astest if ro"s returned from first table are small *The optimi:er first determine the driving table and designates it as the outer loop.This is the driving ro" source. It produces a set of ro"s for driving the join condition. The ro" source can be a table accessed using inde) scan or full table scan. The ro"s can be produced from any other operation too. =or e)ample the output from a /ested -oop @oin can be used as a ro" source. *The optimi:er designate other table as inner -oop.This is iterated for every ro" returned from the outer loop. This is an access operation on a table and ideally should be an inde) scan. *Operation performed by I//(> table is repeated for every ro" returned in OT(> table *If the optimi:er is choosing to use some other join method, you can use the #(0/-'A B+ hint, "here A and B are the aliases of the tables being joined.
Plan ZZZZZZZZZZZZZZZZ* #(-(