You are on page 1of 23



At the end of this unit, you will be able to Lea!n about O!a"le a!"hite"tu!e in b!ief

Int!odu"tion to O!a"le#

Lo$i"al database st!u"tu!e %hysi"al database st!u"tu!e Se!&e! a!"hite"tu!e




An O!a"le database is a "olle"tion of data that is t!eated as a unit# The $ene!al (u!(ose of a database is to sto!e and !et!ie&e !elated info!)ation# The database has a lo$i"al st!u"tu!e and a (hysi"al st!u"tu!e# The (hysi"al st!u"tu!e of the database is the set of o(e!atin$ syste) files in the database# An O!a"le database "onsists of th!ee file ty(es Data files * "ontain the a"tual data in the database# The data is sto!ed in use!* defined tables, but data files also "ontain the data di"tiona!y, befo!e*i)a$es of )odified data, inde+es, and othe! ty(es of st!u"tu!es# A database has at least one data file# The "ha!a"te!isti"s of data files a!e A data file "an be asso"iated with only one database# Data files "an ha&e "e!tain "ha!a"te!isti"s set to allow the) to auto)ati"ally e+tend when the database !uns out of s(a"e# One o! )o!e data files fo!) a lo$i"al unit of database sto!a$e "alled a tables(a"e#

Redo Log Files * Redo lo$s "ontain a !e"o!d of "han$es )ade to the database to enable !e"o&e!y of the data in "ase of failu!es# The !edo lo$s a!e "!eated in $!ou(s# An O!a"le database )ust ha&e at least two !edo lo$ $!ou(s# The !edo lo$ )e)be!s a!e the a"tual datafiles# ,hen a $!ou( has )o!e than one )e)be!, the !edo lo$s a!e "onside!ed )ulti(le+ed# A )ulti(le+ed !edo lo$ $!ou( w!ites to ea"h )e)be! at the sa)e ti)e# This (!o&ides a way of )i!!o!in$ the !edo lo$s, and O!a"le st!on$ly !e"o))ends this (!o"edu!e# -ou should (la"e the $!ou( )e)be!s on diffe!ent dis. de&i"es and dis. "ont!olle!s to (!e&ent (!oble)s f!o) o""u!!in$ due to dis. o! "ont!olle! failu!e# On"e a $!ou( has a )e)be!, all subse/uent new )e)be!s )ust be the sa)e si0e# 1o! (e!fo!)an"e !easons, you )i$ht add !edo lo$ $!ou(s due to hi$h le&els of t!ansa"tion a"ti&ity#

T e Co!t"ol File # Cont!ol files "ontain info!)ation ne"essa!y to )aintain and &e!ify database inte$!ity# 1o! e+a)(le, a "ont!ol file is used to identify the data files and !edo lo$ files# A database needs at least one "ont!ol file# The "ont!ol file is a s)all bina!y file !e/ui!ed to )ount and o(en an O!a"le database# The instan"e )ust be able to w!ite to this file when the database is o(en# The# database na)e and the lo"ation of all e+te!nal files 2database files and !edo lo$s3 asso"iated with an instan"e a!e "ontained in the "ont!ol file# ,hen !e"o&e!in$ a database, you use the "ont!ol file to dete!)ine whi"h datafiles )ust be !e"o&e!ed #The "ont!ol file na)e is s(e"ified in the


init#o!a file with the Cont!ol5files (a!a)ete!# O!a"le !e"o))ends that you define at least th!ee "ont!ol files fo! one instan"e# Ot e" $e% Files The O!a"le se!&e! also uses othe! files that a!e not (a!t of the database The (a!a)ete! file defines the "ha!a"te!isti"s of an O!a"le instan"e# 1o! e+a)(le, it "ontains (a!a)ete!s that si0e so)e of the )e)o!y st!u"tu!es in the S6A# The (asswo!d file authenti"ates whi"h use!s a!e (e!)itted to sta!t u( and shut down an O!a"le instan"e# A!"hi&ed !edo lo$ files a!e offline "o(ies of the !edo lo$ files that )ay be ne"essa!y to !e"o&e! f!o) )edia failu!es# The Lo$i"al St!u"tu!e * O!a"le allo"ates lo$i"al database s(a"e fo! all data in a database#
The units of database space allocation are Tablespaces Segments Extents Data Blocks

At the finest le&el of $!anula!ity, O!a"le sto!es data in data blo".s 2also "alled lo$i"al blo".s, O!a"le blo".s, o! (a$es3# One data blo". "o!!es(onds to a s(e"ifi" nu)be! of bytes of (hysi"al database s(a"e on dis. The ne+t le&el of lo$i"al database s(a"e is "alled an e+tent# An e+tent is a s(e"ifi" nu)be! of "onti$uous data blo".s allo"ated fo! sto!in$ a s(e"ifi" ty(e of info!)ation #The le&el of lo$i"al database sto!a$e abo&e an e+tent is "alled a se$)ent# A se$)ent is a set of e+tents that ha&e been allo"ated fo! a s(e"ifi" ty(e of data st!u"tu!e# 1o! e+a)(le, ea"h table7s data is sto!ed in its own data se$)ent, while ea"h inde+7s data is sto!ed in its own inde+ se$)ent# If the table o! inde+ is (a!titioned, ea"h (a!tition is sto!ed in its own se$)ent# O!a"le allo"ates s(a"e fo! se$)ents in units of one e+tent# ,hen the e+istin$ e+tents of a se$)ent a!e full, O!a"le allo"ates anothe! e+tent fo! that se$)ent# Be"ause e+tents a!e allo"ated as needed, the e+tents of a se$)ent )ay o! )ay not be "onti$uous on dis.#A se$)ent 2and all its e+tents3 a!e sto!ed in one tables(a"e# ,ithin a tables(a"e, a se$)ent "an s(an datafiles 2ha&e e+tents with data f!o) )o!e than one file3# 8owe&e!, ea"h e+tent "an "ontain data f!o) only one datafile#
Data Bloc&s

O!a"le )ana$es the sto!a$e s(a"e in the datafiles of a database in units "alled data blo".s# A data blo". is the s)allest unit of I9O used by a database# In "ont!ast, at the (hysi"al, o(e!atin$ syste) le&el, all data is sto!ed in bytes# Ea"h o(e!atin$ syste) has what is "alled a blo". si0e# O!a"le !e/uests data in )ulti(les of O!a"le data blo".s, not o(e!atin$ syste) blo".s #-ou set the data blo". si0e fo! ea"h O!a"le database when you "!eate the database #This data blo". si0e should be a )ulti(le of the o(e!atin$ syste)7s blo". si0e within the )a+i)u) li)it to a&oid unne"essa!y I9O# O!a"le data blo".s a!e the s)allest units of sto!a$e that O!a"le "an use o! allo"ate#


Data Blo". St!u"tu!e *

Data Bloc& Fo"'at The O!a"le data blo". fo!)at is si)ila! !e$a!dless of whethe! the data blo". "ontains table, inde+, o! "luste!ed data# Heade" (Co''o! a!d )a"iable* The heade! "ontains $ene!al blo". info!)ation, su"h as the blo". add!ess and the ty(e of se$)ent 2fo! e+a)(le, data, inde+, o! !ollba".3# Table Di"ecto"% This (o!tion of the data blo". "ontains info!)ation about the tables ha&in$ !ows in this blo".# Ro+ Di"ecto"% This (o!tion of the data blo". "ontains info!)ation about the a"tual !ows in the blo". 2in"ludin$ add!esses fo! ea"h !ow (ie"e in the !ow data a!ea3# On"e the s(a"e has been allo"ated in the !ow di!e"to!y of a data blo".7s o&e!head, this s(a"e is not !e"lai)ed when the !ow is deleted# The!efo!e, a blo". that is "u!!ently e)(ty but had u( to ;< !ows at one ti)e "ontinues to ha&e 1<< bytes allo"ated in the heade! fo! the !ow di!e"to!y# O!a"le !euses this s(a"e only when new !ows a!e inse!ted in the blo".# Ove" ead The data blo". heade!, table di!e"to!y, and !ow di!e"to!y a!e !efe!!ed to "olle"ti&ely as o&e!head# So)e blo". o&e!head is fi+ed in si0e= the total blo". o&e!head si0e is &a!iable#


Ro+ Data This (o!tion of the data blo". "ontains table o! inde+ data# F"ee Space 1!ee s(a"e is allo"ated fo! inse!tion of new !ows and fo! u(dates to !ows that !e/ui!e additional s(a"e 2fo! e+a)(le, when a t!ailin$ null is u(dated to a non*null &alue3# ,hethe! issued inse!tions a"tually o""u! in a $i&en data blo". is a fun"tion of "u!!ent f!ee s(a"e in that data blo". and the &alue of the s(a"e )ana$e)ent (a!a)ete! %CT1REE# A! I!t"od,ctio! to -CTFREE. -CTUSED Two s(a"e )ana$e)ent (a!a)ete!s, %CT1REE and %CTUSED, enable you to "ont!ol the use of f!ee s(a"e fo! inse!ts of and u(dates to the !ows in all the data blo".s of a (a!ti"ula! se$)ent# -ou s(e"ify these (a!a)ete!s when "!eatin$ o! alte!in$ a table o! "luste! 2whi"h has its own data se$)ent3# T e -CTFREE -a"a'ete" The %CT1REE (a!a)ete! sets the )ini)u) (e!"enta$e of a data blo". to be !ese!&ed as f!ee s(a"e fo! (ossible u(dates to !ows that al!eady e+ist in that blo".# 1o! e+a)(le, assu)e that you s(e"ify the followin$ (a!a)ete! within a CREATE TABLE state)ent %CT1REE '< This states that '<> of ea"h data blo". in this table7s data se$)ent will be .e(t f!ee and a&ailable fo! (ossible u(dates to the e+istin$ !ows al!eady within ea"h blo".# New !ows "an be added to the !ow data a!ea, and "o!!es(ondin$ info!)ation "an be added to the &a!iable (o!tions of the o&e!head a!ea, until the !ow data and o&e!*head total ?<> of the total blo". si0e#


T e -CTUSED -a"a'ete" The %CTUSED (a!a)ete! sets the )ini)u) (e!"enta$e of a blo". that "an be used fo! !ow data (lus o&e!head befo!e new !ows will be added to the blo".# Afte! a data blo". is filled to the li)it dete!)ined by %CT1REE, O!a"le "onside!s the blo". una&ailable fo! the inse!tion of new !ows until the (e!"enta$e of that blo". falls below the (a!a)ete! %CTUSED# Until this &alue is a"hie&ed, O!a"le uses the f!ee s(a"e of the data blo". only fo! u(dates to !ows al!eady "ontained in the data blo".# 1o! e+a)(le, assu)e that you s(e"ify the followin$ (a!a)ete! in a CREATE TABLE state)ent %CTUSED :< In this "ase, a data blo". used fo! this table7s data se$)ent is "onside!ed una&ailable fo! the inse!tion of any new !ows until the a)ount of used s(a"e in the blo". falls to 4A> o! less 2assu)in$ that the blo".7s used s(a"e has (!e&iously !ea"hed %CT1REE3#


E/te!ts An e+tent is a lo$i"al unit of database sto!a$e s(a"e allo"ation )ade u( of a nu)be! of "onti$uous data blo".s# One o! )o!e e+tents in tu!n )a.e u( a se$)ent# ,hen the e+istin$ s(a"e in a se$)ent is "o)(letely used, O!a"le allo"ates a new e+tent fo! the se$)ent# 0 e! E/te!ts A"e Allocated ,hen you "!eate a table, O!a"le allo"ates to the table7s data se$)ent an initial e+tent of a s(e"ified nu)be! of data blo".s# Althou$h no !ows ha&e been inse!ted yet, the O!a"le data blo".s that "o!!es(ond to the initial e+tent a!e !ese!&ed fo! that table7s !ows# If the data blo".s of a se$)ent7s initial e+tent be"o)e full and )o!e s(a"e is !e/ui!ed to hold new data, O!a"le auto)ati"ally allo"ates an in"!e)ental e+tent fo! that se$)ent# An in"!e)ental e+tent is a subse/uent e+tent of the sa)e o! $!eate! si0e than the (!e&iously allo"ated e+tent in that se$)ent# Dete"'i!i!g t e N,'be" a!d Si1e of E/te!ts Sto!a$e (a!a)ete!s e+(!essed in te!)s of e+tents define e&e!y se$)ent# Sto!a$e (a!a)ete!s a((ly to all ty(es of se$)ents# They "ont!ol how O!a"le allo"ates f!ee database s(a"e fo! a $i&en se$)ent# 1o! e+a)(le, you "an dete!)ine how )u"h s(a"e is initially !ese!&ed fo! a table7s data se$)ent o! you "an li)it the nu)be! of e+tents the table "an allo"ate by s(e"ifyin$ the sto!a$e (a!a)ete!s of a table in the STORA6E "lause of the CREATE TABLE state)ent#


Sto"age -a"a'ete"s 2o, Ca! Specif% E&e!y database has default &alues fo! sto!a$e (a!a)ete!s# -ou "an s(e"ify defaults fo! a tables(a"e, whi"h o&e!!ide the syste) defaults to be"o)e the defaults fo! obCe"ts "!eated in that tables(a"e only# 1u!the!)o!e, you "an s(e"ify sto!a$e settin$s fo! ea"h indi&idual obCe"t# The sto!a$e (a!a)ete!s you "an set a!e INITIAL The si0e, in bytes, of the fi!st e+tent allo"ated when a se$)ent is "!eated# Default ; data blo".s Dini)u) ' data blo".s 2!ounded u(3 Da+i)u) o(e!atin$ syste) s(e"ifi" NE3T The si0e, in bytes, of the ne+t in"!e)ental e+tent to be allo"ated fo! a se$)ent# The se"ond e+tent is e/ual to the o!i$inal settin$ fo! NEET# 1!o) the!e fo!wa!d, NEET is set to the (!e&ious si0e of NEET )ulti(lied by 21 F %CTINCREASE91<<3# Default ; data blo".s Dini)u) 1 data blo". Da+i)u) o(e!atin$ syste) s(e"ifi" 4A3E3TENTS The total nu)be! of e+tents, in"ludin$ the fi!st, that "an e&e! be allo"ated fo! the se$)ent# Default de(endent on the data blo". si0e and o(e!atin$ syste) Dini)u) 1 2e+tent3 Da+i)u) unli)ited 4INE3TENTS The total nu)be! of e+tents to be allo"ated when the se$)ent is "!eated# This allows fo! a la!$e allo"ation of s(a"e at "!eation ti)e, e&en if "onti$uous s(a"e is not a&ailable# Default 1 2e+tent3 Dini)u) 1 2e+tent3 Da+i)u) unli)ited -CTINCREASE The (e!"ent by whi"h ea"h in"!e)ental e+tent $!ows o&e! the last in"!e)ental e+tent allo"ated fo! a se$)ent# If %CTINCREASE is <, then all in"!e)ental e+tents a!e the sa)e si0e# If %CTINCREASE is $!eate! than 0e!o, then ea"h ti)e NEET is "al"ulated, it $!ows by %CTINCREASE# %CTINCREASE "annot be ne$ati&e# The new NEET e/uals 1 F %CTINCREASE91<<, )ulti(lied by the si0e of the last in"!e)ental e+tent 2the old NEET3 and !ounded u( to the ne+t )ulti(le of a blo". si0e# Default ;< 2>3 Dini)u) < 2>3 Da+i)u) o(e!atin$ syste) s(e"ifi"


Seg'e!ts A se$)ent is a set of e+tents that "ontains all the data fo! a s(e"ifi" lo$i"al sto!a$e st!u"tu!e within a tables(a"e# 1o! e+a)(le, fo! ea"h table, O!a"le allo"ates one o! )o!e e+tents to fo!) that table7s data se$)ent= fo! ea"h inde+, O!a"le allo"ates one o! )o!e e+tents to fo!) its inde+ se$)ent# O!a"le databases use fou! ty(es of se$)ents Data Se$)ents Inde+ Se$)ents Te)(o!a!y Se$)ents Rollba". Se$)ents Data Seg'e!ts E&e!y non"luste!ed table and e&e!y "luste! in an O!a"le database has a sin$le data se$)ent to hold all of its data# O!a"le "!eates this data se$)ent when you "!eate the non"luste!ed table o! "luste! with the CREATE "o))and# The sto!a$e (a!a)ete!s fo! a non"luste!ed table o! "luste! dete!)ine how its data se$)ent7s e+tents a!e allo"ated# -ou "an set these sto!a$e (a!a)ete!s di!e"tly with the a((!o(!iate CREATE o! ALTER "o))and# These sto!a$e (a!a)ete!s affe"t the effi"ien"y of data !et!ie&al and sto!a$e fo! the data se$)ent asso"iated with the obCe"t# I!de/ Seg'e!ts E&e!y inde+ in an O!a"le database has a sin$le inde+ se$)ent to hold all of its data# O!a"le "!eates the inde+ se$)ent fo! the inde+ when you issue the CREATE INDEE "o))and# In this "o))and, you "an s(e"ify sto!a$e (a!a)ete!s fo! the e+tents of the inde+ se$)ent and a tables(a"e in whi"h to "!eate the inde+ se$)ent# 2The se$)ents of a table and an inde+ asso"iated with it do not ha&e to o""u(y the sa)e tables(a"e#3 Settin$ the sto!a$e (a!a)ete!s di!e"tly affe"ts the effi"ien"y of data !et!ie&al and sto!a$e# Te'po"a"% Seg'e!ts ,hen (!o"essin$ /ue!ies, O!a"le often !e/ui!es te)(o!a!y wo!.s(a"e fo! inte!)ediate sta$es of SGL state)ent (a!sin$ and e+e"ution# O!a"le auto)ati"ally allo"ates this dis. s(a"e "alled a te)(o!a!y se$)ent# Ty(i"ally, O!a"le !e/ui!es a te)(o!a!y se$)ent as a wo!. a!ea fo! so!tin$# O!a"le does not "!eate a se$)ent if the so!tin$ o(e!ation "an be done in )e)o!y o! if O!a"le finds so)e othe! way to (e!fo!) the o(e!ation usin$ inde+es# Ope"atio!s Re5,i"i!g Te'po"a"% Seg'e!ts The followin$ "o))ands )ay !e/ui!e the use of a te)(o!a!y se$)ent CREATE INDEE SELECT ### ORDER BSELECT DISTINCT ### SELECT ### 6ROU% BSELECT ### UNION SELECT ### INTERSECT SELECT ### DINUS



Ho+ Te'po"a"% Seg'e!ts A"e Allocated O!a"le allo"ates te)(o!a!y se$)ents as needed du!in$ a use! session, in the te)(o!a!y tables(a"e of the use! issuin$ the state)ent# -ou s(e"ify this tables(a"e with a CREATE USER o! an ALTER USER "o))and usin$ the TED%ORAR- TABLES%ACE o(tion# If no te)(o!a!y tables(a"e has been defined fo! the use!, the default te)(o!a!y tables(a"e is the S-STED tables(a"e# The default sto!a$e "ha!a"te!isti"s of the "ontainin$ tables(a"e dete!)ine those of the e+tents of the te)(o!a!y se$)ent# O!a"le d!o(s te)(o!a!y se$)ents when the state)ent "o)(letes# Be"ause allo"ation and deallo"ation of te)(o!a!y se$)ents o""u! f!e/uently, it is !easonable to "!eate a s(e"ial tables(a"e fo! te)(o!a!y se$)ents# By doin$ so, you "an dist!ibute I9O a"!oss dis. de&i"es, and you )ay a&oid f!a$)entation of the S-STED and othe! tables(a"es that othe!wise would hold te)(o!a!y se$)ents# Ent!ies fo! "han$es to te)(o!a!y se$)ents used fo! so!t o(e!ations a!e not sto!ed in the !edo lo$, e+"e(t fo! s(a"e )ana$e)ent o(e!ations on the te)(o!a!y se$)ent# Rollbac& Seg'e!ts Ea"h database "ontains one o! )o!e !ollba". se$)ents# A !ollba". se$)ent !e"o!ds the old &alues of data that was "han$ed by ea"h t!ansa"tion 2whethe! o! not "o))itted3# Rollba". se$)ents a!e used to (!o&ide !ead "onsisten"y, to !oll ba". t!ansa"tions, and to !e"o&e! the database# Co!te!ts of a Rollbac& Seg'e!t Info!)ation in a !ollba". se$)ent "onsists of se&e!al !ollba". ent!ies# A)on$ othe! info!)ation, a !ollba". ent!y in"ludes blo". info!)ation 2the file nu)be! and blo". ID "o!!es(ondin$ to the data that was "han$ed3 and the data as it e+isted befo!e an o(e!ation in a t!ansa"tion# O!a"le lin.s !ollba". ent!ies fo! the sa)e t!ansa"tion, so the ent!ies "an be found easily if ne"essa!y fo! t!ansa"tion !ollba".# Neithe! database use!s no! ad)inist!ato!s "an a""ess o! !ead !ollba". se$)ents= only O!a"le "an w!ite to o! !ead the)# 2They a!e owned by the use! S-S, no )atte! whi"h use! "!eates the)#3 T e Rollbac& Seg'e!t S2STE4 O!a"le "!eates an initial !ollba". se$)ent "alled S-STED whene&e! a database is "!eated# This se$)ent is in the S-STED tables(a"e and uses that tables(a"e7s default sto!a$e (a!a)ete!s# -ou "annot d!o( the S-STED !ollba". se$)ent# An instan"e always a"/ui!es the S-STED !ollba". se$)ent in addition to any othe! !ollba". se$)ents it needs# If the!e a!e )ulti(le !ollba". se$)ents, O!a"le t!ies to use the S-STED !ollba". se$)ent only fo! s(e"ial syste) t!ansa"tions and dist!ibutes use! t!ansa"tions a)on$ othe! !ollba". se$)ents= if the!e a!e too )any t!ansa"tions fo! the non*S-STED !ollba". se$)ents, O!a"le uses the S-STED se$)ent as ne"essa!y# In $ene!al, afte! database "!eation, you should "!eate at least one additional !ollba". se$)ent in the S-STED tables(a"e#



Tablespaces O!a"le sto!es data lo$i"ally in tables(a"es and (hysi"ally in datafiles asso"iated with the "o!!es(ondin$ tables(a"e#

A database is di&ided into one o! )o!e lo$i"al sto!a$e units "alled tables(a"es# The database ad)inist!ato! 2DBA3 uses tables(a"es to "ont!ol dis. s(a"e allo"ation fo! database data assi$n s(e"ifi" s(a"e /uotas fo! database use!s "ont!ol a&ailability of data by$ indi&idual tables(a"es online o! offline (e!fo!) (a!tial database ba".u( o! !e"o&e!y o(e!ations allo"ate data sto!a$e a"!oss de&i"es to i)(!o&e (e!fo!)an"e

,hen you add anothe! datafile to an e+istin$ tables(a"e, you in"!ease the a)ount of dis. s(a"e allo"ated fo! the "o!!es(ondin$ tables(a"e# T e S2STE4 Tablespace E&e!y O!a"le database "ontains a tables(a"e na)ed S-STED, whi"h O!a"le "!eates auto)ati"ally when the database is "!eated# The S-STED tables(a"e always "ontains the data di"tiona!y tables fo! the enti!e database# A s)all database )i$ht need only the S-STED tables(a"e= howe&e!, it is !e"o))ended that you "!eate at least one additional tables(a"e to sto!e use! data se(a!ate f!o) data di"tiona!y info!)ation# This $i&es you


)o!e fle+ibility in &a!ious database ad)inist!ation o(e!ations and !edu"es "ontention a)on$ di"tiona!y obCe"ts and s"he)a obCe"ts fo! the sa)e datafiles# O"acle I!sta!ce An O!a"le instan"e is the "o)bination of the ba".$!ound (!o"esses and )e)o!y st!u"tu!es# The instan"e )ust be sta!ted to a""ess the data in the database# E&e!y ti)e an instan"e is sta!ted, a Syste) 6lobal A!ea 2S6A3 is allo"ated and O!a"le ba".$!ound (!o"esses a!e sta!ted# The S6A is a )e)o!y a!ea used to sto!e database info!)ation that is sha!ed by database (!o"esses# Ba".$!ound (!o"esses (e!fo!) fun"tions on behalf of the in&$ (!o"ess# They "onsolidate fun"tions that would othe!wise be handled by )ulti(le O!a"le (!o$!a)s !unnin$ fo! ea"h use!# The ba".$!ound (!o"esses (e!fo!) I9O and )onito! othe! O!a"le (!o"esses to (!o&ide in"!eased (a!allelis) fo! bette! (e!fo!)an"e and !eliability# 4E4OR2 STRUCTURES # S%ste' 6lobal A"ea O!a"le Se!&e! uses o(e!atin$ syste) )e)o!y fo! its Syste) 6lobal A!ea 2S6A3# The S6A belon$s to only one database and "onsists of )e)o!y st!u"tu!es that O!a"le uses to "ont!ol and )aintain the database #The S6A is a )e)o!y a!ea used to sto!e database info!)ation that is sha!ed by database (!o"esses# It "ontains data and "ont!ol info!)ation fo! the O!a"le se!&e!# The S6A "onsists of se&e!al )e)o!y st!u"tu!es The sha!ed (ool is used to sto!e the )ost !e"ently e+e"uted SGL state)ents and the )ost !e"ently used data f!o) the data di"tiona!y# These SGL state)ents )ay be sub)itted by a use! (!o"ess o!, in the "ase of sto!ed (!o"edu!es, !ead f!o) the data di"tiona!y# The database buffe! "a"he is used to sto!e the )ost !e"ently used data# The data is !ead f!o), and w!itten to, the data files# The !edo lo$ buffe! is used to t!a". "han$es )ade to the database by the se!&e! and ba".$!ound (!o"esses# S a"ed -ool The sha!ed (ool is used to )aintain and !euse SGL and %L9SGL state)ents# The a!ea of the sha!ed (ool .nown as library cache "ontains the te+t, (a!sed fo!), and e+e"ution (lan of the SGL and %L9SGL state)ent# The a((li"ation ) a (a!se "all when a SGL state)ent is issued a$ainst an O!a"le database# The (a!se "all handles two tas.s, &e!ifyin$ that the (!o"ess has the a((!o(!iate se"u!ity to issue the SGL state)ent and dete!)inin$ whethe! the state)ent has the "o!!e"t synta+ and se)anti"s# The (a!se "all "!eates a (!i&ate SGL a!ea fo! the state)ent, but when O!a"le "o)(letes the (a!sin$ o(e!ation, the state)ent is (la"ed in a sha!ed SGL a!ea# On"e the state)ent is (a!sed, O!a"le does not !e(eat the (a!se ste( fo! that state)ent# Be"ause (a!sin$ is o&e!head, you should .ee( it to a )ini)u)# Reusin$ SGL and %L9SGL ha((ens only if the state)ents a!e identi"al #


The di"tiona!y "a"he "ontains info!)ation about database obCe"ts and thei! st!u"tu!e and the (!i&ile$es fo! those obCe"ts# The si0e of the sha!ed (ool is s(e"ified by the initiali0ation (a!a)ete! S8ARED5%OOL5SIHE in the init#o!a file#

Database B,ffe" Cac e The database buffe! "a"he "ontains the data blo".s !e/uested by database use!s# The fi!st ti)e the data blo".s a!e !e/uested, they7!e !et!ie&ed f!o) the datafiles and (la"ed in the "a"he# These data blo".s a!e sha!ed between use!s# ,hen a use! finds the data blo". in "a"he, it is "alled a cache hit; if the data blo". )ust be !et!ie&ed f!o) the datafile, it is "onside!ed a cache miss. ,hen a buffe! is )odified by a (!o"ess, the buffe! is "onside!ed, Idi!ty,I no lon$e! usable# A buffe! be"o)es "lean when it is w!itten to dis. by the DB,R (!o"ess# An LRU 2least !e"ently used3 al$o!ith) .ee(s only the )ost a"ti&e data in the buffe! (ool# The LRU list "ontains di!ty buffe!s 2)odified buffe!s3, f!ee buffe!s 2buffe!s that ha&e not been )odified3, and (inned buffe!s 2buffe!s that a!e "u!!ently bein$ used by a (!o"ess3# The si0e of ea"h buffe! in the buffe! "a"he is e/ual to the si0e of an O!a"le blo"., and it is s(e"ified by the DB5BLOCJ5SIHE (a!a)ete!# The nu)be! of buffe!s is e/ual to the &alue of the DB5BLOCJ5BU11ERS (a!a)ete!# Redo Log B,ffe" The !edo lo$ buffe! "ontains all the "han$es )ade to the database e+"e(t "o))ands that don7t $ene!ate !edo lo$ ent!ies# Su"h "o))ands, notably CREATE TABLE and CREATE INDE3. "ontain the UNRECO)ERABLE o(tion# The !edo lo$ buffe! is also used du!in$ a database !e"o&e!y to !e*"!eate data )odifi"ations )ade to the database and !ollba". se$)ents# The buffe! is a "i!"ula! buffe!, so the oldest )odifi"ations a!e dis"a!ded fi!st when the buffe! fills# The !edo lo$, buffe! has the followin$ "ha!a"te!isti"s Its si0e in bytes is defined by the LO65BU11ER (a!a)ete!# It !e"o!ds the blo". that is "han$ed, the lo"ation of the "han$e, and the new &alue in a !edo ent!y# A !edo ent!y ) no distin"tion between the ty(e of blo". that is "han$ed= it si)(ly !e"o!ds whi"h bytes a!e "han$ed in the blo".# The !edo lo$ buffe! is used se/uentially, and "han$es )ade by one t!ansa"tion )ay be inte!lea&ed with "han$es )ade by othe! t!ansa"tions# It is a "i!"ula! buffe! that is !eused afte! it is filled, but only afte! all the old !edo ent!ies a!e !e"o!ded in the !edo lo$ files# ORACLE BAC$6ROUND -ROCESSES O!a"le has )any ba".$!ound (!o"esses, ea"h with an i)(o!tant tas. to do# (!o"esses a!e )andato!y fo! a fun"tionin$ O!a"le en&i!on)ent# So)e





-"ocess Na'e Database ,!ite! Lo$ ,!ite! Syste) Donito! %!o"ess Donito! Che".(oint Re"o&e!e! Lo". A!"hi&e! Dis(at"he! Se"ve" a!d Use" -"ocesses


-es -es -es -es No No No No No

Use" -"ocesses ,hen a use! !uns an a((li"ation (!o$!a) o! an O!a"le tool O!a"le "!eates a use! (!o"ess to !un the use!7s a((li"ation# Se"ve" -"ocesses Se!&e! (!o"esses "!eated on behalf of ea"h use!7s a((li"ation )ay (e!fo!) one o! )o!e of the followin$


%a!se and e+e"ute SGL state)ents issued &ia the a((li"ation# Read ne"essa!y data blo".s f!o) datafiles on dis. into the sha!ed database buffe!s of the S6A, if the blo".s a!e not al!eady (!esent in the S6A# Retu!n !esults in su"h a way that the a((li"ation "an (!o"ess the info!)ation . ,hen O!a"le se!&e! is sta!ted, ba".$!ound (!o"esses s(!in$ to life to (e!fo!) thei! intended fun"tions# So)e (!o"esses a!e indi"ated by init#o!a file (a!a)ete!s, othe! (!o"esses a!e !e/ui!ed by the database se!&e!# O"acle7s Re5,i"ed -"ocesses The followin$ (!o"esses a!e "!eated auto)ati"ally when the instan"e is fi!st "!eated# The database se!&e! will "!ash if the Database ,!ite!, Lo$ ,!ite!, Syste) Donito!, and %!o"ess Donito! a!enKt a&ailable Database 0"ite" (DB0R*8 The se!&e! (!o"ess !e"o!ds "han$es to !ollba". and data blo".s in the buffe! "a"he# The Database ,!ite! 2DB,R3 w!ites the di!ty buffe!s f!o) the database buffe! "a"he to the data files# It ensu!es that a suffi"ient nu)be! of f!ee buffe!s * buffe!s that "an be o&e!w!itten when se!&e! (!o"esses need to !ead in blo".s f!o) the data files a!e a&ailable in the database buffe! "a"he## Database (e!fo!)an"e is i)(!o&ed be"ause se!&e! (!o"esses )a.e "han$es only in the buffe! "a"he, and the DB,R defe!s w!itin$ to the data files DB,R w!ites the "han$es out to the datafiles when any of the followin$ o""u!s E&e!y th!ee se"onds, DB,R a ti)eout# A "he".(oint o""u!s on the database# 2A "he".(oint is a )eans of syn"h!oni0in$ the database buffe! "a"he with the data file 3# The LRU is sea!"hed by a (!o"ess and it does not find a f!ee buffe!# The di!ty buffe! list has be"o)e full#

Log 0"ite" (L60R*8 This (!o"ess )ana$es the !edo lo$ buffe! "ontents of the S6A# It !eads f!o) this buffe! and w!ites to the se/uential online !edo lo$s# The w!ite o""u!s unde! the followin$ "onditions A L6,R ti)eout ha((ens in the instan"e# A "o))it o""u!s in a t!ansa"tion# The !edo lo$ buffe! (ool be"o)es one*thi!d full The DB,R finishes "leanin$ di!ty buffe!s afte! a "he".(oint o""u!s#

Be"ause the !edo is needed fo! !e"o&e!y, L6,R "onfi!)s the CODDIT only afte! the !edo is w!itten to dis.# S%ste' 4o!ito" (S4ON*8 This (!o"ess se!&es two (u!(oses * auto)ati" instan"e !e"o&e!y and s(a"e )ana$e)ent# If an O!a"le Se!&e! "!ashes, this


(!o"ess (e!fo!)s instan"e !e"o&e!y auto)ati"ally when itKs !esta!ted by !eadin$ the !edo lo$s#If the O!a"le instan"e fails, any info!)ation in the S6A that has not been w!itten to dis. is lost# 1o! e+a)(le, the failu!e of the o(e!atin$ syste) "auses an instan"e failu!e# Afte! the loss of the instan"e, the ba".$!ound (!o"ess SDON auto)ati"ally (e!fo!)s instan"e !e"o&e!y when the database is !eo(ened# SDON also (e!fo!)s so)e s(a"e )aintenan"e fun"tions It "o)bines, o! "oales"es, adCa"ent a!eas of f!ee s(a"e in the data files# It de allo"ates te)(o!a!y se$)ents to !etu!n the) as f!ee s(a"e in data files# Te)(o!a!y se$)ents a!e used to sto!e data du!in$ SGL state)ent (!o"essin$ -"ocess 4o!ito" (-4ON*8 The ba".$!ound (!o"ess %DON "leans u( afte! failed (!o"esses by L L L Rollin$ ba". the use!Ks "u!!ent t!ansa"tion Releasin$ all "u!!ently held table o! !ow lo".s 1!eein$ othe! !esou!"es "u!!ently !ese!&ed by the use!

A"c ive" -"ocess(ARCH* The ARC8 (!o"ess initiates ba".in$ u(, o! a!"hi&in$, of the filled lo$ $!ou( at e&e!y lo$ swit"h# It auto)ati"ally a!"hi&es the online !edo lo$ befo!e the lo$ "an be !eused, so that all of the "han$es )ade to the database a!e (!ese!&ed# This enables the DBA to !e"o&e! the database to the (oint of failu!e, e&en if a dis. d!i&e is da)a$ed# As online !edo lo$ files fill . the O!a"le se!&e! be$ins w!itin$ to the ne+t online !edo lo$, file# The (!o"ess of swit"hin$ f!o) one !edo lo$ to anothe! is "alled a lo$ swit"h# A"c ivi!g Redo Log Files One of the i)(o!tant de"isions that a DBA has to )a.e is whethe! to "onfi$u!e the database to o(e!ate in ARC8IMELO6 o! in NOARC8IMELO6 )ode# NOARC8IMELO6 Dode # In NOARC8IMELO6 )ode, the online !edo lo$ files a!e o&e!w!itten ea"h ti)e a lo$ swit"h o""u!s#
ARC8IMELO6 Dode * In ARC8IMELO6 )ode, ina"ti&e $!ou(s of filled online !edo lo$ files )ust be a!"hi&ed befo!e they "an be used a$ain# Be"ause "han$es )ade to the database a!e !e"o!ded in the online !edo lo$ files, the DBA "an use the (hysi"al ba".u( of the data files and the a!"hi&ed online !edo lo$ files to !e"o&e! the database without losin$ any "o))itted data be"ause of any sin$le (oint of failu!e, in"ludin$ the loss of a dis.#

C ec&poi!t -"ocess (C$-T* A "he".(oint is a )eans of syn"h!oni0in$ the database buffe! "a"he with the data file #,hen a "he".(oint o""u!s, O!a"le )ust u(date the heade!s of all datafiles to !e"o!d the details of the "he".(oint# This is done by the


CJ%T (!o"ess# The CJ%T (!o"ess does not w!ite blo".s to dis.= DB,R always (e!fo!)s that wo!.# Recove"e" -"ocess (RECO* The !e"o&e!e! (!o"ess 2RECO3 is a ba".$!ound (!o"ess used with the dist!ibuted database "onfi$u!ation that auto)ati"ally !esol&es failu!es in&ol&in$ dist!ibuted t!ansa"tions# The RECO (!o"ess of a node auto)ati"ally "onne"ts to othe! databases in&ol&ed in an in*doubt dist!ibuted t!ansa"tion# ,hen the RECO (!o"ess !eestablishes a "onne"tion between in&ol&ed database se!&e!s, it auto)ati"ally !esol&es all in*doubt t!ansa"tions, !e)o&in$ f!o) ea"h database7s (endin$ t!ansa"tion table any !ows that "o!!es(ond to the !esol&ed in*doubt t!ansa"tions# If the RECO (!o"ess fails to "onne"t with a !e)ote se!&e!, RECO auto)ati"ally t!ies to "onne"t a$ain afte! a ti)ed inte!&al# Loc& -"ocesses (LC$n* ,ith the %a!allel Se!&e! o(tion, u( to ten lo". (!o"esses 2LCJ<, # # #, LCJA3 (!o&ide inte! instan"e lo".in$# A sin$le LCJ (!o"ess 2LCJ<3 is suffi"ient fo! )ost O!a"le %a!allel Se!&e! syste)s# Dispatc e" -"ocesses (Dnnn* The dis(at"he! (!o"esses su((o!t )ultith!eaded "onfi$u!ation by allowin$ use! (!o"esses to sha!e a li)ited nu)be! of se!&e! (!o"esses# ,ith the )ultith!eaded se!&e!, fewe! sha!ed se!&e! (!o"esses a!e !e/ui!ed fo! the sa)e nu)be! of use!s= the!efo!e, the )ultith!eaded se!&e! "an su((o!t a $!eate! nu)be! of use!s, (a!ti"ula!ly in "lient9se!&e! en&i!on)ents whe!e the "lient a((li"ation and se!&e! o(e!ate on diffe!ent )a"hines# In a )ultith!eaded se!&e! "onfi$u!ation, a netwo!. listene! (!o"ess waits fo! "onne"tion !e/uests f!o) "lient a((li"ations, and !outes ea"h to a dis(at"he! (!o"ess# 9,e"% -"ocessi!g Steps Gue!ies a!e diffe!ent f!o) othe! ty(es of SGL state)ents be"ause, if su""essful, they !etu!n data as !esults# ,he!eas othe! state)ents si)(ly !etu!n su""ess o! failu!e, a /ue!y "an !etu!n one !ow o! thousands of !ows# The!e a!e th!ee )ain sta$es in the (!o"essin$ of a /ue!y 1 %a!se : E+e"ute ; 1et"h -a"si!g a S9L State'e!t Du!in$ the parse sta$e, the SGL state)ent is (assed f!o) the use! (!o"ess to the se!&e! (!o"ess, and a (a!sed !e(!esentation of the SGL state)ent is loaded into a sha!ed SGL a!ea#


Du!in$ the (a!se, the se!&e! (!o"ess N Sea!"hes fo! an e+istin$ "o(y of the SGL state)ent in the sha!ed (ool N Malidates the SGL state)ent by "he".in$ its synta+ %e!fo!)s data di"tiona!y loo.u(s to &alidate table and "olu)n definitions N A"/ui!es (a!se lo".s on obCe"ts so that thei! definitions do not "han$e du!in$ the (a!sin$ of the state)ent 8 Che".s the use!Ks (!i&ile$es to a""ess the !efe!en"ed s"he)a obCe"ts N Dete!)ines the o(ti)al e+e"ution (lan fo! the state)ent 8 Loads the state)ent and e+e"ution (lan into a sha!ed SGL a!ea The (a!se sta$e in"ludes (!o"essin$ !e/ui!e)ents that usually need to be done only on"e no )atte! how )any ti)es the state)ent is e+e"uted# The O!a"le se!&e! usually t!anslates ea"h SGL state)ent only on"e, !ee+e"utin$ that (a!sed state)ent du!in$ subse/uent !efe!en"es to the state)ent# 8owe&e!, the O!a"le se!&e! always &e!ifies that the use! has the !e/ui!ed (!i&ile$es to e+e"ute the SGL state)ent# Althou$h (a!sin$ a SGL state)ent &alidates that state)ent, (a!sin$, only identifies e!!o!s that "an be found befo!e state)ent e+e"ution# Thus, so)e e!!o!s "annot be "au$ht by (a!sin$# 1o! e+a)(le, e!!o!s in data "on&e!sion o! e!!o!s in data 2su"h as an atte)(t to ente! du(li"ate &alues in a (!i)a!y .ey3 and deadlo".s a!e all e!!o!s o! situations that "an be en"ounte!ed and !e(o!ted only du!in$ the e+e"ution sta$e# E/ec,ti!g t e SELECT State'e!t At this (oint, the O!a"le se!&e! has all the ne"essa!y info!)ation and !esou!"es, so the state)ent is e+e"uted# 1o! SELECT state)ents, the se!&e! (!o"ess (!e(a!es to !et!ie&e the data# Fetc i!g t e Ro+s of a 9,e"% In the fet"h sta$e, !ows a!e sele"ted, o!de!ed 2if ne"essa!y3, and !etu!ned by the se!&e! to the use!# De(endin$ on the nu)be! of !ows !etu!ned in ea"h fet"h, one o! )o!e fet"hes )ay be !e/ui!ed to t!ansfe! the !esults of a /ue!y to the use!#

D4L -"ocessi!g Steps A data )ani(ulation lan$ua$e 2DDL3 state)ent !e/ui!es only two (hases of (!o"essin$
8 8

%a!se is the sa)e as the (a!se (hase used fo! (!o"essin$ a /ue!y E+e"ute !e/ui!es additional (!o"essin$ to )a.e data "han$es

D4L E/ec,te - ase

To e+e"ute a DDL state)ent



1 ' 4

If the data and !ollba". blo".s a!e not al!eady in the buffe! "a"he, the se!&e! (!o"ess !eads the) f!o) the data files into the buffe! "a"he# The se!&e! (!o"ess (la"es lo".s on the !ows that a!e to be )odified# In the !edo lo$ buffe!, the se!&e! (!o"ess !e"o!ds the "han$es to be )ade to the !ollba". and data# * The !ollba". blo". "han$es !e"o!d the &alues of the data befo!e it is )odified# The !ollba". blo". is used to sto!e the befo!e*i)a$e of the data, so that the DDL state)ents "an be !olled ba". if ne"essa!y# * The data blo".s "han$es !e"o!d the new &alues of the data#

: The se!&e! (!o"ess !e"o!ds the befo!e*i)a$e to the !ollba". blo". and u(dates the data blo".# Both of these "han$es a!e done in the database buffe! "a"he# Any "han$ed blo".s in the buffe! "a"he a!e )a!.ed as di!ty buffe!s * that is, buffe!s that a!e not the sa)e as the "o!!es(ondin$ blo".s on the dis.# The (!o"essin$ of a DELETE o! INSERT "o))and uses si)ila! ste(s# The befo!e i)a$e fo! a DELETE "ontains the "olu)n &alues in the deleted !ow, and the befo!e i)a$e of an INSERT "ontains the !ow lo"ation info!)ation#

Database STARTU- a!d SHUTDO0N Sta"ti!g a! I!sta!ce ,hen O!a"le sta!ts an instan"e, fi!st it !eads a (a!a)ete! file to dete!)ine the &alues of initiali0ation (a!a)ete!s and then it allo"ates an S6A O a sha!ed a!ea of )e)o!y used fo! database info!)ation O and "!eates ba".$!ound (!o"esses# At this (oint, no database is asso"iated with these )e)o!y st!u"tu!es and (!o"esses# Fo"ci!g a! I!sta!ce to Sta"t,p i! Ab!o"'al Sit,atio!s In unusual "i!"u)stan"es, a (!e&ious instan"e )i$ht not ha&e been shut down P"leanlyQ, fo! e+a)(le, one of the instan"e7s (!o"esses )i$ht not ha&e te!)inated (!o(e!ly# In su"h situations, the database )i$ht !etu!n an e!!o! du!in$ no!)al instan"e sta!tu(# To !esol&e this (!oble), you )ust te!)inate all !e)nant O!a"le (!o"esses of the (!e&ious instan"e befo!e sta!tin$ the new instan"e# 4o,!ti!g a Database The instan"e )ounts a database to asso"iate the database with that instan"e# Afte! )ountin$ the database, the instan"e finds the database "ont!ol files and o(ens the)# 2Cont!ol files a!e s(e"ified in the CONTROL51ILES initiali0ation (a!a)ete! in the (a!a)ete! file used to sta!t the instan"e#3 O!a"le then !eads the "ont!ol files to $et the na)es of the database7s datafiles and !edo lo$ files# At this (oint, the database is still


"losed and is a""essible only to the database ad)inist!ato!# The database ad)inist!ato! "an .ee( the database "losed while "o)(letin$ s(e"ifi" )aintenan"e o(e!ations# 8owe&e!, the database is not yet a&ailable fo! no!)al o(e!ations# Ope!i!g a Database O(enin$ a )ounted database ) it a&ailable fo! no!)al database o(e!ations# Any &alid use! "an "onne"t to an o(en database and a""ess its info!)ation# Usually a database ad)inist!ato! o(ens the database to )a.e it a&ailable fo! $ene!al use# ,hen you o(en the database, O!a"le o(ens the online datafiles and online !edo lo$ files# Database a!d I!sta!ce S ,tdo+! The th!ee ste(s to shuttin$ down a database and its asso"iated instan"e a!e <8 Close the database# :8 Dis)ount the database# ;8 Shut down the instan"e# A database ad)inist!ato! "an (e!fo!) these ste(s usin$ O!a"le Ente!(!ise Dana$e!# O!a"le auto)ati"ally (e!fo!)s all th!ee ste(s whene&e! an instan"e is shut down#

Closi!g a Database ,hen you "lose a database, O!a"le w!ites all database data and !e"o&e!y data in the S6A to the datafiles and !edo lo$ files, !es(e"ti&ely# Ne+t, O!a"le "loses all online datafiles and online !edo lo$ files# 2Any offline datafiles of any offline tables(a"es will ha&e been


"losed al!eady# If you subse/uently !eo(en the data*base, any tables(a"e that was offline and its datafiles !e)ain offline and "losed, !es(e"ti&ely#3 At this (oint, the database is "losed and ina""essible fo! no!)al o(e!*ations# The "ont!ol files !e)ain o(en afte! a database is "losed but still )ounted# Closi!g t e Database b% Abo"ti!g t e I!sta!ce In !a!e e)e!$en"y situations, you "an abo!t the instan"e of an o(en database to "lose and "o)(letely shut down the database instantaneously# This (!o"ess is fast, be"ause the o(e!ation of w!itin$ all data in the buffe!s of the S6A to the datafiles and !edo lo$ files is s.i((ed# The subse/uent !eo(enin$ of the database !e/ui!es instan"e !e"o&e!y, whi"h O!a"le (e!fo!)s auto)ati"ally# Dis'o,!ti!g a Database On"e the database is "losed, O!a"le dis)ounts the database to disasso"iate it f!o) the instan"e# At this (oint, the instan"e !e)ains in the )e)o!y of you! "o)(ute!# Afte! a database is dis)ounted, O!a"le "loses the "ont!ol files of the database#



SU44AR2 = #
The O!a"le database is )ade u( of database files, Redo Lo$s and Cont!ol files The lo$i"al st!u"tu!e in&ol&es the tables(a"es, se$)ents and e+tents The S6A is a $lobal )e)o!y a!ea, a""essible by the O!a"le se!&e! (!o"ess fo! data )ani(ulations E&e!y a((li"ation (!o$!a) has its own (!i&ate )e)o!y a!ea, "alled %6A O!a"le has se&e!al syste)7s a"ti&ities se!&e! (!o"esses and ba".$!ound (!o"esses to )onito! the

In )ulti*th!eaded se!&e! "onfi$u!ations, )ant use! (!o"esses "onne"t to a dis(at"he! (!o"ess O!a"le database "an be dist!ibuted a"!oss diffe!ent lo"ations and "onne"ted to ea"h othe! &ia a netwo!. The obCe"t na)es in a dist!ibuted database syste) is t!ans(a!ent to the use!s and the a((li"ations A((!o(!iate &iews and synony)s a!e "!eated fo! ea"h dist!ibuted obCe"t fo! easy )aintenan"e A database lin. is the "o)(lete (ath to a !e)ote database