Upload
sana-gauri
View
237
Download
0
Embed Size (px)
Citation preview
7/25/2019 Session 01 Oracle PLSQL Architecture
1/39
Overview
Oracle 10G
LEVEL LEARNER
7/25/2019 Session 01 Oracle PLSQL Architecture
2/39
Questions
Coding
Standards
2
Reference
Test Your
Understanding
Icon Used
Lend A
Hand
Hands on !ercise "oints To"onder
Su##ar
$
O%er%ie& O'(ecti%e C)ec* YourUnderstandi
7/25/2019 Session 01 Oracle PLSQL Architecture
3/39
O%er%ie&
T)e session +ro%ides insig)t to&ards
O%er%ie&, ")$sical and Logical
-ata'ase Structures, A++licationArc)itecture, -ata'ase Securit$ and
Utilities of Oracle.
/
7/25/2019 Session 01 Oracle PLSQL Architecture
4/39
O'(ecti%e
After co#+leting t)is session, +artici+ants
&ill 'e a'le to
Overview about Oracle.
Oracle's Physical and Logical Database
Structures.
Oracle Application Architecture.
How Oracle Works
Oracle !e"ory Architecture
Oracle Process Architecture
Oracle Database Security
Overview o# PL$S%L
7/25/2019 Session 01 Oracle PLSQL Architecture
5/39
Oracle-ata'aseO%er%ie&
Oracle is an Relational Database Management Systemde%elo+ed'$ Oracle Cor+oration.
&T)e Oracle -ata'ase is co##onl$ referred to as OracleRDBMS .
&Oracle &as t)e 3rst data'ase +roduct to run on a %ariet$ of+latfor#s fro# #icro to #ainfra#e.
&An Oracle data'ase are #ade u+ of 3les na#el$ data ands$ste# 3les.
&A single Oracle Ser%er installation can )a%e one or #oredata'ase.
7/25/2019 Session 01 Oracle PLSQL Architecture
6/39
Oracle-ata'aseandOracleInstance
very running database is associated with its own Oracle
instance.
When the database is started Oracle allocates a "e"ory areacalled SGA(Syste" Global Area) and starts "any oracle
process to "anage the database. *he co"bination o#
Oracle Process and S+A is called ,Oracle Instance-
4
-ata'ase
Oracle data'ase is associated&it) an oracle instance
Oracle Instance
d d l
7/25/2019 Session 01 Oracle PLSQL Architecture
7/39
Database Server CHN1234
UnderstandOracleInstancewith an!a#+le
Assu"e a ad"inistrator installs three databases in a database server (CHN1234) #or
three applications.& Banking application - anking
& Retail application - /etail
& Media application - !edia
5
6an*ing
-ata'ase
Oracle 0nstance
Retail
-ata'ase
Oracle 0nstance
7edia
-ata'ase
Oracle 0nstance
8)en eac) data'ase isstarted an oracle instance&ill 'e started andassociated to t)e res+ecti%edata'ases.
So eac) data'ase &ill )a%e its o&n instance
created.
7/25/2019 Session 01 Oracle PLSQL Architecture
8/39
Oracledata'asestructures
9
Oracle -ata'ase structure )as t&o classi3cations,
Logical Database
Structure
Physical Database
Structure
Oracle Database
Structure
Oracle logically divides the database
into s"aller units to "anage1 store1and retrieve data e##iciently.
Oracle database physically "aintains
data in one or "ore physical #ilesgrouped under physical data structure.
7/25/2019 Session 01 Oracle PLSQL Architecture
9/39
Logical-ataStructure
T)e logical data structure includes t)e follo&ing,
:
7/25/2019 Session 01 Oracle PLSQL Architecture
10/39
")$sical-ataStructure
T)e +)$sical data structure includes t)e follo&ing3les,
Oracle uses t)ese 3les for +)$sicall$ storing t)edata'ase data.10
7/25/2019 Session 01 Oracle PLSQL Architecture
11/39
Accessingt)e-ata'ase
11
T)e data fro# t)e Oracle -ata'ase can 'e accessed, #odi3ed and re#o%ed'$ using SQL ;Structured Quer$ Language< &it) t)e )el+ of se%eral tools.
So#e of t)e tools &)ic) are co##onl$ used are
1. Oracle SQL="lus and iSQL="lus
2. T)ird>+art$ tools.
-ata'aseT)e SQL &ill 'e sent o%er TC"?I".
T)e SQL de%elo+edin client #ac)ine
T)e SQL e!ecutedin
T)e data'aseser%er.
T)e data retrie%ed is returned to t)eclient.
7/25/2019 Session 01 Oracle PLSQL Architecture
12/39
OracleSQL="lusandiSQL="lus
12
SQL="lus
& SQL = "lus is a tool for accessing, u+dating and re#o%ing data
fro# Oracle -ata'ase.
& SQL = "lus is a co##and line tool &)ic) are used for e!ecuting SQL
@ueries.
iSQL*Plus:
& iSQL="lus is a 'ro&ser>'ased interface for accessing, u+dating and
re#o%ing data fro# Oracle -ata'ase.
& iSQL="lus ena'les $ou to use a &e' 'ro&ser to connect to Oracle
-ata'ase and +erfor# t)e sa#e actions as t)e co##and line
SQL="lus .
7/25/2019 Session 01 Oracle PLSQL Architecture
13/39
SQL="lusToolscreens)ot
1/
SQL = "lus Login Screen
SQL = "lus ditor screen e!ecuting SQLs
7/25/2019 Session 01 Oracle PLSQL Architecture
14/39
OracleiSQL="lusToolScreenS)ot
1
Accessing Oracle -ata'ase t)roug) iSQL="LUS tool
7/25/2019 Session 01 Oracle PLSQL Architecture
15/39
8)atisinsideaOracleInstanceB
1
Oracle Instance internall$ )as t&o #a(or co#+onents for #anagingt)e data'ase,
&7e#or$ Structure&"rocess Structure
Memory structure refers to )o& t)e #e#or$ of t)e oracle data'aseis organied to ensure t)e #anage#ent of data'ase.
Process structure refers to t)e +rocesses running inside oracle#e#or$ for #anaging t)e functioning of data'ase.
7/25/2019 Session 01 Oracle PLSQL Architecture
16/39
InsideanOracleInstance
14
Oracle Instance
SGA
Da%a"ool
Large"ool
6uEerCac)e
Redo Log6uEer
S)ared"ool
Ser%er"rocess 1
"GA
Ser%er"rocess 2
"GA "7OF "GA
6ac*ground "rocess
"GA
7/25/2019 Session 01 Oracle PLSQL Architecture
17/39
Oracle7e#or$structure
Oracle Memory Structure uses:
& Oracle creates and uses #e#or$ structures toco#+lete se%eral (o's.
& 7e#or$ stores +rogra# code 'eing run and datas)ared a#ong users.
15
7/25/2019 Session 01 Oracle PLSQL Architecture
18/39
S$ste#Glo'alArea
19
&T)e S$ste# Glo'al Area ;SGA< is a s)ared #e#or$ region t)atcontains data and control infor#ation for one Oracle instance.
&Oracle allocates t)e SGA &)en an instance starts anddeallocates it &)en t)e instance s)uts do&n.
&ac) instance )as its o&n SGA.
&All users currentl$ connected to an Oracle ser%er s)are t)edata in t)e SGA. So t)is is also referred as Shared Global Area.
&T)e SGAs +ur+ose is to s+eed u+ @uer$ +erfor#ance and toena'le a )ig) a#ount of concurrent data'ase acti%it$.
7/25/2019 Session 01 Oracle PLSQL Architecture
19/39
S$ste#Glo'alArea
1:
S)ared Glo'al Area )as se%eral #e#or$ structures ,
SGA6uEerCac)e
Redo Log6uEer
S)ared"ool
T)e -ata'ase 'uEercac)e cac)es t)edata'ase data.
T)e redo log 'uEerstores redo entries,
a log of c)anges #adeto t)e data'ase.
Used to store #ostrecentl$ e!ecuted
SQL?"LSQLState#ents and data-e3nitions, li*e ta'le,
%ie&s etc.
7/25/2019 Session 01 Oracle PLSQL Architecture
20/39
"rogra#Glo'alArea
20
&T)e "GA is t)e area in t)e #e#or$ t)at contains t)e data and controlinfor#ation for one ser%er +rocess.
&ac) ser%er +rocess &ill )a%e its o&n "GA.
&A ser%er +rocess is started &)en a user logs into t)e data'ase toaccess it.&A ser%er +rocess is tagged to one or #ore user +rocess 'ased on
con3guration.
&"GA is allocated &)en a ser%er +rocess is created and deallocated
&)en t)e ser%er +rocess is ter#inated.
&"GA is not s)ara'le and used '$ onl$ one ser%er +rocess.
&T)e "GA is used to +rocess SQL state#ents 3red '$ users and to )oldlogon and ot)er session infor#ation.
&"GA can 'e d$na#icall$ resied.
7/25/2019 Session 01 Oracle PLSQL Architecture
21/39
Oracle"rocessarc)itecture
21
Aprocessis a t)read of control or a #ec)anis# in an o+erating s$ste#t)at can run a series of tas*s. A +rocess nor#all$ )as its o&n +ri%ate#e#or$ area in &)ic) it runs.
!a#+le Ti# a user connect to data'ase to e!ecuted a @uer$ and retrie%e
data. A +rocess &ill 'e created to )andle t)e user re@uest of connecting todata'ase and e!ecuting t)e @uer$. Here, connection establishment andquery eecutionare referred to as tas*s of t)e +rocess.
Ti#
-ata'ase
Connects to data'ase
!ecute SQL
*he process per#or"s the
tasks o# *i" na"ely1&2onnect to database.
&3ecute S%L.
"rocess Created and runsin data'ase ser%er
7/25/2019 Session 01 Oracle PLSQL Architecture
22/39
"rocessT$+es
22
Oracle processesare invoked by user
processes to per#or" #unctions on
behal# o# the invoking process.
Oracle creates a user process to run
the user's application
3a"ple4 5ser process created #or a
6ava progra" which tries to connectto database (or) a user tries to
connect to the database using S%L7
plus.
7/25/2019 Session 01 Oracle PLSQL Architecture
23/39
"rocessIllustration
2/
Oracle Instance
SGA
Ser%er
"rocess
Reco%er
er
Ti# User"rocess
Ron User"rocess
Dac* User"rocess
"rocess
7onitor
S$ste#
7onitor
-ata'a
se8riter
Log
8riter
Arc)i%
er
Assu#e Ron, !im and "ac# )a%e connected to data'ase and @ueries t)edata'ase.
Oracle "rocesses
User "rocess created foreac) user login.
7/25/2019 Session 01 Oracle PLSQL Architecture
24/39
8)atis-ata'aseSecurit$?
Oracle data'ase securit$ refers to t)e features t)at control )o&a data'ase is accessed and used.
&"re%ent unaut)oried data'ase access
&"re%ent unaut)oried access to sc)e#a o'(ects
&Audit user actions
7/25/2019 Session 01 Oracle PLSQL Architecture
25/39
T$+esOf-ata'aseSecurit$.
*his is a "echanis"s that controls the
access and use o# the database at the
syste" level.
3a"ple4&5sing userna"e$password #or D login.
&Si8e o# disk space allocated to a user's
sche"a ob9ects.
*his is a "echanis"s that controls the
access and use o# the database at the
sche"a ob9ect level.
3a"ple4
&y giving access #or users to tables and
other sche"a ob9ects.
&Auditing users access to sche"a
ob9ects.
&ncrypting data to prevent unauthori8ed
access.
7/25/2019 Session 01 Oracle PLSQL Architecture
26/39
Securit$7ec)anis#s
& Oracle database provides discretionary access control1 which
is a "eans o# restricting access to in#or"ation based on
privileges.
& Appropriate privilege should be assigned to users to access
sche"a ob9ects.
Example: Tomcan be given privilege to access Employeetable
but Roncan:t access it.
& Privileged users can grant other users privileges at their
discretion. ;or this reason it is re#erred as discretionary.
Example: Tomcan give privilege access #or Ronto access
Employee table.
24
7/25/2019 Session 01 Oracle PLSQL Architecture
27/39
Securit$7ec)anis#s
Oracle "anages security using the #ollowing "echanis"s
& Database 5sers < Sche"as.
& Privileges
& /oles& Storage settings < %uotas
& Pro#iles< /esource Li"its.
& 5ser authentication
& 5ser Authori8ation
& Auditing
25
7/25/2019 Session 01 Oracle PLSQL Architecture
28/39
8)atareOracle-ata'aseUtilities?
Oracle database utilities are tools supplied as part o# the
Oracle So#tware and need not have to be purchased or
downloaded separately.
*hey are used #or1
& Data access and "aintenance.
& Data Loading.
& Database ad"inistration
29
7/25/2019 Session 01 Oracle PLSQL Architecture
29/39
Oracle-ata'aseUtilities
2:
5sed #or high=speed
"ove"ent o# data and
dictionary data #ro" one
database to another.
5sed #or >uerying redo
log #iles through a S%L
inter#ace.
5sed #or loading
database with data #ro"
#lat #iles. *he description
o# the data #ile will bestored in a control #ile.
7/25/2019 Session 01 Oracle PLSQL Architecture
30/39
Introductionto"L?SQL
What is PL/SQL
"L stands for "rocedural LanguageJ and "L?SQL is t)e+rocedural e!tension to SQL &it) design features of an$+rogra##ing language.
!ew "etails a#out PL/SQL:
&"L?SQL allo&s to #i! SQL state#ents &it) "roceduralState#ents li*e IK state#ent, Loo+ing structures etc.
&"L?SQL allo&s --L,-7L,-QL,TCL and -CL State#ents of
SQL to 'e +art of t)e 'loc* structured unit of codes #a*ing"L?SQL a +o&erful transaction +rocessing language.
/0
--L-7L-QLLoo+s, IK etc.
"L?SQLCan Contain
7/25/2019 Session 01 Oracle PLSQL Architecture
31/39
Introductionto"L?SQL(Cont)
& "L?SQL e!tends SQL '$ adding constructs found in ot)er+rocedural languages li*e
1. -e3ning %aria'les and t$+es
2. Using control structures ;IK>THF>LS