8 Memory Architecture: Introduction To Oracle Memory Structures
The document discusses Oracle Database memory architecture. It describes the system global area (SGA) which is shared memory for the instance. The SGA contains structures like the buffer cache, log buffer, shared pool and other information. It also describes program global areas (PGA) which are memory private to each process.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
90 views21 pages
8 Memory Architecture: Introduction To Oracle Memory Structures
The document discusses Oracle Database memory architecture. It describes the system global area (SGA) which is shared memory for the instance. The SGA contains structures like the buffer cache, log buffer, shared pool and other information. It also describes program global areas (PGA) which are memory private to each process.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21
Oracle Database Concepts
10g Release 2 (10.2)
B14220-02 Home Book List Contents Index Master Index Contact Us Previous Next PDF ! Mo"i ! ePu" 8 Memory Architectre #$is c$a%ter discusses t$e memor& arc$itecture o' an (rac)e instance* #$is c$a%ter contains t$e 'o))o+in, to%ics- Introduction to (rac)e Memor& .tructures (vervie+ o' t$e .&stem /)o"a) 0rea (vervie+ o' t$e Pro,ram /)o"a) 0reas Dedicated and .$ared .ervers .o't+are Code 0reas !ntro"ction to Oracle Memory #trctres (rac)e uses memor& to store in'ormation suc$ as t$e 'o))o+in,- Pro,ram code In'ormation a"out a connected session1 even i' it is not current)& active In'ormation needed durin, %ro,ram execution 2'or exam%)e1 t$e current state o' a 3uer& 'rom +$ic$ ro+s are "ein, 'etc$ed4 In'ormation t$at is s$ared and communicated amon, (rac)e %rocesses 2'or exam%)e1 )ockin, in'ormation4 Cac$ed data t$at is a)so %ermanent)& stored on %eri%$era) memor& 2'or exam%)e1 data ")ocks and redo )o, entries4 #$e "asic memor& structures associated +it$ (rac)e inc)ude- .&stem /)o"a) 0rea 2./041 +$ic$ is s$ared "& a)) server and "ack,round %rocesses* Pro,ram /)o"a) 0reas 2P/041 +$ic$ is %rivate to eac$ server and "ack,round %rocess5 t$ere is one P/0 'or eac$ %rocess* Fi,ure 6-1 i))ustrates t$e re)ations$i%s amon, t$ese memor& structures* $igre 8%1 Oracle Memory #trctres Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 1 of 21 5/6/2014 11:22 AM Descri%tion o' 7Fi,ure 6-1 (rac)e Memor& .tructures7 .o't+are code areas are anot$er "asic memor& structure* #ee Also& 7(vervie+ o' t$e .&stem /)o"a) 0rea7 7(vervie+ o' t$e Pro,ram /)o"a) 0reas7 7.o't+are Code 0reas7 O'er'ie( o) the #ystem *lobal Area 0 system global area 2./04 is a ,rou% o' s$ared memor& structures t$at contain data and contro) in'ormation 'or one (rac)e data"ase instance* I' mu)ti%)e users are concurrent)& connected to t$e same instance1 t$en t$e data in t$e instance8s ./0 is s$ared amon, t$e users* Conse3uent)&1 t$e ./0 is sometimes ca))ed t$e share" global area* 0n ./0 and (rac)e %rocesses constitute an (rac)e instance* (rac)e automatica))& a))ocates memor& 'or an ./0 +$en &ou start an instance1 and t$e o%eratin, s&stem rec)aims t$e memor& +$en &ou s$ut do+n t$e instance* 9ac$ instance $as its o+n ./0* #$e ./0 is read:+rite* 0)) users connected to a mu)ti%)e-%rocess data"ase instance can read in'ormation contained +it$in t$e instance8s ./01 and severa) %rocesses +rite to t$e ./0 durin, execution o' (rac)e* #$e ./0 contains t$e 'o))o+in, data structures- Data"ase "u''er cac$e ;edo )o, "u''er Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 2 of 21 5/6/2014 11:22 AM .$ared %oo) <ava %oo) Lar,e %oo) 2o%tiona)4 .treams %oo) Data dictionar& cac$e (t$er misce))aneous in'ormation Part o' t$e ./0 contains ,enera) in'ormation a"out t$e state o' t$e data"ase and t$e instance1 +$ic$ t$e "ack,round %rocesses need to access5 t$is is ca))ed t$e )i+e" #*A* No user data is stored $ere* #$e ./0 a)so inc)udes in'ormation communicated "et+een %rocesses1 suc$ as )ockin, in'ormation* I' t$e s&stem uses s$ared server arc$itecture1 t$en t$e re3uest and res%onse 3ueues and some contents o' t$e P/0 are in t$e ./0* #ee Also& 7Introduction to an (rac)e Instance7 'or more in'ormation a"out an (rac)e instance 7(vervie+ o' t$e Pro,ram /)o"a) 0reas7 7Dis%atc$er ;e3uest and ;es%onse =ueues7 ,he #*A-MA.-#!/0 !nitiali1ation 2arameter #$e ./0 com%rises a num"er o' memor& components1 +$ic$ are %oo)s o' memor& used to satis'& a %articu)ar c)ass o' memor& a))ocation re3uests* 9xam%)es o' memor& com%onents inc)ude t$e s$ared %oo) 2used to a))ocate memor& 'or .=L and PL:.=L execution41 t$e >ava %oo) 2used 'or >ava o">ects and ot$er >ava execution memor&41 and t$e "u''er cac$e 2used 'or cac$in, disk ")ocks4* 0)) ./0 com%onents a))ocate and dea))ocate s%ace in units o' granles* (rac)e Data"ase tracks ./0 memor& use in interna) num"ers o' ,ranu)es 'or eac$ ./0 com%onent* /ranu)e si?e is determined "& tota) ./0 si?e* (n most %)at'orms1 t$e si?e o' a ,ranu)e is 4 MB i' t$e tota) ./0 si?e is )ess t$an 1 /B1 and ,ranu)e si?e is 1@MB 'or )ar,er ./0s* .ome %)at'orm de%endencies arise* For exam%)e1 on A2-"it Bindo+s1 t$e ,ranu)e si?e is 6 M 'or ./0s )ar,er t$an 1 /B* (rac)e Data"ase can set )imits on $o+ muc$ virtua) memor& t$e data"ase uses 'or t$e ./0* It can start instances +it$ minima) memor& and a))o+ t$e instance to use more memor& "& ex%andin, t$e memor& a))ocated 'or ./0 com%onents1 u% to a maximum determined "& t$e SGA_MAX_SIZE initia)i?ation %arameter* I' t$e va)ue 'or SGA_MAX_SIZE in t$e initia)i?ation %arameter 'i)e or server %arameter 'i)e 2SPFILE4 is )ess t$an t$e sum t$e memor& a))ocated 'or a)) com%onents1 eit$er ex%)icit)& in t$e %arameter 'i)e or "& de'au)t1 at t$e time t$e instance is initia)i?ed1 t$en t$e data"ase i,nores t$e settin, 'or SGA_MAX_SIZE* Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 3 of 21 5/6/2014 11:22 AM For o%tima) %er'ormance in most s&stems1 t$e entire ./0 s$ou)d 'it in rea) memor&* I' it does not1 and i' virtua) memor& is used to store %arts o' it1 t$en overa)) data"ase s&stem %er'ormance can decrease dramatica))&* #$e reason 'or t$is is t$at %ortions o' t$e ./0 are %a,ed 2+ritten to and read 'rom disk4 "& t$e o%eratin, s&stem* #$e amount o' memor& dedicated to a)) s$ared areas in t$e ./0 a)so $as %er'ormance im%act* #$e si?e o' t$e ./0 is determined "& severa) initia)i?ation %arameters* #$e 'o))o+in, %arameters $ave t$e ,reatest e''ect on ./0 si?e- 2arameter Description DB_CACHE_SIZE #$e si?e o' t$e cac$e o' standard ")ocks* LOG_BUFFER #$e num"er o' "&tes a))ocated 'or t$e redo )o, "u''er* SHARED_POOL_SIZE #$e si?e in "&tes o' t$e area devoted to s$ared .=L and PL:.=L statements* LARGE_POOL_SIZE #$e si?e o' t$e )ar,e %oo)5 t$e de'au)t is 0* JAVA_POOL_SIZE #$e si?e o' t$e <ava %oo)* Atomatic #hare" Memory Management In %revious data"ase re)eases1 a data"ase administrator 2DB04 +as re3uired to manua))& s%eci'& di''erent ./0 com%onent si?es "& settin, a num"er o' initia)i?ation %arameters1 inc)udin, t$e SHARED_POOL_SIZE1 DB_CACHE_SIZE1 JAVA_POOL_SIZE1 and LARGE_POOL_SIZE %arameters* (rac)e Data"ase 10, inc)udes t$e 0utomatic .$ared Memor& Mana,ement 'eature +$ic$ sim%)i'ies t$e ./0 memor& mana,ement si,ni'icant)&* In (rac)e Data"ase 10,1 a DB0 can sim%)& s%eci'& t$e tota) amount o' ./0 memor& avai)a")e to an instance usin, t$e SGA_TARGET initia)i?ation %arameter and t$e (rac)e Data"ase +i)) automatica))& distri"ute t$is memor& amon, various su"com%onents to ensure most e''ective memor& uti)i?ation* B$en automatic ./0 memor& mana,ement is ena")ed1 t$e si?es o' t$e di''erent ./0 com%onents are ')exi")e and can ada%t to t$e needs o' a +ork)oad +it$out re3uirin, an& additiona) con'i,uration* #$e data"ase automatica))& distri"utes t$e avai)a")e memor& amon, t$e various com%onents as re3uired1 a))o+in, t$e s&stem to maximi?e t$e use o' a)) avai)a")e ./0 memor&* Consider a manua) con'i,uration in +$ic$ 1 /B o' memor& is avai)a")e 'or t$e ./0 and distri"uted to t$e 'o))o+in, initia)i?ation %arameters- SHARED_POOL_SIZE=128M DB_CACHE_SIZE=896M I' an a%%)ication attem%ts to a))ocate more t$an 126 MB o' memor& 'rom t$e s$ared %oo)1 an error is raised t$at indicates t$at t$e avai)a")e s$ared %oo) $as "een ex$austed* #$ere cou)d "e 'ree memor& in t$e "u''er cac$e1 "ut t$is memor& is not accessi")e to t$e s$ared %oo)* Cou +ou)d $ave to manua))& resi?e t$e "u''er cac$e and t$e s$ared %oo) to +ork around t$is %ro")em* Bit$ automatic ./0 mana,ement1 &ou can sim%)& set t$e SGA_TARGET initia)i?ation %arameter to 1G* I' an a%%)ication needs more s$ared %oo) memor&1 it can o"tain t$at memor& "& ac3uirin, it 'rom t$e 'ree Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 4 of 21 5/6/2014 11:22 AM memor& in t$e "u''er cac$e* .ettin, a sin,)e %arameter ,reat)& sim%)i'ies t$e administration task* Cou s%eci'& on)& t$e amount o' ./0 memor& t$at an instance $as avai)a")e and 'or,et a"out t$e si?es o' individua) com%onents* No out o' memor& errors are ,enerated un)ess t$e s&stem $as actua))& run out o' memor&* 0utomatic ./0 mana,ement can en$ance +ork)oad %er'ormance +it$out re3uirin, an& additiona) resources or manua) tunin, e''ort* Bit$ manua) con'i,uration o' t$e ./01 it is %ossi")e t$at com%i)ed .=L statements 're3uent)& a,e out o' t$e s$ared %oo) "ecause o' its inade3uate si?e* #$is can increase t$e 're3uenc& o' $ard %arses1 )eadin, to reduced %er'ormance* B$en automatic ./0 mana,ement is ena")ed1 t$e interna) tunin, a),orit$m monitors t$e %er'ormance o' t$e +ork)oad1 increasin, t$e s$ared %oo) i' it determines t$e increase +i)) reduce t$e num"er o' %arses re3uired* #ee Also& (rac)e Data"ase 0dministrator8s /uide (rac)e Data"ase Per'ormance #unin, /uide ,he #*A-,AR*0, !nitiali1ation 2arameter #$e SGA_TARGET initia)i?ation %arameter re')ects t$e tota) si?e o' t$e ./0 and inc)udes memor& 'or t$e 'o))o+in, com%onents- Fixed ./0 and ot$er interna) a))ocations needed "& t$e (rac)e Data"ase instance #$e )o, "u''er #$e s$ared %oo) #$e <ava %oo) #$e "u''er cac$e #$e kee% and rec&c)e "u''er cac$es 2i' s%eci'ied4 Nonstandard ")ock si?e "u''er cac$es 2i' s%eci'ied4 #$e .treams %oo) It is si,ni'icant t$at SGA_TARGET inc)udes t$e entire memor& 'or t$e ./01 in contrast to ear)ier re)eases in +$ic$ memor& 'or t$e interna) and 'ixed ./0 +as added to t$e sum o' t$e con'i,ured ./0 memor& %arameters* #$us1 SGA_TARGET ,ives &ou %recise contro) over t$e si?e o' t$e s$ared memor& re,ion a))ocated "& t$e data"ase* I' SGA_TARGET is set to a va)ue ,reater t$an SGA_MAX_SIZE at startu%1 t$en t$e )atter is "um%ed u% to accommodate SGA_TARGET* 3ote& Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 5 of 21 5/6/2014 11:22 AM Do not d&namica))& set or unset t$e SGA_TARGET %arameter* #$is s$ou)d "e set on)& at startu%* Atomatically Manage" #*A Components B$en &ou set a va)ue 'or SGA_TARGET1 (rac)e Data"ase 10, automatica))& si?es t$e most common)& con'i,ured com%onents1 inc)udin,- #$e s$ared %oo) 2'or .=L and PL:.=L execution4 #$e <ava %oo) 2'or <ava execution state4 #$e )ar,e %oo) 2'or )ar,e a))ocations suc$ as ;M0N "acku% "u''ers4 #$e "u''er cac$e #$e .treams %oo) Cou need not set t$e si?e o' an& o' t$ese com%onents ex%)icit)&* B& de'au)t t$e %arameters 'or t$ese com%onents +i)) a%%ear to $ave va)ues o' ?ero* B$enever a com%onent needs memor&1 it can re3uest t$at it "e trans'erred 'rom anot$er com%onent "& +a& o' t$e interna) automatic tunin, mec$anism* #$is trans'er o' memor& occurs trans%arent)&1 +it$out user intervention* #$e %er'ormance o' eac$ o' t$ese automatica))& si?ed com%onents is monitored "& t$e (rac)e Data"ase instance* #$e instance uses interna) vie+s and statistics to determine $o+ to distri"ute memor& o%tima))& amon, t$e com%onents* 0s t$e +ork)oad c$an,es1 memor& is redistri"uted to ensure o%tima) %er'ormance* #o ca)cu)ate t$e o%tima) distri"ution o' memor&1 t$e data"ase uses an a),orit$m t$at takes into consideration "ot$ )on,-term and s$ort-term trends* Manally Manage" #*A Components #$ere are a 'e+ ./0 com%onents +$ose si?es are not automatica))& ad>usted* #$e administrator needs to s%eci'& t$e si?es o' t$ese com%onents ex%)icit)&1 i' needed "& t$e a%%)ication* .uc$ com%onents are- Dee%:;ec&c)e "u''er cac$es 2contro))ed "& DB_KEEP_CACHE_SIZE and DB_RECYCLE_CACHE_SIZE4 0dditiona) "u''er cac$es 'or non-standard ")ock si?es 2contro))ed "& DB_nK_CACHE_SIZE1 n E F21 41 61 1@1 A2G4 #$e si?es o' t$ese com%onents is determined "& t$e administrator-de'ined va)ue o' t$eir corres%ondin, %arameters* #$ese va)ues can1 o' course1 "e c$an,ed an& time eit$er usin, 9nter%rise Mana,er or 'rom t$e command )ine +it$ an ALTER SYSTEM statement* #$e memor& consumed "& manua))& si?ed com%onents reduces t$e amount o' memor& avai)a")e 'or automatic ad>ustment* For exam%)e1 in t$e 'o))o+in, con'i,uration- SGA_TARGET = 26M DB_8K_CACHE_SIZE = !2M Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 6 of 21 5/6/2014 11:22 AM #$e instance $as on)& 224 MB 22H@ - A24 remainin, to "e distri"uted amon, t$e automatica))& si?ed com%onents* 2ersistence o) Atomatically ,ne" 4ales (rac)e Data"ase remem"ers t$e si?es o' t$e automatica))& tuned com%onents across instance s$utdo+ns i' &ou are usin, a server %arameter 'i)e 2SPFILE4* 0s a resu)t1 t$e s&stem does need to )earn t$e c$aracteristics o' t$e +ork)oad a,ain eac$ time an instance is started* It can "e,in +it$ in'ormation 'rom t$e %ast instance and continue eva)uatin, +ork)oad +$ere it )e't o'' at t$e )ast s$utdo+n* A""ing *ranles an" ,rac5ing Component #i1e 0 data"ase administrator ex%ands t$e ./0 use o' a com%onent +it$ an ALTER SYSTEM statement to modi'& t$e va)ues o' t$e initia)i?ation %arameters associated +it$ t$e res%ective com%onents* (rac)e Data"ase rounds u% t$e ne+)& s%eci'ied si?e to t$e nearest mu)ti%)e o' 1@MB and adds or removes ,ranu)es to meet t$e tar,et si?e* #$e data"ase must $ave enou,$ 'ree ,ranu)es to satis'& t$e re3uest* 0s )on, as t$e current amount o' ./0 memor& is )ess t$an SGA_MAX_SIZE1 t$e data"ase can a))ocate more ,ranu)es unti) t$e ./0 si?e reac$es SGA_MAX_SIZE* #$e ,ranu)e si?e t$at is current)& "ein, used 'or t$e ./0 'or eac$ com%onent can "e vie+ed in t$e vie+ V"SGAI#FO* #$e si?e o' eac$ com%onent and t$e time and t&%e o' t$e )ast resi?e o%eration %er'ormed on eac$ com%onent can "e vie+ed in t$e vie+ V"SGA_DY#AMIC_COMPO#E#TS* #$e data"ase maintains a circu)ar "u''er o' t$e )ast 400 resi?e o%erations made to ./0 com%onents* Cou can vie+ t$e circu)ar "u''er in t$e V"SGA_RESIZE_OPS vie+* 3ote& I' &ou s%eci'& a si?e 'or a com%onent t$at is not a mu)ti%)e o' ,ranu)e si?e1 t$en (rac)e rounds t$e s%eci'ied si?e u% to t$e nearest mu)ti%)e* For exam%)e1 i' t$e ,ranu)e si?e is 4 MB and &ou s%eci'& DB_CACHE_SIZE as 10 MB1 &ou +i)) actua))& "e a))ocated 12 MB* #ee Also& (rac)e Data"ase 0dministrator8s /uide 'or in'ormation on a))ocatin, memor& (rac)e Data"ase 2 Da& DB0 'or in'ormation on s$o+in, t$e ./0 si?e +it$ 9nter%rise Mana,er .=LIP)us User8s /uide and ;e'erence 'or in'ormation on dis%)a&in, t$e ./0 si?e +it$ .=LIP)us (rac)e Data"ase ;e'erence 'or in'ormation on V"SGASTAT Cour (rac)e insta))ation or user8s ,uide 'or in'ormation s%eci'ic to &our o%eratin, s&stem Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 7 of 21 5/6/2014 11:22 AM Database 6))er Cache #$e data"ase "u''er cac$e is t$e %ortion o' t$e ./0 t$at $o)ds co%ies o' data ")ocks read 'rom data'i)es* 0)) user %rocesses concurrent)& connected to t$e instance s$are access to t$e data"ase "u''er cac$e* #$e data"ase "u''er cac$e and t$e s$ared .=L cac$e are )o,ica))& se,mented into mu)ti%)e sets* #$is or,ani?ation into mu)ti%)e sets reduces contention on mu)ti%rocessor s&stems* Organi1ation o) the Database 6))er Cache #$e "u''ers in t$e cac$e are or,ani?ed in t+o )ists- t$e +rite )ist and t$e )east recent)& used 2L;U4 )ist* #$e (rite list $o)ds dirt& "u''ers1 +$ic$ contain data t$at $as "een modi'ied "ut $as not &et "een +ritten to disk* #$e 7R8 list $o)ds 'ree "u''ers1 %inned "u''ers1 and dirt& "u''ers t$at $ave not &et "een moved to t$e +rite )ist* $ree b))ers do not contain an& use'u) data and are avai)a")e 'or use* 2inne" b))ers are current)& "ein, accessed* B$en an (rac)e %rocess accesses a "u''er1 t$e %rocess moves t$e "u''er to t$e most recent)& used 2M;U4 end o' t$e L;U )ist* 0s more "u''ers are continua))& moved to t$e M;U end o' t$e L;U )ist1 dirt& "u''ers a,e to+ard t$e L;U end o' t$e L;U )ist* #$e 'irst time an (rac)e user %rocess re3uires a %articu)ar %iece o' data1 it searc$es 'or t$e data in t$e data"ase "u''er cac$e* I' t$e %rocess 'inds t$e data a)read& in t$e cac$e 2a cache hit41 it can read t$e data direct)& 'rom memor&* I' t$e %rocess cannot 'ind t$e data in t$e cac$e 2a cache miss41 it must co%& t$e data ")ock 'rom a data'i)e on disk into a "u''er in t$e cac$e "e'ore accessin, t$e data* 0ccessin, data t$rou,$ a cac$e $it is 'aster t$an data access t$rou,$ a cac$e miss* Be'ore readin, a data ")ock into t$e cac$e1 t$e %rocess must 'irst 'ind a 'ree "u''er* #$e %rocess searc$es t$e L;U )ist1 startin, at t$e )east recent)& used end o' t$e )ist* #$e %rocess searc$es eit$er unti) it 'inds a 'ree "u''er or unti) it $as searc$ed t$e t$res$o)d )imit o' "u''ers* I' t$e user %rocess 'inds a dirt& "u''er as it searc$es t$e L;U )ist1 it moves t$at "u''er to t$e +rite )ist and continues to searc$* B$en t$e %rocess 'inds a 'ree "u''er1 it reads t$e data ")ock 'rom disk into t$e "u''er and moves t$e "u''er to t$e M;U end o' t$e L;U )ist* I' an (rac)e user %rocess searc$es t$e t$res$o)d )imit o' "u''ers +it$out 'indin, a 'ree "u''er1 t$e %rocess sto%s searc$in, t$e L;U )ist and si,na)s t$e DBB0 "ack,round %rocess to +rite some o' t$e dirt& "u''ers to disk* #ee Also& 7Data"ase Briter Process 2DBBn47 'or more in'ormation a"out DBBn %rocesses ,he 7R8 Algorithm an" $ll ,able #cans B$en t$e user %rocess is %er'ormin, a 'u)) ta")e scan1 it reads t$e ")ocks o' t$e ta")e into "u''ers and %uts t$em on t$e L;U end 2instead o' t$e M;U end4 o' t$e L;U )ist* #$is is "ecause a 'u))& scanned ta")e usua))& is needed on)& "rie')&1 so t$e ")ocks s$ou)d "e moved out 3uick)& to )eave more 're3uent)& used Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 8 of 21 5/6/2014 11:22 AM ")ocks in t$e cac$e* Cou can contro) t$is de'au)t "e$avior o' ")ocks invo)ved in ta")e scans on a ta")e-"&-ta")e "asis* #o s%eci'& t$at ")ocks o' t$e ta")e are to "e %)aced at t$e M;U end o' t$e )ist durin, a 'u)) ta")e scan1 use t$e CACHE c)ause +$en creatin, or a)terin, a ta")e or c)uster* Cou can s%eci'& t$is "e$avior 'or sma)) )ooku% ta")es or )ar,e static $istorica) ta")es to avoid I:( on su"se3uent accesses o' t$e ta")e* #ee Also& (rac)e Data"ase .=L ;e'erence 'or in'ormation a"out t$e CACHE c)ause #i1e o) the Database 6))er Cache (rac)e su%%orts mu)ti%)e ")ock si?es in a data"ase* #$e standard ")ock si?e is used 'or t$e SYSTEM ta")es%ace* Cou s%eci'& t$e standard ")ock si?e "& settin, t$e initia)i?ation %arameter DB_BLOCK_SIZE* Le,itimate va)ues are 'rom 2D to A2D* (%tiona))&1 &ou can a)so set t$e si?e 'or t+o additiona) "u''er %oo)s1 KEEP and RECYCLE1 "& settin, DB_KEEP_CACHE_SIZE and DB_RECYCLE_CACHE_SIZE* #$ese t$ree %arameters are inde%endent o' one anot$er* #ee Also& 7Mu)ti%)e Bu''er Poo)s7 'or more in'ormation a"out t$e KEEP and RECYCLE "u''er %oo)s #$e si?es and num"ers o' non-standard ")ock si?e "u''ers are s%eci'ied "& t$e 'o))o+in, %arameters- DB_2K_CACHE_SIZE DB_$K_CACHE_SIZE DB_8K_CACHE_SIZE DB_16K_CACHE_SIZE DB_!2K_CACHE_SIZE 9ac$ %arameter s%eci'ies t$e si?e o' t$e cac$e 'or t$e corres%ondin, ")ock si?e* 3ote& P)at'orm-s%eci'ic restrictions re,ardin, t$e maximum ")ock si?e a%%)&1 so some o' t$ese si?es mi,$t not "e a))o+ed on some %)at'orms* 0+ample o) #etting 6loc5 an" Cache #i1es DB_BLOCK_SIZE=$%96 DB_CACHE_SIZE=1%2$M DB_2K_CACHE_SIZE=26M Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 9 of 21 5/6/2014 11:22 AM DB_8K_CACHE_SIZE=12M In t$e %recedin, exam%)e1 t$e %arameter DB_BLOCK_SIZE sets t$e standard ")ock si?e o' t$e data"ase to 4D* #$e si?e o' t$e cac$e o' standard ")ock si?e "u''ers is 1024MB* 0dditiona))&1 2D and 6D cac$es are a)so con'i,ured1 +it$ si?es o' 2H@MB and H12MB1 res%ective)&* 3ote& #$e DB_nK_CACHE_SIZE %arameters cannot "e used to si?e t$e cac$e 'or t$e standard ")ock si?e* I' t$e va)ue o' DB_BLOCK_SIZE is nD1 it is i))e,a) to set DB_nK_CACHE_SIZE* #$e si?e o' t$e cac$e 'or t$e standard ")ock si?e is a)+a&s determined 'rom t$e va)ue o' DB_CACHE_SIZE* #$e cac$e $as a )imited si?e1 so not a)) t$e data on disk can 'it in t$e cac$e* B$en t$e cac$e is 'u))1 su"se3uent cac$e misses cause (rac)e to +rite dirt& data a)read& in t$e cac$e to disk to make room 'or t$e ne+ data* 2I' a "u''er is not dirt&1 it does not need to "e +ritten to disk "e'ore a ne+ ")ock can "e read into t$e "u''er*4 .u"se3uent access to an& data t$at +as +ritten to disk resu)ts in additiona) cac$e misses* #$e si?e o' t$e cac$e a''ects t$e )ike)i$ood t$at a re3uest 'or data resu)ts in a cac$e $it* I' t$e cac$e is )ar,e1 it is more )ike)& to contain t$e data t$at is re3uested* Increasin, t$e si?e o' a cac$e increases t$e %ercenta,e o' data re3uests t$at resu)t in cac$e $its* Cou can c$an,e t$e si?e o' t$e "u''er cac$e +$i)e t$e instance is runnin,1 +it$out $avin, to s$ut do+n t$e data"ase* Do t$is +it$ t$e ALTER SYSTEM statement* For more in'ormation1 see 7Contro) o' t$e ./08s Use o' Memor&7* Use t$e 'ixed vie+ V"BUFFER_POOL to track t$e si?es o' t$e di''erent cac$e com%onents and an& %endin, resi?e o%erations* #ee Also& (rac)e Data"ase Per'ormance #unin, /uide 'or in'ormation a"out tunin, t$e "u''er cac$e Mltiple 6))er 2ools Cou can con'i,ure t$e data"ase "u''er cac$e +it$ se%arate "u''er %oo)s t$at eit$er kee% data in t$e "u''er cac$e or make t$e "u''ers avai)a")e 'or ne+ data immediate)& a'ter usin, t$e data ")ocks* Particu)ar sc$ema o">ects 2ta")es1 c)usters1 indexes1 and %artitions4 can t$en "e assi,ned to t$e a%%ro%riate "u''er %oo) to contro) t$e +a& t$eir data ")ocks a,e out o' t$e cac$e* #$e KEEP "u''er %oo) retains t$e sc$ema o">ect8s data ")ocks in memor&* #$e RECYCLE "u''er %oo) e)iminates data ")ocks 'rom memor& as soon as t$e& are no )on,er needed* Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 10 of 21 5/6/2014 11:22 AM #$e DEFAULT "u''er %oo) contains data ")ocks 'rom sc$ema o">ects t$at are not assi,ned to an& "u''er %oo)1 as +e)) as sc$ema o">ects t$at are ex%)icit)& assi,ned to t$e DEFAULT %oo)* #$e initia)i?ation %arameters t$at con'i,ure t$e KEEP and RECYCLE "u''er %oo)s are DB_KEEP_CACHE_SIZE and DB_RECYCLE_CACHE_SIZE* 3ote& Mu)ti%)e "u''er %oo)s are on)& avai)a")e 'or t$e standard ")ock si?e* Non-standard ")ock si?e cac$es $ave a sin,)e DEFAULT %oo)* #ee Also& (rac)e Data"ase Per'ormance #unin, /uide 'or more in'ormation a"out mu)ti%)e "u''er %oo)s (rac)e Data"ase .=L ;e'erence 'or t$e s&ntax o' t$e BUFFER_POOL c)ause o' t$e STORAGE c)ause Re"o 7og 6))er #$e re"o log b))er is a circu)ar "u''er in t$e ./0 t$at $o)ds in'ormation a"out c$an,es made to t$e data"ase* #$is in'ormation is stored in re"o entries* ;edo entries contain t$e in'ormation necessar& to reconstruct1 or redo1 c$an,es made to t$e data"ase "& I#SERT1 UPDATE1 DELETE1 CREATE1 ALTER1 or DROP o%erations* ;edo entries are used 'or data"ase recover&1 i' necessar&* ;edo entries are co%ied "& (rac)e data"ase %rocesses 'rom t$e user8s memor& s%ace to t$e redo )o, "u''er in t$e ./0* #$e redo entries take u% continuous1 se3uentia) s%ace in t$e "u''er* #$e "ack,round %rocess L/B; +rites t$e redo )o, "u''er to t$e active redo )o, 'i)e 2or ,rou% o' 'i)es4 on disk* #ee Also& 7Lo, Briter Process 2L/B;47 'or more in'ormation a"out $o+ t$e redo )o, "u''er is +ritten to disk (rac)e Data"ase Backu% and ;ecover& Basics 'or in'ormation a"out redo )o, 'i)es and ,rou%s #$e initia)i?ation %arameter LOG_BUFFER determines t$e si?e 2in "&tes4 o' t$e redo )o, "u''er* In ,enera)1 )ar,er va)ues reduce )o, 'i)e I:(1 %articu)ar)& i' transactions are )on, or numerous* #$e de'au)t settin, is eit$er H12 ki)o"&tes 2DB4 or 126 DB times t$e settin, o' t$e CPU_COU#T %arameter1 +$ic$ever is ,reater* #hare" 2ool Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 11 of 21 5/6/2014 11:22 AM #$e s$ared %oo) %ortion o' t$e ./0 contains t$e )i"rar& cac$e1 t$e dictionar& cac$e1 "u''ers 'or %ara))e) execution messa,es1 and contro) structures* #$e tota) si?e o' t$e s$ared %oo) is determined "& t$e initia)i?ation %arameter SHARED_POOL_SIZE* #$e de'au)t va)ue o' t$is %arameter is 6MB on A2-"it %)at'orms and @4MB on @4-"it %)at'orms* Increasin, t$e va)ue o' t$is %arameter increases t$e amount o' memor& reserved 'or t$e s$ared %oo)* 7ibrary Cache #$e )i"rar& cac$e inc)udes t$e s$ared .=L areas1 %rivate .=L areas 2in t$e case o' a s$ared server con'i,uration41 PL:.=L %rocedures and %acka,es1 and contro) structures suc$ as )ocks and )i"rar& cac$e $and)es* .$ared .=L areas are accessi")e to a)) users1 so t$e )i"rar& cac$e is contained in t$e s$ared %oo) +it$in t$e ./0* #hare" #97 Areas an" 2ri'ate #97 Areas (rac)e re%resents eac$ .=L statement it runs +it$ a s$ared .=L area and a %rivate .=L area* (rac)e reco,ni?es +$en t+o users are executin, t$e same .=L statement and reuses t$e s$ared .=L area 'or t$ose users* Ho+ever1 eac$ user must $ave a se%arate co%& o' t$e statement8s %rivate .=L area* #hare" #97 Areas 0 s$ared .=L area contains t$e %arse tree and execution %)an 'or a ,iven .=L statement* (rac)e saves memor& "& usin, one s$ared .=L area 'or .=L statements run mu)ti%)e times1 +$ic$ o'ten $a%%ens +$en man& users run t$e same a%%)ication* (rac)e a))ocates memor& 'rom t$e s$ared %oo) +$en a ne+ .=L statement is %arsed1 to store in t$e s$ared .=L area* #$e si?e o' t$is memor& de%ends on t$e com%)exit& o' t$e statement* I' t$e entire s$ared %oo) $as a)read& "een a))ocated1 (rac)e can dea))ocate items 'rom t$e %oo) usin, a modi'ied L;U 2)east recent)& used4 a),orit$m unti) t$ere is enou,$ 'ree s%ace 'or t$e ne+ statement8s s$ared .=L area* I' (rac)e dea))ocates a s$ared .=L area1 t$e associated .=L statement must "e re%arsed and reassi,ned to anot$er s$ared .=L area at its next execution* #ee Also& 7Private .=L 0rea7 (rac)e Data"ase Per'ormance #unin, /uide 27:#97 2rogram 8nits an" the #hare" 2ool (rac)e %rocesses PL:.=L %ro,ram units 2%rocedures1 'unctions1 %acka,es1 anon&mous ")ocks1 and data"ase tri,,ers4 muc$ t$e same +a& it %rocesses individua) .=L statements* (rac)e a))ocates a s$ared area to $o)d t$e %arsed1 com%i)ed 'orm o' a %ro,ram unit* (rac)e a))ocates a %rivate area to $o)d va)ues Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 12 of 21 5/6/2014 11:22 AM s%eci'ic to t$e session t$at runs t$e %ro,ram unit1 inc)udin, )oca)1 ,)o"a)1 and %acka,e varia")es 2a)so kno+n as %acka,e instantiation4 and "u''ers 'or executin, .=L* I' more t$an one user runs t$e same %ro,ram unit1 t$en a sin,)e1 s$ared area is used "& a)) users1 +$i)e eac$ user maintains a se%arate co%& o' $is or $er %rivate .=L area1 $o)din, va)ues s%eci'ic to $is or $er session* Individua) .=L statements contained +it$in a PL:.=L %ro,ram unit are %rocessed as descri"ed in t$e %revious sections* Des%ite t$eir ori,ins +it$in a PL:.=L %ro,ram unit1 t$ese .=L statements use a s$ared area to $o)d t$eir %arsed re%resentations and a %rivate area 'or eac$ session t$at runs t$e statement* Dictionary Cache #$e data dictionar& is a co))ection o' data"ase ta")es and vie+s containin, re'erence in'ormation a"out t$e data"ase1 its structures1 and its users* (rac)e accesses t$e data dictionar& 're3uent)& durin, .=L statement %arsin,* #$is access is essentia) to t$e continuin, o%eration o' (rac)e* #$e data dictionar& is accessed so o'ten "& (rac)e t$at t+o s%ecia) )ocations in memor& are desi,nated to $o)d dictionar& data* (ne area is ca))ed t$e "ata "ictionary cache1 a)so kno+n as t$e ro( cache "ecause it $o)ds data as ro+s instead o' "u''ers 2+$ic$ $o)d entire ")ocks o' data4* #$e ot$er area in memor& to $o)d dictionar& data is t$e )i"rar& cac$e* 0)) (rac)e user %rocesses s$are t$ese t+o cac$es 'or access to data dictionar& in'ormation* #ee Also& C$a%ter J1 7#$e Data Dictionar&7 7Li"rar& Cac$e7 Allocation an" Rese o) Memory in the #hare" 2ool In ,enera)1 an& item 2s$ared .=L area or dictionar& ro+4 in t$e s$ared %oo) remains unti) it is ')us$ed accordin, to a modi'ied L;U a),orit$m* #$e memor& 'or items t$at are not "ein, used re,u)ar)& is 'reed i' s%ace is re3uired 'or ne+ items t$at must "e a))ocated some s%ace in t$e s$ared %oo)* 0 modi'ied L;U a),orit$m a))o+s s$ared %oo) items t$at are used "& man& sessions to remain in memor& as )on, as t$e& are use'u)1 even i' t$e %rocess t$at ori,ina))& created t$e item terminates* 0s a resu)t1 t$e over$ead and %rocessin, o' .=L statements associated +it$ a mu)tiuser (rac)e s&stem is minimi?ed* B$en a .=L statement is su"mitted to (rac)e 'or execution1 (rac)e automatica))& %er'orms t$e 'o))o+in, memor& a))ocation ste%s- (rac)e c$ecks t$e s$ared %oo) to see i' a s$ared .=L area a)read& exists 'or an identica) statement* I' so1 t$at s$ared .=L area is used 'or t$e execution o' t$e su"se3uent ne+ instances o' t$e statement* 0)ternative)&1 i' t$ere is no s$ared .=L area 'or a statement1 (rac)e a))ocates a ne+ s$ared .=L area in t$e s$ared %oo)* In eit$er case1 t$e user8s %rivate .=L area is associated +it$ t$e s$ared .=L area t$at contains t$e statement* 1* Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 13 of 21 5/6/2014 11:22 AM 3ote& 0 s$ared .=L area can "e ')us$ed 'rom t$e s$ared %oo)1 even i' t$e s$ared .=L area corres%onds to an o%en cursor t$at $as not "een used 'or some time* I' t$e o%en cursor is su"se3uent)& used to run its statement1 (rac)e re%arses t$e statement1 and a ne+ s$ared .=L area is a))ocated in t$e s$ared %oo)* (rac)e a))ocates a %rivate .=L area on "e$a)' o' t$e session* #$e )ocation o' t$e %rivate .=L area de%ends on t$e t&%e o' connection esta")is$ed 'or t$e session* 2* (rac)e a)so ')us$es a s$ared .=L area 'rom t$e s$ared %oo) in t$ese circumstances- B$en t$e A#ALYZE statement is used to u%date or de)ete t$e statistics o' a ta")e1 c)uster1 or index1 a)) s$ared .=L areas t$at contain statements re'erencin, t$e ana)&?ed sc$ema o">ect are ')us$ed 'rom t$e s$ared %oo)* #$e next time a ')us$ed statement is run1 t$e statement is %arsed in a ne+ s$ared .=L area to re')ect t$e ne+ statistics 'or t$e sc$ema o">ect* I' a sc$ema o">ect is re'erenced in a .=L statement and t$at o">ect is )ater modi'ied in an& +a&1 t$e s$ared .=L area is in'ali"ate" 2marked inva)id41 and t$e statement must "e re%arsed t$e next time it is run* I' &ou c$an,e a data"ase8s ,)o"a) data"ase name1 a)) in'ormation is ')us$ed 'rom t$e s$ared %oo)* #$e administrator can manua))& ')us$ a)) in'ormation in t$e s$ared %oo) to assess t$e %er'ormance 2+it$ res%ect to t$e s$ared %oo)1 not t$e data "u''er cac$e4 t$at can "e ex%ected a'ter instance startu% +it$out s$uttin, do+n t$e current instance* #$e statement ALTER SYSTEM FLUSH SHARED_POOL is used to do t$is* #ee Also& 7.$ared .=L 0reas and Private .=L 0reas7 'or more in'ormation a"out t$e )ocation o' t$e %rivate .=L area C$a%ter @1 7De%endencies 0mon, .c$ema (">ects7 'or more in'ormation a"out t$e inva)idation o' .=L statements and de%endenc& issues (rac)e Data"ase .=L ;e'erence 'or in'ormation a"out usin, ALTER SYSTEM FLUSH SHARED_POOL (rac)e Data"ase ;e'erence 'or in'ormation a"out V"S&L and V"S&LAREA d&namic vie+s 7arge 2ool #$e data"ase administrator can con'i,ure an o%tiona) memor& area ca))ed t$e large pool to %rovide )ar,e memor& a))ocations 'or- Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 14 of 21 5/6/2014 11:22 AM .ession memor& 'or t$e s$ared server and t$e (rac)e K0 inter'ace 2used +$ere transactions interact +it$ more t$an one data"ase4 I:( server %rocesses (rac)e "acku% and restore o%erations B& a))ocatin, session memor& 'rom t$e )ar,e %oo) 'or s$ared server1 (rac)e K01 or %ara))e) 3uer& "u''ers1 (rac)e can use t$e s$ared %oo) %rimari)& 'or cac$in, s$ared .=L and avoid t$e %er'ormance over$ead caused "& s$rinkin, t$e s$ared .=L cac$e* In addition1 t$e memor& 'or (rac)e "acku% and restore o%erations1 'or I:( server %rocesses1 and 'or %ara))e) "u''ers is a))ocated in "u''ers o' a 'e+ $undred ki)o"&tes* #$e )ar,e %oo) is "etter a")e to satis'& suc$ )ar,e memor& re3uests t$an t$e s$ared %oo)* #$e )ar,e %oo) does not $ave an L;U )ist* It is di''erent 'rom reserved s%ace in t$e s$ared %oo)1 +$ic$ uses t$e same L;U )ist as ot$er memor& a))ocated 'rom t$e s$ared %oo)* #ee Also& 7.$ared .erver 0rc$itecture7 'or in'ormation a"out a))ocatin, session memor& 'rom t$e )ar,e %oo) 'or t$e s$ared server (rac)e Data"ase 0%%)ication Deve)o%er8s /uide - Fundamenta)s 'or in'ormation a"out (rac)e K0 (rac)e Data"ase Per'ormance #unin, /uide 'or more in'ormation a"out t$e )ar,e %oo)1 reserve s%ace in t$e s$ared %oo)1 and I:( server %rocesses 7(vervie+ o' Para))e) 9xecution7 'or in'ormation a"out a))ocatin, memor& 'or %ara))e) execution ;a'a 2ool <ava %oo) memor& is used in server memor& 'or a)) session-s%eci'ic <ava code and data +it$in t$e <LM* <ava %oo) memor& is used in di''erent +a&s1 de%endin, on +$at mode t$e (rac)e server is runnin, in* #$e <ava Poo) 0dvisor statistics %rovide in'ormation a"out )i"rar& cac$e memor& used 'or <ava and %redict $o+ c$an,es in t$e si?e o' t$e <ava %oo) can a''ect t$e %arse rate* #$e <ava Poo) 0dvisor is interna))& turned on +$en '()(*'(*+'_,-.-, is set to TYPICAL or $i,$er* #$ese statistics reset +$en t$e advisor is turned o''* #ee Also& (rac)e Data"ase <ava Deve)o%er8s /uide #treams 2ool Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 15 of 21 5/6/2014 11:22 AM In a sin,)e data"ase1 &ou can s%eci'& t$at .treams memor& "e a))ocated 'rom a %oo) in t$e ./0 ca))ed t$e .treams %oo)* #o con'i,ure t$e .treams %oo)1 s%eci'& t$e si?e o' t$e %oo) in "&tes usin, t$e STREAMS_POOL_SIZE initia)i?ation %arameter* I' a .treams %oo) is not de'ined1 t$en one is created automatica))& +$en .treams is 'irst used* I' SGA_TARGET is set1 t$en t$e ./0 memor& 'or t$e .treams %oo) comes 'rom t$e ,)o"a) %oo) o' ./0* I' SGA_TARGET is not set1 t$en ./0 'or t$e .treams %oo) is trans'erred 'rom t$e "u''er cac$e* #$is trans'er takes %)ace on)& a'ter t$e 'irst use o' .treams* #$e amount trans'erred is 10M o' t$e s$ared %oo) si?e* #ee Also& (rac)e .treams Conce%ts and 0dministration Control o) the #*A<s 8se o) Memory D&namic ./0 %rovides externa) contro)s 'or increasin, and decreasin, (rac)e8s use o' %$&sica) memor&* #o,et$er +it$ t$e d&namic "u''er cac$e1 s$ared %oo)1 and )ar,e %oo)1 d&namic ./0 a))o+s t$e 'o))o+in,- #$e ./0 can ,ro+ in res%onse to a data"ase administrator statement1 u% to an o%eratin, s&stem s%eci'ied maximum and t$e SGA_MAX_SIZE s%eci'ication* #$e ./0 can s$rink in res%onse to a data"ase administrator statement1 to an (rac)e %rescri"ed minimum1 usua))& an o%eratin, s&stem %re'erred )imit* Bot$ t$e "u''er cac$e and t$e ./0 %oo)s can ,ro+ and s$rink at runtime accordin, to some interna)1 (rac)e-mana,ed %o)ic&* Other #*A !nitiali1ation 2arameters Cou can use severa) initia)i?ation %arameters to contro) $o+ t$e ./0 uses memor&* 2hysical Memory #$e LOCK_SGA %arameter )ocks t$e ./0 into %$&sica) memor&* #*A #tarting A""ress #$e SHARED_MEMORY_ADDRESS and HI_SHARED_MEMORY_ADDRESS %arameters s%eci'& t$e ./08s startin, address at runtime* #$ese %arameters are rare)& used* For @4-"it %)at'orms1 HI_SHARED_MEMORY_ADDRESS s%eci'ies t$e $i,$ order A2 "its o' t$e @4-"it address* 0+ten"e" 6))er Cache Mechanism #$e USE_I#DIRECT_DATA_BUFFERS %arameter ena")es t$e use o' t$e extended "u''er cac$e mec$anism 'or A2-"it %)at'orms t$at can su%%ort more t$an 4 /B o' %$&sica) memor&* (n %)at'orms t$at do not su%%ort t$is muc$ %$&sica) memor&1 t$is %arameter is i,nored* Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 16 of 21 5/6/2014 11:22 AM O'er'ie( o) the 2rogram *lobal Areas 0 program global area (2*A) is a memor& re,ion t$at contains data and contro) in'ormation 'or a server %rocess* It is a nons$ared memor& created "& (rac)e +$en a server %rocess is started* 0ccess to it is exc)usive to t$at server %rocess and is read and +ritten on)& "& (rac)e code actin, on "e$a)' o' it* #$e tota) P/0 memor& a))ocated "& eac$ server %rocess attac$ed to an (rac)e instance is a)so re'erred to as t$e aggregate" 2*A memor& a))ocated "& t$e instance* #ee Also& 7Connections and .essions7 'or in'ormation a"out sessions Content o) the 2*A #$e content o' t$e P/0 memor& varies1 de%endin, on +$et$er t$e instance is runnin, t$e s$ared server o%tion* But ,enera))& s%eakin,1 t$e P/0 memor& can "e c)assi'ied as 'o))o+s* 2ri'ate #97 Area 0 %rivate .=L area contains data suc$ as "ind in'ormation and runtime memor& structures* 9ac$ session t$at issues a .=L statement $as a %rivate .=L area* 9ac$ user t$at su"mits t$e same .=L statement $as $is or $er o+n %rivate .=L area t$at uses a sin,)e s$ared .=L area* #$us1 man& %rivate .=L areas can "e associated +it$ t$e same s$ared .=L area* #$e %rivate .=L area o' a cursor is itse)' divided into t+o areas +$ose )i'etimes are di''erent- #$e %ersistent area1 +$ic$ contains1 'or exam%)e1 "ind in'ormation* It is 'reed on)& +$en t$e cursor is c)osed* #$e run-time area1 +$ic$ is 'reed +$en t$e execution is terminated* (rac)e creates t$e runtime area as t$e 'irst ste% o' an execute re3uest* For I#SERT/ UPDATE1 and DELETE statements1 (rac)e 'rees t$e runtime area a'ter t$e statement $as "een run* For 3ueries1 (rac)e 'rees t$e runtime area on)& a'ter a)) ro+s are 'etc$ed or t$e 3uer& is cance)ed* #$e )ocation o' a %rivate .=L area de%ends on t$e t&%e o' connection esta")is$ed 'or a session* I' a session is connected t$rou,$ a dedicated server1 %rivate .=L areas are )ocated in t$e server %rocess8s P/0* Ho+ever1 i' a session is connected t$rou,$ a s$ared server1 %art o' t$e %rivate .=L area is ke%t in t$e ./0* #ee Also& 7(vervie+ o' t$e Pro,ram /)o"a) 0reas7 'or in'ormation a"out t$e P/0 7Connections and .essions7 'or more in'ormation a"out sessions 7.=L Bork 0reas7 'or in'ormation a"out SELECT runtimes durin, a sort1 Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 17 of 21 5/6/2014 11:22 AM $as$->oin1 "itma% create1 or "itma% mer,e (rac)e Data"ase Net .ervices 0dministrator8s /uide Crsors an" #97 Areas #$e a%%)ication deve)o%er o' an (rac)e %recom%i)er %ro,ram or (CI %ro,ram can ex%)icit)& o%en crsors1 or $and)es to s%eci'ic %rivate .=L areas1 and use t$em as a named resource t$rou,$out t$e execution o' t$e %ro,ram* ;ecursive cursors t$at (rac)e issues im%)icit)& 'or some .=L statements a)so use s$ared .=L areas* #$e mana,ement o' %rivate .=L areas is t$e res%onsi"i)it& o' t$e user %rocess* #$e a))ocation and dea))ocation o' %rivate .=L areas de%ends )ar,e)& on +$ic$ a%%)ication too) &ou are usin,1 a)t$ou,$ t$e num"er o' %rivate .=L areas t$at a user %rocess can a))ocate is a)+a&s )imited "& t$e initia)i?ation %arameter OPE#_CURSORS* #$e de'au)t va)ue o' t$is %arameter is H0* 0 %rivate .=L area continues to exist unti) t$e corres%ondin, cursor is c)osed or t$e statement $and)e is 'reed* 0)t$ou,$ (rac)e 'rees t$e runtime area a'ter t$e statement com%)etes1 t$e %ersistent area remains +aitin,* 0%%)ication deve)o%ers c)ose a)) o%en cursors t$at +i)) not "e used a,ain to 'ree t$e %ersistent area and to minimi?e t$e amount o' memor& re3uired 'or users o' t$e a%%)ication* #ee Also& 7Cursors7 #ession Memory #ession memory is t$e memor& a))ocated to $o)d a session8s varia")es 2)o,on in'ormation4 and ot$er in'ormation re)ated to t$e session* For a s$ared server1 t$e session memor& is s$ared and not %rivate* #97 =or5 Areas For com%)ex 3ueries 2'or exam%)e1 decision-su%%ort 3ueries41 a "i, %ortion o' t$e runtime area is dedicated to +ork areas a))ocated "& memor&-intensive o%erators suc$ as t$e 'o))o+in,- .ort-"ased o%erators 2order "&1 ,rou%-"&1 ro))u%1 +indo+ 'unction4 Has$->oin Bitma% mer,e Bitma% create For exam%)e1 a sort o%erator uses a +ork area 2sometimes ca))ed t$e sort area4 to %er'orm t$e in-memor& sort o' a set o' ro+s* .imi)ar)&1 a $as$->oin o%erator uses a +ork area 2a)so ca))ed t$e $as$ area4 to "ui)d a $as$ ta")e 'rom its )e't in%ut* I' t$e amount o' data to "e %rocessed "& t$ese t+o o%erators does not 'it into a +ork area1 t$en t$e in%ut data is divided into sma))er %ieces* #$is a))o+s Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 18 of 21 5/6/2014 11:22 AM some data %ieces to "e %rocessed in memor& +$i)e t$e rest are s%i))ed to tem%orar& disk stora,e to "e %rocessed )ater* 0)t$ou,$ "itma% o%erators do not s%i)) to disk +$en t$eir associated +ork area is too sma))1 t$eir com%)exit& is inverse)& %ro%ortiona) to t$e si?e o' t$eir +ork area* #$us1 t$ese o%erators run 'aster +it$ )ar,er +ork area* #$e si?e o' a +ork area can "e contro))ed and tuned* /enera))&1 "i,,er data"ase areas can si,ni'icant)& im%rove t$e %er'ormance o' a %articu)ar o%erator at t$e cost o' $i,$er memor& consum%tion* (%tima))&1 t$e si?e o' a +ork area is "i, enou,$ suc$ to accommodate t$e in%ut data and auxi)iar& memor& structures a))ocated "& its associated .=L o%erator* I' not1 res%onse time increases1 "ecause %art o' t$e in%ut data must "e s%i))ed to tem%orar& disk stora,e* In t$e extreme case1 i' t$e si?e o' a +ork area is 'ar too sma)) com%ared to t$e in%ut data si?e1 mu)ti%)e %asses over t$e data %ieces must "e %er'ormed* #$is can dramatica))& increase t$e res%onse time o' t$e o%erator* 2*A Memory Management )or De"icate" Mo"e Cou can automatica))& and ,)o"a))& mana,e t$e si?e o' .=L +ork areas* #$e data"ase administrator sim%)& needs to s%eci'& t$e tota) si?e dedicated to P/0 memor& 'or t$e (rac)e instance "& settin, t$e initia)i?ation %arameter PGA_AGGREGATE_TARGET* #$e s%eci'ied num"er 2'or exam%)e1 2/4 is a ,)o"a) tar,et 'or t$e (rac)e instance1 and (rac)e tries to ensure t$at t$e tota) amount o' P/0 memor& a))ocated across a)) data"ase server %rocesses never exceeds t$is tar,et* 3ote& In ear)ier re)eases1 t$e data"ase administrator contro))ed t$e maximum si?e o' .=L +ork areas "& settin, t$e 'o))o+in, %arameters- SORT_AREA_SIZE1 HASH_AREA_SIZE1 BITMAP_MERGE_AREA_SIZE and CREATE_BITMAP_AREA_SIZE* .ettin, t$ese %arameters is di''icu)t1 "ecause t$e maximum +ork area si?e is idea))& se)ected 'rom t$e data in%ut si?e and t$e tota) num"er o' +ork areas active in t$e s&stem* #$ese t+o 'actors var& a )ot 'rom one +ork area to anot$er and 'rom one time to anot$er* #$us1 t$e various 0_AREA_SIZE %arameters are $ard to tune under t$e "est o' circumstances* Bit$ PGA_AGGREGATE_TARGET1 si?in, o' +ork areas 'or a)) dedicated sessions is automatic and a)) 0_AREA_SIZE %arameters are i,nored 'or t$ese sessions* 0t an& ,iven time1 t$e tota) amount o' P/0 memor& avai)a")e to active +ork areas on t$e instance is automatica))& derived 'rom t$e %arameter PGA_AGGREGATE_TARGET* #$is amount is set to t$e va)ue o' PGA_AGGREGATE_TARGET minus t$e P/0 memor& a))ocated "& ot$er com%onents o' t$e s&stem 2'or exam%)e1 P/0 memor& a))ocated "& sessions4* #$e resu)tin, P/0 memor& is t$en a))otted to individua) active +ork areas "ased on t$eir s%eci'ic memor& re3uirement* 3ote& #$e initia)i?ation %arameter 1ORKAREA_SIZE_POLICY is a session- and s&stem-)eve) %arameter t$at can take on)& t+o va)ues- MA#UAL or AUTO* #$e de'au)t is AUTO* #$e data"ase administrator can set PGA_AGGREGATE_TARGET1 and t$en s+itc$ "ack and 'ort$ 'rom auto to manua) memor& mana,ement mode* Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 19 of 21 5/6/2014 11:22 AM #$ere are 'ixed vie+s and co)umns t$at %rovide P/0 memor& use statistics* Most o' t$ese statistics are ena")ed +$en PGA_AGGREGATE_TARGET is set* .tatistics on a))ocation and use o' +ork area memor& can "e vie+ed in t$e 'o))o+in, d&namic %er'ormance vie+s- V"SYSSTAT V"SESSTAT V"PGASTAT V"S&L_1ORKAREA V"S&L_1ORKAREA_ACTIVE #$e 'o))o+in, t$ree co)umns in t$e V"PROCESS vie+ re%ort t$e P/0 memor& a))ocated and used "& an (rac)e %rocess- PGA_USED_MEM PGA_ALLOCATED_MEM PGA_MAX_MEM 3ote& #$e automatic P/0 memor& mana,ement mode a%%)ies to +ork areas a))ocated "& "ot$ dedicated and s$ared (rac)e data"ase servers* #ee Also& (rac)e Data"ase ;e'erence 'or in'ormation a"out vie+s (rac)e Data"ase Per'ormance #unin, /uide 'or in'ormation a"out usin, t$ese vie+s De"icate" an" #hare" #er'ers Memor& a))ocation de%ends1 in some s%eci'ics1 on +$et$er t$e s&stem uses dedicated or s$ared server arc$itecture* #a")e 6-1 s$o+s t$e di''erences* ,able 8%1 Di))erences in Memory Allocation 6et(een De"icate" an" #hare" #er'ers Memory Area De"icate" #er'er #hare" #er'er Nature o' session memor& Private .$ared Location o' t$e %ersistent area P/0 ./0 Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 20 of 21 5/6/2014 11:22 AM Memory Area De"icate" #er'er #hare" #er'er Location o' %art o' t$e runtime area 'or SELECT statements P/0 P/0 Location o' t$e runtime area 'or DML:DDL statements P/0 P/0 #o)t(are Co"e Areas #o)t(are co"e areas are %ortions o' memor& used to store code t$at is "ein, run or can "e run* (rac)e code is stored in a so't+are area t$at is t&%ica))& at a di''erent )ocation 'rom users8 %ro,ramsNa more exc)usive or %rotected )ocation* .o't+are areas are usua))& static in si?e1 c$an,in, on)& +$en so't+are is u%dated or reinsta))ed* #$e re3uired si?e o' t$ese areas varies "& o%eratin, s&stem* .o't+are areas are read on)& and can "e insta))ed s$ared or nons$ared* B$en %ossi")e1 (rac)e code is s$ared so t$at a)) (rac)e users can access it +it$out $avin, mu)ti%)e co%ies in memor&* #$is resu)ts in a savin, o' rea) main memor& and im%roves overa)) %er'ormance* User %ro,rams can "e s$ared or nons$ared* .ome (rac)e too)s and uti)ities 2suc$ as (rac)e Forms and .=LIP)us4 can "e insta))ed s$ared1 "ut some cannot* Mu)ti%)e instances o' (rac)e can use t$e same (rac)e code area +it$ di''erent data"ases i' runnin, on t$e same com%uter* 3ote& #$e o%tion o' insta))in, so't+are s$ared is not avai)a")e 'or a)) o%eratin, s&stems 2'or exam%)e1 on PCs o%eratin, Bindo+s4* .ee &our (rac)e o%eratin, s&stem-s%eci'ic documentation 'or more in'ormation* Previous Next Co%&ri,$t O 1PPA1 200H1 (rac)e* 0)) ri,$ts reserved* Le,a) Notices Home Book List Contents Index Master Index Contact Us Memory Architecture http://docs.oracle.com/cd/B19306_01/server.102/b14220/memory.htm 21 of 21 5/6/2014 11:22 AM
Python Machine Learning: Using Scikit Learn, TensorFlow, PyTorch, and Keras, an Introductory Journey into Machine Learning, Deep Learning, Data Analysis, Algorithms, and Data Science