Post on 14-Jun-2015
DBA Team 1
Oracle Architecture
DBA Team 2
Cost: Enterprise Edition
US$47,500.00 / Processor
DBA Team 3
Agenda
• What is Oracle1. instance2. Database3. Listener
• Cost Base Optimizer
DBA Team 4
Memorize
more
less
Shallow In-depthUnderstanding
The more you understandThe less you need to memorize
DBA Team 5
Startup nomount
• Instance Started
Mount
• Control file opened for this instance
Open
• Database opened for this instance
DBA Team 6
Connected to an idle instance.
sys@CS11GR2> !ps -ef | grep cs11gR2 | grep -v grep
sys@CS11GR2> !ipcs -m
------ Shared Memory Segments --------key shmid owner perms bytes nattch
status
Before startup
DBA Team 7
sys@CS11GR2> startup nomountORACLE instance started.
Total System Global Area 535662592 bytesFixed Size 1337720 bytesVariable Size 322963080 bytesDatabase Buffers 205520896 bytesRedo Buffers 5840896 bytes
instance startup
DBA Team 8
After instance is started
sys@CS11GR2> !ipcs -m
------ Shared Memory Segments --------key shmid owner perms bytes nattch
status0x44c4474c 360449 oracle 660 538968064 16
DBA Team 9
Listener
System Monitor(SMON)
DatabaseWriter(DBW0)
ProcessMonitor(PMON)
Check Point(CKPT)
LogWriter(LGWR)
Archiver(ARC0)
Oracle Background Processes
DataFiles
ControlFiles
Redo Log Files
Data Base
Instance
Server Processes
Client Processes
DatabaseBuffer Cache
Library Cache Redo Log BufferData Dictionary Cache
Shared PoolSystem Global Area
DBA Team 10
After instance is started
sys@CS11GR2> !ps -ef | grep cs11gR2 | grep -v grep
oracle 13134 1 0 13:54 ? 00:00:00 ora_dbw0_cs11gR2oracle 13136 1 0 13:54 ? 00:00:00 ora_lgwr_cs11gR2
...
oracle 13116 1 0 13:54 ? 00:00:00 ora_pmon_cs11gR2 oracle 13140 1 0 13:54 ? 00:00:00 ora_smon_cs11gR2
SQL> !ps -ef | grep cs11gR2 | grep -v grep | wc -l16
DBA Team 11
DataFiles
ControlFiles
Redo Log Files
Data Base
Listener
Server Processes
Client Processes
Instance
DatabaseBuffer Cache
Library Cache Redo Log BufferData Dictionary Cache
Shared PoolSystem Global Area
System Monitor(SMON)
DatabaseWriter(DBW0)
ProcessMonitor(PMON)
Check Point(CKPT)
LogWriter(LGWR)
Archiver(ARC0)
Oracle Background Processes
DBA Team 12
Open the Databasesys@CS11GR2> alter database mount;Database altered.
sys@CS11GR2> alter database open;Database altered.
sys@CS11GR2> select * from sid.emp where ename='SMITH'; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO------ ---------- --------- ------ --------- ----- ------ -------- 7369 SMITH CLERK 7902 17-DEC-80 800 20
1 row selected.
DBA Team 13
Listener
Server Processes
Client Processes
DataFiles
ControlFiles
Redo Log Files
Data Base
Instance
DatabaseBuffer Cache
Library Cache Redo Log BufferData Dictionary Cache
Shared PoolSystem Global Area
System Monitor(SMON)
DatabaseWriter(DBW0)
ProcessMonitor(PMON)
Check Point(CKPT)
LogWriter(LGWR)
Archiver(ARC0)
Oracle Background Processes
DBA Team 14
Connect from RemoteFailed!
C:\Documents and Settings\chensi4>sqlplus sid/sid@cs11g
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jul 24 20:29:17 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-12541: TNS:no listener
DBA Team 15
Startup the Listeneroracle@cargosmart:~/scripts$ lsnrctl start
Service "cs11gR2" has 1 instance(s).
Instance "cs11gR2", status READY, has 1 handler(s) for this service...
The command completed successfully
DBA Team 16
Now query from RemoteC:\Documents and Settings\chensi4>sqlplus sid/sid@cs11gR2Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing
options
SQL> select * from emp where ename='SMITH';
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO------- ------- ------- ----- --------- ----- ------ -------- 7369 SMITH CLERK 7902 17-DEC-80 800 20
1 row selected.
DBA Team 17
Listener
Server Processes
Client Processes
DataFiles
ControlFiles
Redo Log Files
Data Base
Instance
DatabaseBuffer Cache
Library Cache Redo Log BufferData Dictionary Cache
Shared PoolSystem Global Area
System Monitor(SMON)
DatabaseWriter(DBW0)
ProcessMonitor(PMON)
Check Point(CKPT)
LogWriter(LGWR)
Archiver(ARC0)
Oracle Background Processes
DBA Team 18
What Oracle Do
When you submit a SQL
1.From pl/sql develop2.From the JDBC API in your java application
3.From sqlplus
DBA Team 19
Parser
SELECT AVG(SAL) FROM EMP WHERE DEPTNO IN (SELECT DEPTNO FROM DEPT WHERE DNAME='SALES')
DBA Team 20
Parser
SELECT AVG(SAL) FROM EMP WHERE DEPTNO IN (SELECT DEPTNO FROM DEPT WHERE DNAME='SALES')
DBA Team 21
Query Transformer
Plan Generator
Data Dictionary
Estimator
SELECT AVG(SAL) FROM DEPT, EMP WHERE EMP.DEPTNO=DEPT.DEPTNO AND DEPT.DNAME='SALES';
Statistics
Transformed Query
Query + Cost
DBA Team 22
Query Transformer
Plan Generator
Data Dictionary
EstimatorStatistics
Transformed Query
Query + Cost
DBA Team 23
Row SourceGenerator
SQL Execution
Query Plan
Result
DBA Team 24
A Real Plan----------------------------------------------------------------------| Id | Operation | Name | Rows | Cost (%CPU)|----------------------------------------------------------------------| 0 | SELECT STATEMENT | | 1 | 6 (17)|| 1 | SORT AGGREGATE | | 1 | || 2 | MERGE JOIN | | 5 | 6 (17)||* 3 | TABLE ACCESS BY INDEX ROWID| DEPT | 1 | 2 (0)|| 4 | INDEX FULL SCAN | DEPT_PK | 4 | 1 (0)||* 5 | SORT JOIN | | 14 | 4 (25)|| 6 | TABLE ACCESS FULL | EMP | 14 | 3 (0)|----------------------------------------------------------------------
Predicate Information (identified by operation id):---------------------------------------------------
3 - filter("DNAME"='SALES') 5 - access("DEPTNO"="DEPTNO") filter("DEPTNO"="DEPTNO")
DBA Team 25
Q & A