Oracle Architecture
Oracle Architecture
WhatisAnOracleDatabase?
Figure1.TwomaincomponentsofOracledatabase
Instance
Figure2.Theinstancecomponents
SystemGlobalArea
SGAistheprimarymemorystructures.WhenOracleDBAstalkaboutmemory,theyusuallymeanthe SGA.ThisareaisbrokenintoafewofpartmemoryBufferCache,SharedPool,RedoLogBuffer,Large Pool,andJavaPool. BufferCache Buffercacheisusedtostoresthecopiesofdatablockthatretrievedfromdatafiles.Thatis,whenuser retrievesdatafromdatabase,thedatawillbestoredinbuffercache.Itssizecanbemanipulatedvia DB_CACHE_SIZEparameterininit.orainitializationparameterfile. SharedPool SharedpoolisbrokenintotwosmallpartmemoriesLibraryCacheandDictionaryCache.Thelibrary cacheisusedtostoresinformationaboutthecommonlyusedSQLandPL/SQLstatementsandis managedbyaLeastRecentlyUsed(LRU)algorithm.Itisalsoenablesthesharingthosestatemensamong users.Intheotherhand,dictionarycacheisusedtostoresinformationaboutobjectdefinitionsinthe database,suchascolumns,tables,indexes,users,privileges,etc. ThesharedpoolsizecanbesetviaSHARED_POOL_SIZEparameterininit.orainitializationparameterfile. RedoLogBuffer EachDMLstatement(insert,update,anddelete)executedbyuserswillgeneratestheredoentry.Whatis aredoentry?Itisaninformationaboutalldatachangesmadebyusers.Thatredoentryisstoredinredo logbufferbeforeitiswrittenintotheredologfiles.Tomanipulatethesizeofredologbuffer,youcanuse theLOG_BUFFERparameterininit.orainitializationparameterfile. LargePool LargepoolisanoptionalareaofmemoryintheSGA.Itisusedtorelievestheburdenplaceontheshared pool.ItisalsousedforI/Oprocesses.ThelargepoolsizecanbesetbyLARGE_POOL_SIZEparameterin init.orainitializationparameterfile. JavaPool
Asitsname,JavapoolisusedtoservicesparsingoftheJavacommands.Itssizecanbesetby JAVA_POOL_SIZEparameterininit.orainitializationparameterfile.
ProgramGlobalArea
AlthoughtheresultofSQLstatemenparsingisstoredinlibrarycache,butthevalueofbindingvariable willbestoredinPGA.Why?Becauseitmustbeprivateornotbesharedamongusers.ThePGAisalso usedforsortarea.
SoftwareAreaCode
SoftwareareacodeisalocationinmemorywheretheOracleapplicationsoftwareresides.
OracleBackgroundProcesses
Oraclebackgroundprocessesistheprocessesbehindthescenethatworktogetherwiththememories. DBWn Databasewriter(DBWn)processisusedtowritedatafrombuffercacheintothedatafiles.Historically,the databasewriterisnamedDBWR.ButsincesomeofOracleversionallowsustohavemorethanone databasewriter,thenameischangedtoDBWn,wherenvalueisanumber0to9. LGWR Logwriter(LGWR)processissimilartoDBWn.Itwritestheredoentriesfromredologbufferintotheredo logfiles. CKPT Checkpoint(CKPT)isaprocesstogiveasignaltoDBWntowritesdatainthebuffercacheintodatafiles.It willalsoupdatesdatafilesandcontrolfilesheaderwhenlogfileswitchoccurs. SMON SystemMonitor(SMON)processisusedtorecoverthesystemcrachorinstancefailurebyapplyingthe entriesintheredologfilestothedatafiles. PMON ProcessMonitor(PMON)processisusedtocleanupworkafterfailedprocessesbyrollingbackthe transactionsandreleasingotherresources.
Database
Thedatabasereferstodiskresources,andisbrokenintotwomainstructuresLogicalstructuresand Physicalstructures.
LogicalStructures
Oracledatabaseisdividedintosmallerlogicalunitstomanage,store,andretrievedataeffeciently.The logicalunitsaretablespace,segment,extent,anddatablock.Figure3willillustratetherelationships betweenthoseunits.
Figure3.TherelationshipsbetweentheOraclelogicalstructures Tablespace ATablespaceisagroupinglogicaldatabaseobjects.Adatabasemusthaveoneormoretablespaces.In theFigure3,wehavethreetablespacesSYSTEMtablespace,Tablespace1,andTablespace2. Tablespaceiscomposedbyoneormoredatafiles. Segment ATablespaceisfurtherbrokenintosegments.Asegmentisusedtostoressametypeofobjects.Thatis, everytableinthedatabasewillstoreintoaspecificsegment(namedDataSegment)andeveryindexin thedatabasewillalsostoreinitsownsegment(namedIndexSegment).Theothersegmenttypesare TemporarySegmentandRollbackSegment. Extent Asegmentisfurtherbrokenintoextents.Anextentconsistsofoneormoredatablock.Whenthe databaseobjectisenlarged,anextentwillbeallocated.Unlikeatablespaceorasegment,anextent cannotbenamed. DataBlock AdatablockisthesmallestunitofstorageintheOracledatabase.Thedatablocksizeisaspecificnumber ofbyteswithintablespaceandithasthesamenumberofbytes.
PhysicalStructures
ThephysicalstructuresarestructuresofanOracledatabase(inthiscasethediskfiles)thatarenot directlymanipulatedbyusers.Thephysicalstructureconsistsofdatafiles,redologfiles,andcontrolfiles. Datafiles Adatafileisafilethatcorrespondenswithatablespace.Onedatafilecanbeusedbyonetablespace,but onetablespacecanhasmorethanonedatafiles. RedoLogFiles RedologfilesarethefilesthatstoretheredoentriesgeneratedbyDMLstatements.Itcanbeusedfor recoveryprocesses. ControlFiles Controlfilesareusedtostoreinformationaboutphysicalstructureofdatabase,suchasdatafilessizeand location,redologfileslocation,etc.