Sunteți pe pagina 1din 11

Or

acl
eSer
verAr
chi
tect
ure

OracleSer
veri
sanobjectr
elat
ional
dat
abasemanagementsy
stem t
hatpr
ovi
desanopen,
compr
ehensi
ve,
int
egr
ated
approachtoi
nfor
mati
onmanagement .

Di
agr
am ofOr
acl
eSer
verAr
chi
tect
ure

St
reamsPOOL Lar
gePool

JAVAPOOL

Or
acl
eInst
ance:

Oracl
eInst
anceisacombinat
ionofMemorystr
ucturesandBackgroundPr
ocessesusedt
omanaget heDat
abase.One
i
nstancecanopenanduseonlyoneDat
abase.TherearetwobasicMemorystr
uctur
esinOracl
e’
sInst
ance.

1.SGA(
System GlobalArea)
2.PGA(
Program GlobalArea)

1.SGA:

SGACont ai
nst
hedat
acont r
oli
nfor
mationfortheOracleser
ver.I
tisal
locat
edi
nthevi
rt
ualmemoryofthe
computerwher
etheOracl
eserverr
esi
des.TheSGAconsi stsofsever
almemorystr
uct
uresSGAconsi
stsof
sever
ali
temsli
kebuf
fercache,
sharedpool
, andRedologbuff
ers.

1.Buff
erCache.
2.SharedPool
.
3.RedologBuf
fer
.

1.Buf
ferCache:

TheDatabaseBuffercacheisusedt ostoretherecentl
yaccesseddat a.TheBuff
erCachehast wopurposes:to
I
mpr oveperfor
mancef orsubsequentrepeatedselectstat
ement sonthesamedat a,andtoalloworacleusersto
makechangesqui cklyinmemor y.Or
aclewritesthosedatachangestot hediskl
ater
.Thedat abasebuffercacheis
divi
dedintodir
tyl
ists(Buf
ferthathavebeenmodi f
iedandwai t
ingtobewr i
tt
entodisk)andleastrecentl
yused
(LRU)l
ists.Buf
fer
st hoseareunmodifiedareusedasf reeli
sts.

ThesizeoftheBuf
ferCachecanbedet
ermi
nedbyt
he
I
nit
ial
i
zationpar
ameter
DB_
CACHE_
SIZE

Thesi
zeoft
hebuf
feri
sbasedont
hei
nit
ial
i
zat
ionpar
amet
er

DB_
BLOCK_
SIZE

Whenaquer yisbeingexecuted,
theserverpr
ocessl
ooksinthedatabasebuf
fercacheforanyblocksi
tneeded.I
f
theblocksar
enotf oundinthebuff
ercache,t
henitr
eadsthedatafrom t
hedbffi
lesandplacesacopyinthe
buff
ercache.Ifanysubsequentsamerequestsarei
ssuedbytheuser,or
acl
egivesthedatafrom t
hebuff
ercache
i
tsel
f.

2.Shar
edPool
:

Theshar
edpooli
susedtostoret
hemostr
ecent
lyexecutedSQLstat
ement
sandmostr
ecent
lyuseddat
a
fr
om t
hedat
adicti
onar
y.Therear
etwomandat
orystr
ucturesi
ntheShar
edpool
.

I
.Libr
aryCache.
I
I.Dat
aDict
ionar
yCache.

Li
brar
yCache:

Li
braryCachei susedtostor etheparsedSQLst at
ementtextandstat
ement’
sExecut
ionpl
anforr
euse.Li
brar
y
cachestoresthemostr ecentlyusedSQLst atementsi
namemor ystr
uct
urecal
l
edasharedSQLarea.The
SharedSQLar eaconsists
 Thet extofSQLSt atement s.
 Thepa rsedtree–t heCompi ledversi
onofStatement.
 ExecutionPlan-Thest epstobetakentoexecutethe
St
atement
DataDicti
onaryCache:

I
tisal
socal
l
edasDicti
onaryCacheor“r
owCache”
,whi
chisusedtostor
erecent
lyaccessedi
nfor
mationf
rom
t
heOracl
eDataDi
cti
onarysuchastabl
eandcol
umndefi
nit
ions,
user
names,passwords,andpr
ivi
l
eges.

Dur
ingtheparsephase,
theser
verpr
ocesslooksforthei
nfor
mationi
nt heDicti
onarycachetor
esol
vethe
obj
ectnamesspecifi
edint
heSQLstatementtovali
datet
heaccessprivi
leges.I
fnecessaryt
heser
verprocess
l
odestherequir
edinf
ormati
onfr
om t
hebaset abl
esintot
hedatadict
ionarycache.

Wecandet
ermi
net
heshar
epool
sizebyt
hepar
amet
er

SHARED_
POOL_
SIZE
3.Redol
ogBuf
fer
:

RedologBuff
erisusedtostoret heRedologentri
esgeneratedbytheDMLst atements.ARedologent
ryi
sa
smallamountofinf
ormationpr oducedandsav edbyoracletoreconstr
uct
, orredo,changesmadetothe
databasebyi
nsert,
update,create,al
teranddropstatements.I
fsomesor toff ai
lur
eoccurs,t
heDBAcanuse
redoinfor
mati
ontorecovertheOr acledatabasetothepointofdatabasefail
ure.

Thesi
zeoft
heRedol
ogbuf
feri
sdet
ermi
nedbyt
hei
nit
ial
i
zat
ionpar
amet
er

LOG_
BUFFER

Therearetwoopt ionalcomponentsinOracl
e’sSGA.Theyar
e
1.JavaPool :Usedt ostoreJavaCode.
2.LargePool :Usedtost orel
argememor ystr
uct
uresnot
Dir
ectlyr
elat
edt oSQLst atementsprocessi
ng,
Suchasdat ablockscopi edduri
ngthebackupand
Restoreoperati
ons.

Si
mpl
efor
m ofSGA

2.PGA:

TheOtherMemoryst
ructur
einOracl
einstanceiscal
ledtheProgr
am Gl
obal
Area(PGA).PGAhel
psuserprocesses
execut
ebystor
ingi
nfor
mat i
onl
ikebi
ndv ari
ableval
ues,sortar
ea,andt
heot
heraspect
sofcur
sorHandl
ing.
PGAcontai
ns

1.Sor
tAr
ea:
Thi
sisusedt
oper
for
m anysor
toper
ati
ons.

2.Sessi
onI
nfor
mat
ion:
Suchasuserpr
ivi
l
egesf
ort
heSessi
on.

3.CursorSt
ate:
Thi
sindi
cat
est
hest
agei
nthepr
ocessi
ngofv
ari
ouscur
sor
sthatar
eusedi
nthecur
rent
sessi
on.

4.St
ackSpace:
Cont
ainst
heSessi
onVar
iabl
es.

PGAi
sal
l
ocat
edwhenapr
ocessi
scr
eat
edandde-
all
ocat
edwhent
hePr
ocesst
ermi
nat
es.

UserPr
ocess:

Whenauserstart
sat oolsuchasSQL*Pl
usorD2Kauserpr ocessiscreatedonthecl
ientMachi
ne.I
tst
art
swhent
he
tooli
sst
art
edandt er
mi nat
edwhentheuserexi
tsorclosestheappli
cati
on.TheUserprocessi
ncl
udest
heUser
progr
am I
nter
face(UPI)
.TheUPIgener
atesthenecessarycall
stotheServerPr
ocess.
Ser
verPr
ocess:

Whenausert r
iest
ol ogontotheOr acleserverbyspecif
yingaUsernameandaPasswor
d,aserverprocessiscreat
ed
ontheMachinewhereOr acleserverruns.TheServerprocesscommunicat
eswit
htheor
acleser
v eronthebehalfofthe
userpr
ocessthatr
unsont hecli
ent.Therearetwoway st hataDBAcansetupOr
acl
etorunserv
erpr ocesses.
1.DedicatedServers.b.SharedServers.

Dedi
cat
edSer
ver
s:

I
ndedicatedserv
ersetup,ev erysi
ngleuserprocessconnect
ingt
ooraclewill
hav
eitsownser verprocess.Suppose
ther
ear e100user sconnectedto
Oracleserver,t
hentherewil
l be100
Oracle9icanchangeitsSGAConf igur
ati
onwhi l
etheinst
ancei
srunning.The serverprocessesintheOracleServ
er.
si
zeoft heBufferCache,theSharedpool, andl
argepoolcanbechanged
wi
t houtshut
ti
ngdownt hei nst
ance.–Dy namicSGA

I
ntheDedi
cat
edser
vermode

NumberofSer
verPr
ocesses=NumberofUserPr
ocesses

Adv
ant
ages:

 Ev
eryr
equest
eduserwi
l
lgett
hei
rdat
aret
ri
eval
request
sact
eduponi
mmedi
atel
y.

Di
sadv
ant
ages:

1.Ther
ewil
lbeaddi
ti
onal
memoryandCPUrequiredf
ortheMachinerunni
ngt
heOracl
eDatabase.
2.Mostoft
heti
metheOracl
eSer
verwi
ll
siti
dle,
ifapart
icul
aruseri
snotsubmit
ti
nganyquer
ies.

Shar
edSer
ver
s

I
nthi
sset
up,
sev
eral
concur
rentuser
sar
eser
vedbyasi
ngl
eser
verpr
ocess.Or
acl
emanagest
hisset
upbyanet
wor
k
pr
ocesscal
l
eddi
spat
cher
.

TheUserpr
ocessesareassignedt oadispat
cher,andthedispat
cherput
st heuserrequestf
ordat
aint
oonequeue,
and
theshar
edser
verprocessfulf
il
lstherequest
s,oneatat i
me.Thisconfi
gurati
oncanr educethememoryandCPU
burdenont
hemachinet hathostsOracl
e,aswellaslimit
ingtheser
verprocessidl
etime.

Di
sadv
ant
ages:

1.Dur
ingper
iodsofhi
ghdat
abaseuse,
theuserpr
ocesseshav
etowai
tfort
heav
ail
abi
l
ityofser
verpr
ocess.

Howt
heUser
sar
eConnect
edt
otheOr
acl
eSer
ver

ANet wor kprocesscalledListenerprocessresi


desi ntheOracleServ
er’
sMachine.TheLi
stenerprocessl
istensfor
userst r
yingtoconnectt otheOr acl
edat abaseviatheNet wor
k.Whenauserconnectstoamachi nehostingtheOr acl
e
database, t
helist
enerpr ocesswi l
ldooneoft wot hi
ngs.
Ifdedicatedserverprocessisbei ngused, t
henthelist
enertel
lsoracl
etogener
ateanewSer verprocessandt hen
assignstheuserpr ocesst othatdedicatedserv
erpr ocess.

I
fMTSi sbei
ngused,t
heli
stenersendst
heuserprocesstot
heDispatcher
.Thedispatcherpl
acest
heusersr
equeston
t
herequestqueue,
wherei
tispickedbyt
heavai
lableserv
erpr
ocess.Therequestqueueiscommonf oral
ldi
spat
chers
i
nSGA.

Theserverprocesschecksther equestqueueforanynewrequest
sandpicksupnewrequestsonaf i
rst
-i
n-f
ir
st-out
basi
s.Whent heservercompl et
est herequest
s,i
tplacest
heresul
tsont
hecalli
ngdi
spatcher
’sresponsequeue.Each
di
spatcherhasitsownr esponsequeuei nSGA.

Pr
ocessi
ngaQuer
y
1.Whenausersubmi
tsav
ali
dSQLst
atement
,fi
rstt
heser
verpr
ocesssear
cheswhet
herapar
sedcopyoft
his
st
atementi
sexi
stsi
nShar
edpool
ornot
.

2.Theni
tchecksf
ort
hev
ali
dit
yoft
hei
ssuedSQLst
atement
.

3.Checksi
nthedat
adi
cti
onar
ywhet
heral
lthecol
umnsandt
abl
esr
efer
redi
nthi
sst
atementexi
stornot
.
(
Per
for
mst
hesechecksbyget
ti
ngt
hedat
afr
om t
heBaset
abl
esi
ntot
heDat
aDi
cti
onar
yCache)
.

4.Nowt
hest
atementacqui
respar
sel
ocksonobj
ect
sref
erencedi
nthi
sst
atementsot
hatt
hei
rdef
ini
ti
onsdon’
t
changewhi
l
ethest
atementi
spar
sed.

5.Or
acl
eensur
est
hatt
heuserat
tempt
ingt
oexecut
ethi
sst
atementhasenoughpr
ivi
l
egesi
nthedat
abase.

6.Af
tert
hisOr
acl
ecr
eat
esanExecut
ionpl
anf
ort
hest
atementandpl
acesi
tint
othel
i
brar
ycache.(
Execut
ion
Plan–t heoptimalmet hodforexecutingt
heSQLSt atement.Opti
mizerf
unct
iondeter
minestheexecut
ion
plan).I
fthi
spar seisalr
eadyexiststhenoracl
eskipsthi
sstep.
7.Oracleperfor
msal ltheprocessingt
oexecut et
heselectst
at ement
.Atthi
spointt
heserverpr
ocesswil
l
retr
ievethedatafrom thediskintot
hebuf f
ercache.

8.Oncet
hest
atementhasbeenexecut
ed,
all
dat
aret
urnedf
rom Or
acl
eisst
oredi
naCur
sor
.Thedat
aist
hen
pl
acedi
nbi
ndv
ari
abl
es,
rowbyr
owandr
etur
nedt
otheuserpr
ocess.

Pr
ocessi
ngaDMLSt
atement

TheDMLst
atement
sexecut
ioni
ssi
mil
art
othenor
mal
SQLst
atement
s.
1.Oraclecreat
esanExecut i
onplantoexecutetheDMLst atementandplacesthati
ntheli
brar
ycache.I
ftheexecut
ion
planalr
eadyexistsforthi
sstat
ement,Oracleski
psthisstep.Ift
heDatablocksarenotpr
esentint
heBuffercachet
hen
the
Serverprocessreadsthedatablockf
rom thedatabaseintothebuf
fercache.

2.Oracl
eperf
ormsallt
heprocessi
ngstepstoexecutetheDMLstatement.ForUpdat
eorDelet
estatement
s,theser
ver
processwi
ll
retr
iev
edatafr
om thediski
ntothebuffercache,
impl
i
citl
yacquir
esalockonthedatatobechangedand
thenmakesthespeci
fi
cchangesinthebuff
ercache.

3.Whenexecuti
ngaDMLst atementOr
aclewri
test
heoldandnewv er
sionsofdat
atother
oll
backsegmentacqui
red
fr
om t
hetransact
ion.I
ntheRedol
ogbufferOr
acler
ecor
dsthechangestobemadet ot
herol
lbackanddat
a.

ALockisanOracl
einternalr
esour
cethatoneuserprocessacqui
resbef
ore Ther ol
lbackblocki
susedto
updat
ingordel
eti
ngexisti
ngdatatoprev
entotheruser
sf r
om doi
ngthesame storethebeforeimageoft
he
thi
ng. data,sothattheDML
statementscanber ol
l
edbacki
f
necessar
y.Newv
aluesar
epopul
atedi
nthedat
abl
ockbuf
fer
s

4.TheServerPr
ocessrecor
dsthebefore-
imaget otheRoll
backsegmentsandupdatesthedat
ablock.Boththe
changesar
edoneinthedatabasebuffercache.Anychangedblocksi
nthebuffercachear
emarkedasdi r
tyblocks
–thatist
hebuffer
sthosearenotsameast hecorr
espondi
ngblocksonthedisk.

ForEver
yDMLStatement,
theuserprocessmustwri
tearedoent
rytotheRedol
ogbuff
ers.I
nthi
swayOr
acl
ecan
recov
eradat
achangeifdamageislaterdonet
othediskf
il
escont
aini
ngtheOracl
edata.
Backgr
oundPr
ocesses:

TheBackgroundprocessesinaninst
anceper
for
mf uncti
onsthosear
eneededt oserv
icet
herequestfrom dif
fer
ent
concur
rentuser
s.EachOr acl
eInst
anceusesdi
ff
erentbackgr
oundprocessesdependi
ngontheconfigurat
ion.

Therearesev
eraltypesofpr
ocessesrunni
ngalt
heti
mei nOracl
e.Themostimpor
tantonefr
om t
heuser
sprospect
ive
i
st heServ
erProcess.TheSer
verProcessact
sontheuser’
sbehalft
opul
lOracl
eDatafrom t
hedi
ski
ntothebuf
fer
cache.

Ther
ear
esomemandat
oryandopt
ional
backgr
oundpr
ocessesi
nOr
acl
e’
sInst
ance.Theyar
e

1.SMON(System Monitor)
2.PMON(ProcessMoni tor
)
3.LGWR(LogWr i
ter)
4.DBW0(DatabaseWr i
ter)
5.ARC0(
ArchiveProcess)
6.CKPT(
CheckpointProcess)

a.SMON:

SMONi soneofthemandat or
ybackgroundpr
ocessesinOracleInst
ance.I
fOracl
eInstancefai
l
s,anyinf
ormationthat
i
swrit
teninSGAt hathasnotbeenwrit
tentot
hediskwillbelost
.Aftert
helossofi
nstance,t
hebackgroundprocess
SMONaut omat
icall
yperfor
msr ecov
erywhenthedatabaseisstart
ed.Theinst
ancerecover
yconsistt
hefal
lowing
st
eps.

▫AnyUn-
commi
tt
edt
ransact
ionswi
l
lber
oll
edback.

▫Anycommi
tt
edt
ransact
ionsar
erecor
dedi
ntheRedol
ogbuf
fer
,Thechangesar
ewr
it
tent
othedat
abasef
il
es.I
n
thi
spr ocessSMONreadsthedat
afr
om theRedologbuf
fer
sandappl
i
est
hosechangest
othedat
abasef
il
es.Thi
s
processcomplet
elyr
ecoverst
heset
ransact
ions.

▫I
fanyl
ocksar
eappl
i
edont
hedat
abaset
abl
esbef
oret
hei
nst
ancecr
ash,
nowt
heyar
erel
eased.

SMONal
soper
for
mssomemai
ntenancef
unct
ions

1.I
tCombi
nes,
orcoal
esces,
adj
acentar
easoff
reespacei
nthedat
afi
l
es.

2.De-
all
ocat
est
het
empor
arysegment
stor
etur
nthef
reespacei
nthedat
afi
l
es.

b.PMON:

PMONmoni torstheuserprocessesonthedatabaset
omakesur ethattheyworkcor
rect
ly.Ifforanyreasonauser
processf
ail
sduringit
sconnectiontoOracl
e,PMONwi ll
cleanupt
heact i
vit
iest
hosearerelatedtotheuserpr
ocess
andmakesur ethatanychangesthati
tmadet othesystem wi
l
lberoll
edback.

PMONi
sresponsi
blef
or

 Rol
li
ngbackthedisconnect
eduserprocess’st
ransacti
ons.
 Rel
easinganyl
ocksthoseareacqui
redbyt hedisconnect
eduserprocess.
 Fr
eeingall
ther
esourcesusedbythedisconnecteduserprocess.

c.LGWR:
Logwr
iterwri
tesent
ri
esfr
om t
heRedol
ogbuffert
otheRedol
ogf
il
es.Thel
ogwr
it
erper
for
mssequent
ial
wri
test
othe
Redol
ogf i
l
esunderthef
all
owi
ngsi
tuat
ions.

 WhentheRedologbufferis1/3fil
l
ed.
 Whenthetimeoutoccurs(forever
y3seconds)
 Bef
oretheDBWRwr i
testhedirt
yblockst
othedat
abasef
il
es(
DBFs)
.
 Whenat r
ansact
ioncommi t
s.

TheLGWRconfir
mst heCOMMITonl
yaft
ert
her
edoi
swri
tt
ent
othedi
sk.I
fther
ear
etwomember
sinaRedol
ogf
il
e
thenLGWRwri
testhesamedat
ainbotht
hemember
s.

d.
DBW0:

Theserv
erprocessr
ecor
dst
hechangest
other
oll
backsegment
sandt
obl
ocksi
nthebuf
fercache.Thedat
abase
Wri
terwri
testhedi
rt
y
Bl
ocksf
rom t
hebuff
ercachetothedatabasef
il
es(
DBFs)
.DBW0ensur
est
hatasuf
fi
cientnumberoff
reebuf
fer
sar
e
av
ail
abl
eint
hedatabasebuf
fercache.

DBW0i
sinv
okedwhen

1.TheNumberofdir
tybuff
ersreachest
oat hr
esholdval
ue.
2.Whenaprocessscansaspecifi
ednumberofblockswhenscanni
ngf
ort
hef
reebuf
fer
sandcan’
tfi
ndany
.
3.Whenti
meoutoccurs(f
orevery3seconds).
4.Whenacheckpoi
ntoccurs.

e.
ARC0:

TheArchivepr
ocess(ARC0)i
sanopti
onalbackgroundprocesswhi
chisinv
okedwhenthedatabasei
sinAr
chiv
elog
modeonl y
.Ift
hedatabasei
sinar
chi
velogmode, wheneveraRedologfi
lef
il
ls,t
heOr
acl
eserverbegi
nswri
ti
ngtothe
nextonl
ineRedol
ogfil
eandthent
heARC0pr ocessisinv
okedt oar
chiv
ethefil
l
edRedol
ogfi
le.

TheARC0pr
ocessi
nit
iat
est
hebacki
nguporar
chi
vi
ngoft
hef
il
ledonl
i
neRedol
oggr
oupatev
eryl
ogswi
tch.

Thesear
chi
vedl
ogf
il
esar
ever
yimpor
tantt
orecov
ert
hedat
abasei
nthecaseofadi
skcr
ash.

S-ar putea să vă placă și