Sie sind auf Seite 1von 49
Lecture Lecture 1: 1: Oracle Oracle Architectural Architectural Components Components Oracle Oracle DBA DBA Course
Lecture Lecture 1: 1:
Oracle Oracle Architectural Architectural Components Components
Oracle Oracle DBA DBA Course Course
(9i, (9i, 10g, 10g, 11g) 11g)
11/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
OracleOracle DocumentationDocumentation http://tahiti.oracle.com/http://tahiti.oracle.com/
OracleOracle DocumentationDocumentation
http://tahiti.oracle.com/http://tahiti.oracle.com/
http://http://www.oracle.comwww.oracle.com//plspls/db112//db112/homepagehomepage??
remark=tahitiremark=tahiti
22/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
TasksTasks ofof aa DatabaseDatabase AdministratorAdministrator 1:1: EvaluateEvaluate thethe DatabaseDatabase ServerServer
TasksTasks ofof aa DatabaseDatabase AdministratorAdministrator
1:1: EvaluateEvaluate thethe DatabaseDatabase ServerServer HardwareHardware
2:2: InstallInstall thethe OracleOracle DatabaseDatabase SoftwareSoftware
3:3: PlanPlan thethe DatabaseDatabase
4:4: CreateCreate andand OpenOpen thethe DatabaseDatabase
5:5: BackBack UpUp thethe DatabaseDatabase
6:6: EnrollEnroll SystemSystem UsersUsers
7:7: ImplementImplement thethe DatabaseDatabase DesignDesign
8:8: BackBack UpUp thethe FullyFully FunctionalFunctional DatabaseDatabase
9:9: TuneTune DatabaseDatabase PerformancePerformance
10:10: DownloadDownload andand InstallInstall PatchesPatches
11:11: RollRoll OutOut toto AdditionalAdditional HostsHosts
33/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
ObjectivesObjectives ofof thethe lecturelecture •• OverviewOverview ofof OracleOracle serverserver
ObjectivesObjectives ofof thethe lecturelecture
••
OverviewOverview ofof OracleOracle serverserver architecturearchitecture,,
identifyingidentifying mainmain componentscomponents
44/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
TheThe OracleOracle ServerServer Oracle server Application/ network server Server Users 55/49/49 Copyright 
TheThe OracleOracle ServerServer
Oracle server
Application/
network
server
Server
Users
55/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
OracleOracle serverserver TheThe OracleOracle serverserver consistsconsists ofof:: •• OracleOracle databasedatabase
OracleOracle serverserver
TheThe OracleOracle serverserver consistsconsists ofof::
•• OracleOracle databasedatabase - physical files that store
data
OracleOracle instanceinstance - memory structures and
Oracle processes used to access data (from the
physical database files)
66/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
OracleOracle DDatabaseatabase AnAn OracleOracle databasedatabase consistsconsists ofof operatingoperating systemsystem
OracleOracle DDatabaseatabase
AnAn OracleOracle databasedatabase consistsconsists ofof operatingoperating systemsystem
filesfiles,, knownknown asas databasedatabase filesfiles,, thatthat provideprovide
thethe actualactual physicalphysical storagestorage forfor databasedatabase
informationinformation TheThe databasedatabase filesfiles areare usedused toto
ensureensure thatthat thethe datadata isis keptkept consistentconsistent andand cancan
bebe recoveredrecovered inin thethe eventevent ofof aa failurefailure ofof thethe
instanceinstance
UsuallyUsually therethere isis onlyonly oneone OracleOracle instanceinstance
accessingaccessing aa databasedatabase InIn thethe RealReal ApplicationApplication
ClusterCluster configurationconfiguration multiplemultiple instancesinstances accessaccess
aa singlesingle databasedatabase
77/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
Oracle Oracle Database Database Physical Physical Storage Storage Structures Structures Control files ControlControl
Oracle Oracle Database Database
Physical Physical Storage Storage Structures Structures
Control
files
ControlControl andand
redoredo loglog filesfiles
areare
multiplexedmultiplexed
Parameter
file
Archived
log
files
Password
Data
files
Redo
log
file
files
Database
++ BackupBackup filesfiles,,
tracetrace andand alertalert
filesfiles,, auditaudit filesfiles,,
……
88/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
OtherOther KeyKey PhysicalPhysical StructuresStructures Parameter file Password Archived file log files Database
OtherOther KeyKey PhysicalPhysical StructuresStructures
Parameter
file
Password
Archived
file
log
files
Database
99/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
ConnectingConnecting toto aa DatabaseDatabase Server Server Client Client ConnectionConnection ServerServer
ConnectingConnecting toto aa DatabaseDatabase
Server Server
Client Client
ConnectionConnection
ServerServer
processprocess
establishedestablished
SessionSession createdcreated
UserUser
Oracle server
processprocess
User User
1010/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
UserUser ProcessProcess • • Runs Runs on on the the client client machine machine •
UserUser ProcessProcess
• • Runs Runs on on the the client client machine machine
• • Is Is spawned spawned when when a a tool tool or or an an application application
is is invoked invoked
• • Runs Runs the the tool tool or or application application (SQL*Plus, (SQL*Plus,
Oracle Oracle Enterprise Enterprise Manager, Manager, OracleForms) OracleForms)
• • Generates Generates calls calls to to the the Oracle Oracle server server
1111/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
ConnectionConnection ConnectionConnection isis aa communicationcommunication pathwaypathway betweenbetween aa useruser
ConnectionConnection
ConnectionConnection isis aa communicationcommunication pathwaypathway
betweenbetween aa useruser processprocess andand anan OracleOracle
DatabaseDatabase instanceinstance AA communicationcommunication pathwaypathway
isis establishedestablished usingusing::
1.1. availableavailable interprocessinterprocess communicationcommunication
mechanismsmechanisms (on(on aa computercomputer thatthat runsruns bothboth
thethe useruser processprocess andand OracleOracle DatabaseDatabase),), oror
2.2. networknetwork softwaresoftware ((whenwhen differentdifferent computerscomputers
runrun thethe databasedatabase applicationapplication andand OracleOracle
DatabaseDatabase,, andand communicatecommunicate throughthrough aa
networknetwork).).
1212/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
SessionSession SessionSession isis aa specificspecific connectionconnection ofof aa useruser toto anan OracleOracle
SessionSession
SessionSession isis aa specificspecific connectionconnection ofof aa useruser toto anan OracleOracle
DatabaseDatabase instanceinstance throughthrough aa useruser processprocess ForFor exampleexample,,
whenwhen aa useruser startsstarts SQL*PlusSQL*Plus,, thethe useruser mustmust provideprovide aa
validvalid useruser namename andand passwordpassword,, andand thenthen aa sessionsession isis
establishedestablished forfor thatthat useruser AA sessionsession lastslasts fromfrom thethe timetime
thethe useruser connectsconnects untiluntil thethe timetime thethe useruser disconnectsdisconnects oror
exitsexits thethe databasedatabase applicationapplication
MultipleMultiple sessionssessions cancan bebe createdcreated andand existexist concurrentlyconcurrently
forfor aa singlesingle OracleOracle DatabaseDatabase useruser usingusing thethe samesame useruser
namename
ForFor exampleexample,, aa useruser withwith thethe useruser namename//passwordpassword ofof
SCOTT/TIGERSCOTT/TIGER cancan connectconnect toto thethe samesame OracleOracle DatabaseDatabase instanceinstance
severalseveral timestimes
••
1313/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
ServerServer ProcessProcess • • Runs Runs on on the the server server machine machine (host)
ServerServer ProcessProcess
• • Runs Runs on on the the server server machine machine (host) (host)
• • Services Services a a single single user user process process in in the the
dedicated dedicated server server configuration configuration
• • Uses Uses an an exclusive exclusive Program Program Global Global Area Area
(PGA) (PGA)
• • Processes Processes calls calls generated generated by by the the client client
• • Returns Returns results results to to the the client client
1414/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
OracleOracle InstanceInstance Instance SGA SGASGA -- SystemSystem GlobalGlobal AreaArea Background processes An An
OracleOracle InstanceInstance
Instance
SGA
SGASGA --
SystemSystem GlobalGlobal AreaArea
Background processes
An An Oracle Oracle instance: instance:
Is Is a a means means to to access access an an Oracle Oracle
database database
• • Always Always opens opens one one and and only only one one
database database
1515/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
OracleOracle MemoryMemory StructuresStructures ++ StreamsStreams PoolPool inin 10g10g ++ ResResuultlt cachecache inin
OracleOracle MemoryMemory StructuresStructures
++ StreamsStreams PoolPool
inin 10g10g
++ ResResuultlt cachecache
inin 11g11g
++ UserUser GlobalGlobal
AreaArea inin 11g11g
1616/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
SystemSystemSystem GlobalGlobalGlobal AreaAreaArea (SGA)(SGA)(SGA) UUsedsed toto storestore databasedatabase
SystemSystemSystem GlobalGlobalGlobal AreaAreaArea (SGA)(SGA)(SGA)
UUsedsed toto storestore databasedatabase informationinformation thatthat isis sharedshared byby
databasedatabase processesprocesses ItIt containscontains datadata andand controlcontrol
informationinformation forfor thethe OracleOracle serverserver andand isis allocatedallocated inin
thethe virtualvirtual memorymemory ofof thethe computercomputer wherewhere OracleOracle
residesresides
SHOWSHOW SGA;SGA;
TotalTotal SystemSystem GlobalGlobal AreaArea 3643796436437964 bytesbytes
FixedFixed SizeSize 65437946543794 bytesbytes
VariableVariable SizeSize 1952153619521536 bytesbytes
DatabaseDatabase BuffersBuffers 1677721616777216 bytesbytes
RedoRedo BuffersBuffers 7372873728 bytesbytes
1717/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
DynamicDynamicDynamic SGASGASGA DDynamicynamic SGASGA implementsimplements anan infrastructureinfrastructure thatthat
DynamicDynamicDynamic SGASGASGA
DDynamicynamic SGASGA implementsimplements anan infrastructureinfrastructure thatthat
allowsallows thethe SGASGA configurationconfiguration toto changechange withoutwithout
shuttingshutting downdown thethe instanceinstance ThisThis thenthen allowsallows
thethe sizessizes ofof thethe databasedatabase bufferbuffer cachecache,, ssharedhared
poolpool,, andand largelarge poolpool toto bebe changedchanged withoutwithout
shuttingshutting downdown thethe instanceinstance ConceivablyConceivably,, thetheyy
couldcould bebe initiallyinitially underunder configuredconfigured andand wouldwould
growgrow andand shrinkshrink dependingdepending uponupon theirtheir
respectiverespective workwork loadsloads,, upup toto aa maximummaximum ofof
SGA_MAX_SIZESGA_MAX_SIZE
1818/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
SizingSizingSizing thethethe SGASGASGA TheThe sizesize ofof thethe SGASGA isis determineddetermined byby severalseveral
SizingSizingSizing thethethe SGASGASGA
TheThe sizesize ofof thethe SGASGA isis determineddetermined byby severalseveral
initializationinitialization parametersparameters,, includingincluding::
DB_CACHE_SIZEDB_CACHE_SIZE:: TheThe sizesize ofof thethe defaultdefault cachecache ofof
databasedatabase blocksblocks
LOG_BUFFERLOG_BUFFER:: TheThe numbernumber ofof bytesbytes allocatedallocated forfor
thethe redoredo loglog bufferbuffer cachecache
SHARED_POOL_SIZESHARED_POOL_SIZE:: TheThe sizesize inin bytesbytes ofof thethe
areaarea devoteddevoted toto sharedshared SQLSQL andand PL/SQL.PL/SQL.
LARGE_POOL_SIZELARGE_POOL_SIZE:: TheThe sizesize ofof thethe largelarge poolpool;;
thethe defaultdefault isis zero.zero.
1919/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
SystemSystemSystem GlobalGlobalGlobal AreaAreaArea (SGA)(SGA)(SGA) SGASGA memorymemory allocatedallocated andand
SystemSystemSystem GlobalGlobalGlobal AreaAreaArea (SGA)(SGA)(SGA)
SGASGA memorymemory allocatedallocated andand trackedtracked inin
granulesgranules byby SGASGA componentscomponents
AA granulegranule isis aa unitunit ofof contiguouscontiguous
virtualvirtual memorymemory allocationallocation TheThe sizesize ofof aa
granulegranule dependsdepends onon thethe parameterparameter
SGA_MAX_SIZESGA_MAX_SIZE::
–– 44 MBMB ifif estimatedestimated SGASGA sizesize isis << 128128 MBMB
–– 1616 MBMB otherwiseotherwise
2020/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
TheThe SharedShared PoolPool Shared pool Library cache Data dictionary cache • • Size Size defined
TheThe SharedShared PoolPool
Shared pool
Library
cache
Data
dictionary
cache
• • Size Size defined defined by by SHARED_POOL_SIZE SHARED_POOL_SIZE
• • Library Library cache cache contains contains statement statement text, text,
parsed parsed code, code, and and an an execution execution plan plan
• • Data Data dictionary dictionary cache cache contains contains table table
and and column column definitions definitions and and privileges privileges
2121/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
ResizingResizing TheThe sizesize ofof SharedShared PoolPool cancan bebe dynamicallydynamically resizedresized usingusing
ResizingResizing
TheThe sizesize ofof SharedShared PoolPool cancan bebe
dynamicallydynamically resizedresized usingusing ALTERALTER SYSTEMSYSTEM
SET.SET. AfterAfter performanceperformance analysisanalysis cancan bebe
adjustedadjusted ((butbut thethe totaltotal SGASGA sizesize cannotcannot
exceedexceed SGA_MAX_SIZESGA_MAX_SIZE))::
ALTERALTER SYSTEMSYSTEM SETSET
SHARED_POOL_SIZESHARED_POOL_SIZE == 64M;64M;
2222/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
LibraryLibrary CacheCache 1.1. SStorestores informationinformation aboutabout thethe mostmost recentlyrecently usedused
LibraryLibrary CacheCache
1.1. SStorestores informationinformation aboutabout thethe mostmost recentlyrecently
usedused SQLSQL andand PL/SQLPL/SQL statementsstatements::
EnablesEnables thethe sharingsharing ofof commonlycommonly usedused
statementsstatements
••
2.2. ConsistsConsists ofof twotwo structuresstructures::
•• SharedShared SQLSQL areaarea
•• SharedShared PL/SQLPL/SQL areaarea
3.3. HasHas itsits sizesize determineddetermined byby thethe sharedshared poolpool
sizingsizing
2323/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
TheThe librarylibrary cachecache consistsconsists ofof twotwo structuresstructures:: •• SharedShared SQLSQL:: TheThe
TheThe librarylibrary cachecache consistsconsists ofof twotwo structuresstructures::
•• SharedShared SQLSQL:: TheThe SharedShared SQLSQL storesstores andand
sharesshares thethe executionexecution planplan andand parseparse treetree forfor
SQLSQL statementsstatements runrun againstagainst thethe databasedatabase TheThe
secondsecond timetime thatthat anan identicalidentical SQLSQL statementstatement
isis run,run, itit isis ableable toto taketake advantageadvantage ofof thethe
parseparse informationinformation availableavailable inin thethe sharedshared SQLSQL
toto expediteexpedite itsits executionexecution ToTo ensureensure thatthat SQLSQL
statementsstatements useuse aa sharedshared SQLSQL areaarea wheneverwhenever
possiblepossible,, thethe texttext,, schemaschema,, andand bindbind
variablesvariables mustmust bebe exactlyexactly thethe same.same.
•• SharedShared PL/SQLPL/SQL:: TheThe sharedshared PL/SQLPL/SQL areaarea
storesstores andand sharesshares thethe mostmost recentlyrecently executedexecuted
PL/SQLPL/SQL statementsstatements ParsedParsed andand compiledcompiled
programprogram unitsunits andand proceduresprocedures ((functionsfunctions,,
packagespackages,, andand triggerstriggers)) areare storedstored inin thisthis
areaarea
2424/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
DataData DictionaryDictionary CacheCache ItIt isis aa collectioncollection ofof thethe mostmost recentlyrecently usedused
DataData DictionaryDictionary CacheCache
ItIt isis aa collectioncollection ofof thethe mostmost recentlyrecently usedused
definitionsdefinitions inin thethe databasedatabase
ItIt includesincludes informationinformation aboutabout databasedatabase filesfiles,,
tablestables,, indexesindexes,, columnscolumns,, usersusers,, privilegesprivileges,,
andand otherother databasedatabase obobjjectsects
DuringDuring thethe parseparse phasephase,, thethe serverserver processprocess
lookslooks atat thethe datadata dictionarydictionary forfor informationinformation
toto resolveresolve objobjectect namesnames andand validatevalidate accessaccess
CachingCaching thethe datadata dictionarydictionary informationinformation intointo
memorymemory improvesimproves responseresponse timetime onon queriesqueries
SizeSize isis determineddetermined byby thethe sharedshared poolpool sizingsizing
2525/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
SizingSizing thethe DataData DictionaryDictionary TheThe overalloverall sizesize isis dependentdependent onon thethe
SizingSizing thethe DataData DictionaryDictionary
TheThe overalloverall sizesize isis dependentdependent onon thethe sizesize ofof
thethe sharedshared poolpool sizesize andand isis managedmanaged
internallyinternally byby thethe databasedatabase IfIf thethe datadata
dictionarydictionary cachecache isis tootoo smallsmall,, thenthen thethe
databasedatabase hashas toto queryquery thethe datadata dictionarydictionary
tablestables repeatedlyrepeatedly forfor informationinformation neededneeded byby
thethe databasedatabase TheseThese queriesqueries areare calledcalled
recursiverecursive callscalls andand areare slowerslower thanthan thethe
queriesqueries thatthat areare handledhandled onlyonly byby thethe datadata
dictionarydictionary cachecache
2626/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
DatabaseDatabase BufferBuffer CacheCache • Stores the most recently used blocks thatthat • Stores the most
DatabaseDatabase BufferBuffer CacheCache
• Stores the most recently used blocks thatthat
Stores the most recently used blocks that
havehave have beenbeen been retrievedretrieved retrieved fromfrom from thethe the datadata data filesfiles files.
•• DB_BLOCK_SIZEDB_BLOCK_SIZE determinesdetermines thethe primaryprimary
DB_BLOCK_SIZE determines the primary
blockblock block sizesize size.
2727/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
MultipleMultiple BlockBlock SizesSizes AnAn OracleOracle databasedatabase cancan bebe createdcreated withwith aa
MultipleMultiple BlockBlock SizesSizes
AnAn OracleOracle databasedatabase cancan bebe createdcreated
withwith aa standardstandard blockblock sizesize andand upup toto
fourfour nonnon--standardstandard blockblock sizessizes NonNon--
standardstandard blockblock sizessizes cancan havehave anyany
powerpower--ofof--twotwo valuevalue betweenbetween 22 KBKB andand
3232 KB.KB.
2828/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
DatabaseDatabase BufferBuffer CacheCache ConsistsConsists ofof threethree independentindependent subsub--cachescaches::
DatabaseDatabase BufferBuffer CacheCache
ConsistsConsists ofof threethree independentindependent subsub--cachescaches::
•• DEFAULTDEFAULT BufferBuffer PoolPool -- DB_CACHE_SIZEDB_CACHE_SIZE
•• KEEPKEEP BufferBuffer PoolPool -- DB_KEEP_CACHE_SIZEDB_KEEP_CACHE_SIZE
•• RECYCLERECYCLE BufferBuffer PoolPool -- DB_RECYCLE_CACHE_SIZEDB_RECYCLE_CACHE_SIZE
DatabaseDatabase bufferbuffer cachecache cancan bebe dynamicallydynamically
resizedresized toto growgrow oror shrinkshrink usingusing ALTERALTER SYSTEMSYSTEM
ALTERALTER SYSTEMSYSTEM SETSET DB_CACHE_SIZEDB_CACHE_SIZE == 96M;96M;
2929/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
TypesTypes ofof buffersbuffers Unused - available for use because it has never been used or
TypesTypes ofof buffersbuffers
Unused - available for use because it has never
been used or is currently unused. The easiest for
the database to use.
Clean - used earlier and writtenwritten toto thethe diskdisk The
database can reuse it.
DirtyDirty -- changedchanged andand hashas notnot yetyet beenbeen writtenwritten toto thethe
diskdisk
3030/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
AccessAccess modesmodes ofof aa bufferbuffer FreeFree ((UnpinnedUnpinned)) -- containscontains nono datadata oror isis
AccessAccess modesmodes ofof aa bufferbuffer
FreeFree ((UnpinnedUnpinned)) -- containscontains nono datadata oror isis freefree toto
bebe overwrittenoverwritten
PinnedPinned -- currentlycurrently beingbeing accessedaccessed oror
explicitelyexplicitely retainedretained forfor futurefuture useuse ((e.ge.g thethe
KEEPKEEP bufferbuffer poolpool).).
3131/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
TwoTwo listslists ofof ((pointerspointers to)to) buffersbuffers WriteWrite listlist ((dirtydirty bufferbuffer list)list)
TwoTwo listslists ofof ((pointerspointers to)to) buffersbuffers
WriteWrite listlist ((dirtydirty bufferbuffer list)list) -- buffersbuffers thatthat areare
modifiedmodified andand needneed toto bebe writtenwritten toto thethe diskdisk
LeastLeast recentlyrecently usedused listlist (LRU)(LRU) –– buffersbuffers thatthat
havehave notnot yetyet beenbeen movedmoved toto thethe WriteWrite List.List. TheThe
mostmost recentlyrecently accessedaccessed blocksblocks areare alwaysalways inin thethe
frontfront ((MRUMRU endend,, hothot endend));; thethe leastleast recentlyrecently
accessedaccessed blocksblocks,, inin thethe endend ((LRULRU endend,, coldcold endend))
3232/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
LRULRU listlist 1.1. TheThe leastleast--usedused blocksblocks areare thrownthrown outout ofof thethe listlist whenwhen
LRULRU listlist
1.1. TheThe leastleast--usedused blocksblocks areare thrownthrown outout ofof thethe listlist
whenwhen newnew blocksblocks areare accessedaccessed andand addedadded toto
thethe MRUMRU endend ofof thethe list.list.
••
WithWith oneone exceptionexception –– whenwhen aa fullfull tabletable isis
scannedscanned –– thethe blocksblocks areare writtenwritten toto thethe LRULRU
endend ofof thethe list.list.
2.2. WhenWhen anan OracleOracle processprocess accessesaccesses aa bufferbuffer,, itit
movesmoves thethe bufferbuffer toto thethe MRUMRU endend ofof thethe listlist soso
thatthat thethe mostmost frequentlyfrequently accessedaccessed datadata isis
availableavailable inin thethe buffersbuffers
3333/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
WhenWhenWhen ananan OracleOracleOracle processprocessprocess requestsrequestsrequests datadatadata •• ItIt
WhenWhenWhen ananan OracleOracleOracle processprocessprocess requestsrequestsrequests datadatadata
•• ItIt searchessearches thethe datadata inin thethe bufferbuffer cachecache –– ifif itit
findsfinds,, wewe getget cachecache hithit
•• IfIf notnot –– cachecache missmiss –– datadata needneed toto bebe copiedcopied fromfrom
diskdisk toto thethe bufferbuffer
•• TheThe serverserver processprocess searchessearches (from(from thethe LRULRU
end)end) untiluntil itit findsfinds aa freefree bufferbuffer oror untiluntil itit hashas
searchedsearched aa thresholdthreshold limitlimit ofof buffersbuffers ItIt movesmoves
encounteredencountered dirtydirty buffersbuffers toto thethe writewrite listlist IfIf itit
doesdoes notnot findfind aa freefree bufferbuffer –– DBWnDBWn writeswrites somesome
buffersbuffers fromfrom writewrite listlist toto diskdisk –– makingmaking availableavailable
freefree buffersbuffers forfor thethe serverserver processprocess
3434/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
DatabaseDatabaseDatabase smartsmartsmart ffflashlashlash cachecachecache enabledenabledenabled (*)(*)(*) DBWnDBWn cancan
DatabaseDatabaseDatabase smartsmartsmart ffflashlashlash cachecachecache enabledenabledenabled (*)(*)(*)
DBWnDBWn cancan writewrite thethe bodybody ofof aa cleanclean bufferbuffer toto thethe
flashflash cache,cache, enablingenabling reusereuse ofof itsits inin--memorymemory
buffer.buffer. TheThe databasedatabase keepskeeps thethe bufferbuffer headerheader inin
anan LRULRU listlist inin mainmain memorymemory toto tracktrack thethe statestate andand
locationlocation ofof thethe bufferbuffer bodybody inin thethe flashflash cache.cache. IfIf
thisthis bufferbuffer isis neededneeded later,later, thenthen thethe databasedatabase cancan
readread itit fromfrom thethe flashflash cachecache insteadinstead ofof fromfrom
magneticmagnetic disk.disk.
(*)(*) CurrentlyCurrently availableavailable only in Solaris and Oracle
Enterprise Linux.
3535/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
BufferBuffer TouchTouch CountCount The frequency of access of buffers on the LRU list - instead
BufferBuffer TouchTouch CountCount
The frequency of access of buffers on the LRU list
- instead of constantly shuffling buffers on the LRU
list.
When a buffer gets pinned, the database
determines when its touch count was last
incremented. If the count was incremented over
three seconds ago, then the count is incremented.
If a buffer is on the cold end of the LRU, but its
touch count is high, then the buffer moves to the
hot end. If the touch count is low, then the buffer
ages out of the cache.
3636/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
RedoRedo LogLog BufferBuffer CacheCache • • Size Size defined defined by by LOG_BUFFER LOG_BUFFER •
RedoRedo LogLog BufferBuffer CacheCache
• • Size Size defined defined by by LOG_BUFFER LOG_BUFFER
• • Records Records changes changes made made through through the the
instance instance
• • Used Used sequentially sequentially
• • Circular Circular buffer buffer
3737/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
RedoRedo LogLog BufferBuffer CacheCache •• TheThe redoredo loglog bufferbuffer cachecache recordsrecords allall
RedoRedo LogLog BufferBuffer CacheCache
•• TheThe redoredo loglog bufferbuffer cachecache recordsrecords allall
changeschanges mademade toto thethe databasedatabase datadata blocksblocks
•• ItsIts primaryprimary purposepurpose isis recoveryrecovery
•• ChangesChanges recordedrecorded withinwithin areare calledcalled redoredo
entriesentries
•• RedoRedo entriesentries containcontain informationinformation toto
reconstructreconstruct oror redoredo changeschanges
3838/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
ResResResuuultltlt cachecachecache (11g)(11g)(11g) TheThe resultresult cachecache buffersbuffers queryquery
ResResResuuultltlt cachecachecache (11g)(11g)(11g)
TheThe resultresult cachecache buffersbuffers queryquery results.results. IfIf aa
queryquery isis runrun thatthat alreadyalready hashas resultsresults inin thethe
resultresult cache,cache, thethe databasedatabase returnsreturns resultsresults fromfrom
thethe resultresult cachecache insteadinstead ofof rerunningrerunning thethe query.query.
ThisThis speedsspeeds upup thethe executionexecution ofof frequentlyfrequently runrun
queries.queries.
TheThe databasedatabase automaticallyautomatically invalidatesinvalidates aa
cachedcached resultresult wheneverwhenever aa transactiontransaction modifiesmodifies
thethe datadata oror metadatametadata ofof anyany ofof thethe databasedatabase
objectsobjects usedused toto constructconstruct thatthat cachedcached resultresult
3939/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
ResultResult cachecache (11g)(11g) UsersUsers cancan annotateannotate aa queryquery oror queryquery fragmentfragment
ResultResult cachecache (11g)(11g)
UsersUsers cancan annotateannotate aa queryquery oror queryquery fragmentfragment
withwith aa resultresult cachecache hinthint toto indicateindicate thatthat resultsresults
areare toto bebe storedstored inin thethe SQLSQL queryquery resultresult cachecache
YouYou cancan setset thethe RESULT_CACHE_MODERESULT_CACHE_MODE
initializationinitialization parameterparameter toto controlcontrol whetherwhether thethe
SQLSQL queryquery resultresult cachecache isis usedused forfor allall queriesqueries
((whenwhen possiblepossible),), oror onlyonly forfor queriesqueries thatthat areare
annotatedannotated
4040/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
PL/SQLPL/SQL FunctionFunction ResultResult CacheCache AA PL/SQLPL/SQL functionfunction maymay dependdepend onon
PL/SQLPL/SQL FunctionFunction ResultResult CacheCache
AA PL/SQLPL/SQL functionfunction maymay dependdepend onon severalseveral parametersparameters InIn
somesome casescases,, thethe SQLSQL statementsstatements inin thethe functionfunction bodybody
accessaccess datadata (for(for exampleexample,, thethe catalogcatalog ofof wareswares inin aa
shoppingshopping applicationapplication)) thatthat changeschanges veryvery infrequentlyinfrequently
comparedcompared toto thethe frequencyfrequency ofof callingcalling thethe functionfunction
TheThe looklook--upup keykey forfor thethe cachecache isis thethe combinationcombination ofof
actualactual argumentsarguments withwith whichwhich thethe functionfunction isis invokedinvoked
WhenWhen aa particularparticular invocationinvocation ofof thethe resultresult--cachedcached
functionfunction isis aa cachecache hit,hit, thenthen thethe functionfunction bodybody isis notnot
executedexecuted;; insteadinstead,, thethe cachedcached valuevalue isis returnedreturned
immediatelyimmediately
4141/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
LargeLarge PoolPool TheThe largelarge poolpool isis anan optionaloptional areaarea ofof memorymemory inin thethe SGASGA
LargeLarge PoolPool
TheThe largelarge poolpool isis anan optionaloptional areaarea ofof memorymemory
inin thethe SGASGA configuredconfigured onlyonly inin aa sharedshared serverserver
environment.environment.
ItIt relievesrelieves thethe burdenburden placedplaced onon thethe sharedshared
poolpool
ThisThis configuredconfigured memorymemory areaarea isis usedused forfor
sessionsession memorymemory (UGA(UGA –– UserUser GlobalGlobal AreaArea),), I/OI/O
slavesslaves,, andand backupbackup andand restorerestore operations.operations.
UnlikeUnlike thethe sharedshared poolpool,, thethe largelarge poolpool doesdoes
notnot useuse anan LRULRU list.list.
SizedSized byby LARGE_POOL_SIZELARGE_POOL_SIZE
ALTERALTER SYSTEMSYSTEM SETSET LARGE_POOL_SIZELARGE_POOL_SIZE == 64M;64M;
4242/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
JavaJava PoolPool TheThe JavaJava poolpool servicesservices thethe parsingparsing requirementsrequirements forfor
JavaJava PoolPool
TheThe JavaJava poolpool servicesservices thethe parsingparsing
requirementsrequirements forfor JavaJava commandscommands
RequiredRequired ifif installinginstalling andand usingusing Java.Java.
ItIt isis sizedsized byby thethe JAVA_POOL_SIZEJAVA_POOL_SIZE parameterparameter
InIn Oracle9i,Oracle9i, thethe defaultdefault sizesize ofof thethe JavaJava PoolPool
isis 24M.24M.
4343/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
StreamsStreams PoolPool (10g)(10g) OracleOracle StreamsStreams enablesenables informationinformation sharing.sharing.
StreamsStreams PoolPool (10g)(10g)
OracleOracle StreamsStreams enablesenables informationinformation sharing.sharing.
UsingUsing OracleOracle Streams,Streams, eacheach unitunit ofof sharedshared
informationinformation isis calledcalled aa messagemessage,, andand youyou cancan
shareshare thesethese messagesmessages inin aa streamstream TheThe streamstream
cancan propagatepropagate informationinformation withinwithin aa databasedatabase oror
fromfrom oneone databasedatabase toto another.another. TheThe streamstream
routesroutes specifiedspecified informationinformation toto specifiedspecified
destinations.destinations.
UsedUsed forfor distributeddistributed databasdatabaseses,, applicationsapplications
andand datadata warehouses.warehouses.
TheThe sizesize ofof thethe StreamsStreams PoolPool startsstarts atat zero.zero.
TheThe poolpool sizesize growsgrows dynamicallydynamically asas neededneeded
4444/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
ProgramProgram GlobalGlobal AreaArea (PGA)(PGA) • • Not Not shared shared PGA ServerServer Contains: Contains:
ProgramProgram GlobalGlobal AreaArea (PGA)(PGA)
• • Not Not shared shared
PGA
ServerServer
Contains: Contains:
processprocess
• • Sort Sort area area
MMemoryemory regionregion thatthat
SORT_AREA_SIZE SORT_AREA_SIZE
containscontains datadata andand controlcontrol
– – Sort Sort area area size size can can grow grow
informationinformation forfor aa singlesingle
depending depending on on the the need. need.
serverserver processprocess oror aa singlesingle
• • Session Session information information
• • Cursor Cursor state state
• • Stack Stack space space
backgroundbackground processprocess TheThe
PGAPGA isis allocatedallocated whenwhen aa
processprocess isis createdcreated andand
deallocateddeallocated whenwhen thethe
processprocess isis terminatedterminated
4545/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
PGAPGA TheThe totaltotal memorymemory usedused byby allall individualindividual PGAsPGAs isis knownknown asas thethe
PGAPGA
TheThe totaltotal memorymemory usedused byby allall individualindividual PGAsPGAs
isis knownknown asas thethe totaltotal instanceinstance PGAPGA memorymemory,,
andand thethe collectioncollection ofof individualindividual PGAsPGAs isis
referredreferred toto asas thethe totaltotal instanceinstance PGA,PGA, oror justjust
instanceinstance PGAPGA WithWith OracleOracle EnterpriseEnterprise ManagerManager
DatabaseDatabase Control,Control, youyou setset thethe sizesize ofof thethe
instanceinstance PGA,PGA, notnot individualindividual PGAsPGAs
4646/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
UserUser GlobalGlobal AreaArea (UGA)(UGA) 1. UGA contains session variables e.g. logon information, values of package
UserUser GlobalGlobal AreaArea (UGA)(UGA)
1. UGA contains session variables e.g. logon
information, values of package variables.
2. When using a dedicated server connection, the
UGA is stored in the PGA.
3. When using a shared server connection, the
UGA is stored in the Large Pool of the SGA
enabling any shared server process access to
it.
4747/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
SummarySummary 11 4848/49/49 Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
SummarySummary 11
4848/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.
SummarySummary 22 FixedFixed SGASGA –– internalinternal areaarea forfor communicationcommunication betweenbetween
SummarySummary 22
FixedFixed SGASGA ––
internalinternal areaarea forfor
communicationcommunication
betweenbetween
processesprocesses
4949/49/49
Copyright  Oracle Corporation, 1998, 2001, 2010. All rights reserved.