The document discusses Oracle database architecture including the relationship between Oracle software, operating system resources like CPUs, memory and disks, Oracle processes like background processes and server processes, and database structures like the system global area (SGA), program global area (PGA), control files, redo logs and data files. It also covers Oracle memory management, instance startup/shutdown, and basic database administration tasks.
Understanding SQL Trace, TKPROF and Execution Plan for beginnersCarlos Sierra
The three fundamental steps of SQL Tuning are: 1) Diagnostics Collection; 2) Root Cause Analysis (RCA); and 3) Remediation. This introductory session on SQL Tuning is for novice DBAs and Developers that are required to investigate a piece of an application performing poorly.
On this session participants will learn about producing a SQL Trace then a summary TKPROF report. A sample TKPROF is navigated with the audience, where the trivial and the no so trivial is exposed and explain. Execution Plans are also navigated and explained, so participants can later untangle complex Execution Plans and start diagnosing SQL performing badly.
This session encourages participants to ask all kind of questions that could be potential road-blocks for deeper understanding of how to address a SQL performing poorly.
Oracle Latch and Mutex Contention TroubleshootingTanel Poder
This is an intro to latch & mutex contention troubleshooting which I've delivered at Hotsos Symposium, UKOUG Conference etc... It's also the starting point of my Latch & Mutex contention sections in my Advanced Oracle Troubleshooting online seminar - but we go much deeper there :-)
Oracle RAC 12c Practical Performance Management and Tuning as presented during Oracle Open World 2013 with Michael Zoll.
This is part three of the Oracle RAC 12c "reindeer series" used for OOW13 Oracle RAC-related presentations.
This part concludes the main part of the "reindeer series" except for one bonus track "Oracle Multitenant meets Oracle RAC 12c" (available via SlidesShare, too).
Understanding SQL Trace, TKPROF and Execution Plan for beginnersCarlos Sierra
The three fundamental steps of SQL Tuning are: 1) Diagnostics Collection; 2) Root Cause Analysis (RCA); and 3) Remediation. This introductory session on SQL Tuning is for novice DBAs and Developers that are required to investigate a piece of an application performing poorly.
On this session participants will learn about producing a SQL Trace then a summary TKPROF report. A sample TKPROF is navigated with the audience, where the trivial and the no so trivial is exposed and explain. Execution Plans are also navigated and explained, so participants can later untangle complex Execution Plans and start diagnosing SQL performing badly.
This session encourages participants to ask all kind of questions that could be potential road-blocks for deeper understanding of how to address a SQL performing poorly.
Oracle Latch and Mutex Contention TroubleshootingTanel Poder
This is an intro to latch & mutex contention troubleshooting which I've delivered at Hotsos Symposium, UKOUG Conference etc... It's also the starting point of my Latch & Mutex contention sections in my Advanced Oracle Troubleshooting online seminar - but we go much deeper there :-)
Oracle RAC 12c Practical Performance Management and Tuning as presented during Oracle Open World 2013 with Michael Zoll.
This is part three of the Oracle RAC 12c "reindeer series" used for OOW13 Oracle RAC-related presentations.
This part concludes the main part of the "reindeer series" except for one bonus track "Oracle Multitenant meets Oracle RAC 12c" (available via SlidesShare, too).
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsJohn Kanagaraj
Oracle Database 10g brought in a slew of tuning and performance related tools and indeed a new way of dealing with performance issues. Even though 10g has been around for a while, many DBAs haven’t really used many of the new features, mostly because they are not well known or understood. In this Expert session, we will look past the slick demos of the new tuning and performance related tools and go “under the hood”. Using this knowledge, we will bypass the GUI and look at the views and counters that matter and quickly understand what they are saying. Tools covered include AWR, ADDM, ASH, Metrics, Tuning Advisors and their related views. Much of information about Oracle Database 10g presented in this paper has been adapted from my book and I acknowledge that with gratitude to my publisher - SAMS (Pearson).
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz
Oracle Data Guard Deep Dive
Ensuring your business continuity for critical production databases is of paramount importance. Oracle Data Guard offers high available synchronization and reporting of your primary database. Oracle Data Guard is the most comprehensive solution available to eliminate single points of failure for mission critical Oracle Databases. It prevents data loss and downtime in the simplest and most economical manner by maintaining a synchronized physical replica of a production database at a remote location. If the production database is unavailable for any reason, client connections can quickly, and in some configurations transparently, fail-over to the synchronized replica to restore service. We will go through explaining Data Guard concepts, several new features in 12c such as Far/Fast sync, learn about Data Guard single instance and RAC setup step-by-step, configuration, broker setup and monitoring. This presentation will be very useful for someone who wants to take a deep dive into Data Guard or even refresh their skills.
Design and develop with performance in mind
Establish a tuning environment
Index wisely
Reduce parsing
Take advantage of Cost Based Optimizer
Avoid accidental table scans
Optimize necessary table scans
Optimize joins
Use array processing
Consider PL/SQL for “tricky” SQL
Deep Dive into the New Features of Apache Spark 3.1Databricks
Continuing with the objectives to make Spark faster, easier, and smarter, Apache Spark 3.1 extends its scope with more than 1500 resolved JIRAs. We will talk about the exciting new developments in the Apache Spark 3.1 as well as some other major initiatives that are coming in the future. In this talk, we want to share with the community many of the more important changes with the examples and demos.
The following features are covered: the SQL features for ANSI SQL compliance, new streaming features, and Python usability improvements, the performance enhancements and new tuning tricks in query compiler.
Any DBA from beginner to advanced level, who wants to fill in some gaps in his/her knowledge about Performance Tuning on an Oracle Database, will benefit from this workshop.
Session aims at introducing less familiar audience to the Oracle database statistics concept, why statistics are necessary and how the Oracle Cost-Based Optimizer uses them
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsJohn Kanagaraj
Oracle Database 10g brought in a slew of tuning and performance related tools and indeed a new way of dealing with performance issues. Even though 10g has been around for a while, many DBAs haven’t really used many of the new features, mostly because they are not well known or understood. In this Expert session, we will look past the slick demos of the new tuning and performance related tools and go “under the hood”. Using this knowledge, we will bypass the GUI and look at the views and counters that matter and quickly understand what they are saying. Tools covered include AWR, ADDM, ASH, Metrics, Tuning Advisors and their related views. Much of information about Oracle Database 10g presented in this paper has been adapted from my book and I acknowledge that with gratitude to my publisher - SAMS (Pearson).
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz
Oracle Data Guard Deep Dive
Ensuring your business continuity for critical production databases is of paramount importance. Oracle Data Guard offers high available synchronization and reporting of your primary database. Oracle Data Guard is the most comprehensive solution available to eliminate single points of failure for mission critical Oracle Databases. It prevents data loss and downtime in the simplest and most economical manner by maintaining a synchronized physical replica of a production database at a remote location. If the production database is unavailable for any reason, client connections can quickly, and in some configurations transparently, fail-over to the synchronized replica to restore service. We will go through explaining Data Guard concepts, several new features in 12c such as Far/Fast sync, learn about Data Guard single instance and RAC setup step-by-step, configuration, broker setup and monitoring. This presentation will be very useful for someone who wants to take a deep dive into Data Guard or even refresh their skills.
Design and develop with performance in mind
Establish a tuning environment
Index wisely
Reduce parsing
Take advantage of Cost Based Optimizer
Avoid accidental table scans
Optimize necessary table scans
Optimize joins
Use array processing
Consider PL/SQL for “tricky” SQL
Deep Dive into the New Features of Apache Spark 3.1Databricks
Continuing with the objectives to make Spark faster, easier, and smarter, Apache Spark 3.1 extends its scope with more than 1500 resolved JIRAs. We will talk about the exciting new developments in the Apache Spark 3.1 as well as some other major initiatives that are coming in the future. In this talk, we want to share with the community many of the more important changes with the examples and demos.
The following features are covered: the SQL features for ANSI SQL compliance, new streaming features, and Python usability improvements, the performance enhancements and new tuning tricks in query compiler.
Any DBA from beginner to advanced level, who wants to fill in some gaps in his/her knowledge about Performance Tuning on an Oracle Database, will benefit from this workshop.
Session aims at introducing less familiar audience to the Oracle database statistics concept, why statistics are necessary and how the Oracle Cost-Based Optimizer uses them
Oracle Database Lifecycle Management using Enterprise Manager 12c (Release 4)
Learn about the features from Provisioning to Compliance and Everything in between you need to maintain Database environments in the regular or private database cloud.
An overview of the Database Management System, various uses and applications of database, internal architecture of popular RDBMS servers and thier features
LDAP stands for Lightweight Directory Access Protocol. It is an application protocol used over an IP network to manage and access the distributed directory information service. This video gives you a high level overview of LDAP and some examples of software that utilize LDAP, such as Active Directory.
a striped down Version of a presentation about oracle architecture. Goal was a basic understanding and foundation about some components of Oracle, so subsequent discussions should be easier
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Subhajit Sahu
Abstract — Levelwise PageRank is an alternative method of PageRank computation which decomposes the input graph into a directed acyclic block-graph of strongly connected components, and processes them in topological order, one level at a time. This enables calculation for ranks in a distributed fashion without per-iteration communication, unlike the standard method where all vertices are processed in each iteration. It however comes with a precondition of the absence of dead ends in the input graph. Here, the native non-distributed performance of Levelwise PageRank was compared against Monolithic PageRank on a CPU as well as a GPU. To ensure a fair comparison, Monolithic PageRank was also performed on a graph where vertices were split by components. Results indicate that Levelwise PageRank is about as fast as Monolithic PageRank on the CPU, but quite a bit slower on the GPU. Slowdown on the GPU is likely caused by a large submission of small workloads, and expected to be non-issue when the computation is performed on massive graphs.
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...pchutichetpong
M Capital Group (“MCG”) expects to see demand and the changing evolution of supply, facilitated through institutional investment rotation out of offices and into work from home (“WFH”), while the ever-expanding need for data storage as global internet usage expands, with experts predicting 5.3 billion users by 2023. These market factors will be underpinned by technological changes, such as progressing cloud services and edge sites, allowing the industry to see strong expected annual growth of 13% over the next 4 years.
Whilst competitive headwinds remain, represented through the recent second bankruptcy filing of Sungard, which blames “COVID-19 and other macroeconomic trends including delayed customer spending decisions, insourcing and reductions in IT spending, energy inflation and reduction in demand for certain services”, the industry has seen key adjustments, where MCG believes that engineering cost management and technological innovation will be paramount to success.
MCG reports that the more favorable market conditions expected over the next few years, helped by the winding down of pandemic restrictions and a hybrid working environment will be driving market momentum forward. The continuous injection of capital by alternative investment firms, as well as the growing infrastructural investment from cloud service providers and social media companies, whose revenues are expected to grow over 3.6x larger by value in 2026, will likely help propel center provision and innovation. These factors paint a promising picture for the industry players that offset rising input costs and adapt to new technologies.
According to M Capital Group: “Specifically, the long-term cost-saving opportunities available from the rise of remote managing will likely aid value growth for the industry. Through margin optimization and further availability of capital for reinvestment, strong players will maintain their competitive foothold, while weaker players exit the market to balance supply and demand.”
3. Oracle&OS
Background Processes
Oracle
Database
Server Processes
OracleSoftware
OS
CPUs
MEMORY
DISKs
Listener
SYSTEM Global Area
(SGA)
(PGA)
PROGRAM
Global Area
(PGA)
Oracle Server
4. Oracle&OS
Background Processes
Server Processes
PROGRAM
Global Area
(PGA)
/u02/oradata/orcl/control01.ctl
/u02/oradata/orcl/system01.dbf
/u02/oradata/orcl/sysaux01.dbf
/u02/oradata/orcl/undotbs1.dbf
/u02/oradata/orcl/temp01.dbf
/u02/oradata/orcl/users01.dbf
/u02/oradata/orcl/log01a.log
/u02/oradata/orcl/log02a.log
OracleDatabase
OracleSoftware
OS
CPUs
MEMORY
DISKs
Listener
SYSTEM Global Area
(SGA)
(PGA)
/u01/app/oracle/product/11.2.0/dbhome_1
5. INSTANCE
Shared Pool Buffer Cache Large Pool Java Pool Streams
Pool
SMON PMON DBWR LGWR CKPT RECO ARCH
Log Buffer
Group1
Header Header Header Header
Datafiles
Group2
Controlfile
LogFiles
Archived
logfile
ParameterFile
Password File
Alert Logfile
Trace File
DATABASE
User
Process
Server
Process
System Global Area
Background Processes
Program
Global
Area
6. Memory Type
Share for Server and Background processes
System Global Area (SGA)
Private by Server and Background processes
Program Global Area (PGA)
9. PGA
Large Buffer Cache
Pool
SMO
N
Shared Pool
Statistics
Java Pool
Streams
Pool
Fixed SGA Log
Buffer
Server
process
PGA
PGA
PMO
N
PGA
DBW
R
PGA
LGW
R
PGA
CKPT
PGA
ARCH
PGA
MMO
N
PGA
MMA
N
Server
process
PGA
Server
process
PGA
Server
process
PGA
Server
process
PGA
MEMORY_TARGET
PGA_AGGREGATE_TARGET SGA_TARGET
Memory
Advisors
取得
呼叫
建議
調整
Server
記錄
Parameter file
User
process
User
process
User
process
User
process
User
process
10. QUIZ
MEMORY_TARGET=500M and SGA_TARGET=0
MEMORY_TARGET=500M and SGA_TARGET=200M
MEMORY_TARGET=0 and SGA_TARGET=200M
MEMORY_TARGET=500M and SGA_TARGET=200M
and SHARED_POOL_SIZE=100M
MEMORY_TARGET=0 and SGA_TARGET=200M and
SHARED_POOL_SIZE=100M
MEMORY_TARGET=0 and SGA_TARGET=0 and
SHARED_POOL_SIZE=100M
11. STARUP Stage
SQL> ALTER DATABASE OPEN ;
SQL> ALTER DATABASE MOUNT ;
SQL> STARTUP NOMOUNT ;
SHUTDOWN
NOMOUNT
MOUNT
OPEN
SQL> STARTUP OPEN ;
13. NOMOUNT
Shared Pool Buffer Cache Large Pool Java Pool Streams
Pool
Log Buffer
SMON PMON DBWR LGWR CKPT RECO ARCH VKTM
Header Header Header Header
Datafiles
Group1
Group2
Controlfile
LogFiles
3.使⽤用Parameter
File開啟INSTANCE
ParameterFile
2.找到
ParameterFile
Password File
1.取得SYSDBA
14. Ways to get SYSDBA
OS Group Authentication
安裝Oracle軟體時指定
$ORACLE_HOME/rdbms/lib/config.c
Password File Authentication
$ORACLE_HOME/dbs/orapw$ORACLE_SID
AS SYSDBA
屬於DBA
Group
Passwo
rd File驗證密碼成
功
Insufficient
Privilege
%ORACLE_HOME%/database/pwd%ORACLE_SID%.ora
Get
Yes
SYSDBA
Yes
No
No
15. [oracle@oracleDB ~]$ id
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),
54323(oper),54324(asmdba),54325(asmoper),54326(asmadmin)
!
[oracle@oracleDB ~]$ cat $ORACLE_HOME/rdbms/lib/config.c
!
/* SS_DBA_GRP defines the UNIX group ID for sqldba adminstrative
access. */
/* Refer to the Installation and User's Guide for further information. */
!
/* IMPORTANT: this file needs to be in sync with
rdbms/src/server/osds/config.c, specifically regarding the
number of elements in the ss_dba_grp array.
*/
!
#define SS_DBA_GRP "dba"
#define SS_OPER_GRP "oper"
#define SS_ASM_GRP ""
!
char *ss_dba_grp[] = {SS_DBA_GRP, SS_OPER_GRP, SS_ASM_GRP};
31. Process Type
User Process
產⽣生SQL statement
Server Process
代表User Process執⾏行SQL statement,並回傳SELECT結果給
User Process
Background Process
必要Processes
SMON,PMON,DBWR,LGWR,CKPT,RECO
Listener Process
32. PMO
N
INSTANCE
orcl
orcl
DATABASE
Inter Processes Communication
User
Process
Server
Process
oracleDB
orcl.uuu.com.tw Service Name
Instance Name
Database Name
3.Session
1
2. Connection
$ export ORACLE_SID=orcl
$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
$ sqlplus hr/hr
SQL>
33. 6. Connection 7.Session
orcl.uuu.com.tw
orcl
3 4
LISTENER
PMO
N
INSTANCE
orcl
orcl
DATABASE
$ lsnrctl start LISTENER
$ORACLE_HOME/network/admin/listener.ora
User
Process
$sqlplus hr/hr@orcl
5
$ORACLE_HOME/network/admin/sqlnet.ora
NAMES.DIRECTORY_PATH=(TNSNAMES, EZCONNECT)
$ORACLE_HOME/network/admin/tnsnames.ora
Server
Process
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = oracleDB)(PORT = 1521))
)
)
oracleDB
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracleDB)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.uuu.com.tw)
)
)
1521
Naming Method
Local Naming
orcl.uuu.com.tw Service Name
Instance Name
Database Name
1 2
Client/Server
frankMBP
Dynamic
Registration
34. Shared Servers
dispatchers=’(protocol=tcp)(dispatchers=2)’ shared_servers=3
PMO
N
Server
Process
Server
Process
Server
Process
Dispatcher2
Dispatcher1
user
process
user
process
user
process
user
process
server
process
Large Pool
SQL3 SQL2 SQL1
SQL1
SQL2
SQL1
SQL2
user
process
user
process
SQL3
SQL3
Result1
Result3
Result1
Result3
Result1
Result3
SQL4
Result4
Request Queue
Response Queue 1
Response Queue 2
Shared Processes
Dedicated Processes
LISTENER
38. [oracle@oracleDB ~]$ ipcs -m
!
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 65536 oracle 600 393216 2 dest
0x00000000 98305 oracle 600 393216 2 dest
0x00000000 131074 oracle 600 393216 2 dest
0x00000000 163843 oracle 600 393216 2 dest
0x00000000 196612 oracle 600 393216 2 dest
0x00000000 229381 oracle 600 393216 2 dest
0x00000000 262150 oracle 600 393216 2 dest
0x00000000 294919 oracle 600 393216 2 dest
0x00000000 327688 oracle 600 393216 2 dest
0x00000000 360457 oracle 600 393216 2 dest
0x00000000 58851338 oracle 660 4096 0
0x00000000 58884107 oracle 660 4096 0
0xfa55c7d8 720908 oracle 660 4096 0
0x00000000 1179661 oracle 600 393216 2 dest
0x00000000 109543438 oracle 777 138880 2 dest
0x42e38fd0 58916879 oracle 660 4096 0
0x00000000 109576208 oracle 777 138880 2 dest
0x00000000 57049105 oracle 777 138880 2 dest
39. SQL Execution Steps
Server Process
User Process Oracle Server
Parse
Execute
Fetch
(Select only)
$ sqlplus hr/hr@orcl
SQL> select last_name,salary
SQL
from employees
where employee_id=100;
Shared
Pool
Buffer
Cache
Log
Buffer
DML only
Datafile
LAST_NAME
SALARY
------------------------- ----------
King 24000
Result
Control
file
Log
File
40. Shared Pool
Library Cache
SQL Text/Parsed Code/Execution Plan
Data Dictionary Cache
Result Cache
SHARED_POOL_SIZE
41. Hard/Soft Parse
Execution Plan
Query Transformer
Estimator
Plan Generator
Row Source Generator
Execution Plan
Data
Dictionary
Parser
Optimizer
optimizer
statistics
Hash(SQL)
Execution Plan
Execution Plan
Execution Plan
Execution Plan
Execution Plan
Soft Parse Hard Parse
Execution Plan
Shared Pool
(Library Cache)
Syntax analysis
Semantic analysis
Server Process
42. Buffer Cache
Data Block Copy From DataFiles
Least Recently Used(LRU)
DBWR write Dirty Buffer to Datafile
DB_CACHE_SIZE Free/Unused
Clean
Dirty
DBWR write back
to datafile
Server process
read from datafile
Server process
Modify block content
43. Datafile
PGA
Select
Log Buffer
DBWR LGWR
Control
file
Logfile
group
1
Logfile
group
2
Server
Process
Execution
Plan
SMON PMON CKPT RECO
1 A A1
10 J J
10
17 Q Q17
2 B B2
18 R R18
19 S S1
9
3 C C3
7 G G7
11 K K
11
4 D D4
12 L L
12
21 U U
21
6 F F6
13 M M13
22 V V
22
8 H H8
15 O O15
24 X X
24
5 E E5
14 N N
14
23 W W23
9 I I9
16 P P
16
20 T T
20
A B C
1 A A1
2 B B2
3 C C3
4 D D4
5 E F5
6 F E6
7 G G7
8 H H8
9 I I9
10 J J10
11 K K11
12 L L12
13 M M13
14 N N14
15 O O15
16 P P16
17 Q Q17
18 R R18
19 S S19
20 T T20
21 U U21
22 V V22
23 W W23
24 X X24
User
Process
SELECT c FROM t1 WHERE a=19; 1.Parse
S19
3.Fetch
Shared
Pool Buffer Cache
2 B B2
18 R R18
19 S S1
9
2.Execute
44. Log Buffer
Redo Entry from Server Process’s PGA
DML/DDL
Circular buffer
LOG_BUFFER_SIZE
45. 2.4
Copy Redo Entries to Log Buffer
Datafile
PGA
DML
Log Buffer
DBWR LGWR
Control
file
Logfile
group
1
Logfile
group
2
Server
Process
Execution
Plan
SMON PMON CKPT RECO
1 A A1
10 J J
10
17 Q Q17
2 B B2
18 R R18
19 S S1
9
3 C C3
7 G G7
11 K K
11
4 D D4
12 L L
12
21 U U
21
6 F F6
13 M M13
22 V V
22
8 H H8
15 O O15
24 X X
24
5 E E5
14 N N
14
23 W W23
9 I I9
16 P P
16
20 T T
20
A B C
1 A A1
2 B B2
3 C C3
4 D D4
5 E F5
6 F E6
7 G G7
8 H H8
9 I I9
10 J J10
11 K K11
12 L L12
13 M M13
14 N N14
15 O O15
16 P P16
17 Q Q17
18 R R18
19 S S19
20 T T20
21 U U21
22 V V22
23 W W23
24 X X24
User
Process
1.Parse
Shared
Pool Buffer Cache
2 B B2
18 R R18
19 S S9
1
UPDATE t1
SET c=‘S91’
WHERE a=19;
2.3
Generated
Redo Entries
undo S19
data S91
2.Execute
2.1
Get Data Blocks
1 row updated
2.2
Lock Row
undo S19
data S91
2.6
Change Date Block
2.5
S19
Copy before image
to Undo Block
46. Datafile
PGA
COMMIT
Log Buffer
DBWR LGWR
2.3
Write Redo Entries to Log File
Control
file
Logfile
group
1
Logfile
group
2
Server
Process
Execution
Plan
SMON PMON CKPT RECO
1 A A1
10 J J
10
17 Q Q17
2 B B2
18 R R18
19 S S1
9
3 C C3
7 G G7
11 K K
11
4 D D4
12 L L
12
21 U U
21
6 F F6
13 M M13
22 V V
22
8 H H8
15 O O15
24 X X
24
5 E E5
14 N N
14
23 W W23
9 I I9
16 P P
16
20 T T
20
A B C
1 A A1
2 B B2
3 C C3
4 D D4
5 E F5
6 F E6
7 G G7
8 H H8
9 I I9
10 J J10
11 K K11
12 L L12
13 M M13
14 N N14
15 O O15
16 P P16
17 Q Q17
18 R R18
19 S S91
20 T T20
21 U U21
22 V V22
23 W W23
24 X X24
User
Process
1.Parse
Shared
Pool Buffer Cache
2 B B2
18 R R18
19 S S9
1
S19
COMMIT;
commit
2.Execute
COMMITTED
undo S19
data S91
commit
2.1
Generated
Redo Entries
2.2
Copy Redo Entries to Log Buffer
undo S19
data S91
commit
2.4
Release Lock
47. DBWR&COMMIT
Datafile
PGA
Log Buffer
DBWR LGWR
Control
file
Logfile
group
1
Logfile
group
2
Server
Process
Execution
Plan
User
Process Shared
SMON PMON CKPT RECO
1 A A1
10 J J
10
17 Q Q17
2 B B2
18 R R18
19 S S9
1
3 C C3
7 G G7
11 K K
11
4 D D4
12 L L
12
21 U U
21
6 F F6
13 M M13
22 V V
22
8 H H8
15 O O15
24 X X
24
5 E E5
14 N N
14
23 W W23
9 I I9
16 P P
16
20 T T
20
A B C
1 A A1
2 B B2
3 C C3
4 D D4
5 E F5
6 F E6
7 G G7
8 H H8
9 I I9
10 J J10
11 K K11
12 L L12
13 M M13
14 N N14
15 O O15
16 P P16
17 Q Q17
18 R R18
19 S S91
20 T T20
21 U U21
22 V V22
23 W W23
24 X X24
Pool Buffer Cache
S19
undo S19
data S91
undo S19
data S91
2 B B2
18 R R18
19 S S9
1
S19
48. INSTANCE
Shared Pool Buffer Cache Large Pool Java Pool Streams
Pool
SMON PMON DBWR LGWR CKPT RECO ARCH
Log Buffer
Group1
Header Header Header Header
Datafiles
Group2
Controlfile
LogFiles
Archived
logfile
Program
Global
Area
ParameterFile
Password File
Alert Logfile
Trace File
DATABASE
User
Process
Server
Process
50. Log Buffer
Con
trol
file
Logfil
e
group
1
Logfil
e
group
2
Shared Pool Buffer Cache
MMON
Data Dictionary
Automatic
Workload
Repository
X$
V$XXX
DBA_XXX
DBA_HIST_XXX
52. !
SQL> desc dictionary
Name Null? Type
---------------------------- -------- ----------------------------
TABLE_NAME VARCHAR2(30)
COMMEN VARCHAR2(4000)
!
SQL> select substr(table_name,1,4),count(*)
2> from dictionary
3> where substr(table_name,1,4) in ('DBA_','ALL_','USER')
4> group by substr(table_name,1,4);
!
SUBSTR(T COUNT(*)
----------------- --------
ALL_ 355
USER 375
DBA 705
!
!
53. SQL> show user
USER is "SYSMAN"
SQL> select count(*) from user_tables;
!
COUNT(*)
----------
728
!
SQL> select count(*) from all_tables;
!
COUNT(*)
----------
832
!
SQL> select count(*) from dba_tables;
!
COUNT(*)
----------
2783
SQL> show user
USER is "HR"
SQL> select count(*) from user_tables;
!
COUNT(*)
----------
7
!
SQL> select count(*) from all_tables;
!
COUNT(*)
----------
106
!
SQL> select count(*) from dba_tables;
select count(*) from dba_tables
*
ERROR at line 1:
ORA-00942: table or view does not exist
59. SQL> SELECT sum(bytes) FROM dba_data_files WHERE tablespace_name='EXAMPLE';
!
SUM(BYTES)
-------------------
!
SQL> SELECT sum(bytes) FROM dba_segments WHERE tablespace_name='EXAMPLE';
!
SUM(BYTES)
-------------------
!
SQL> SELECT sum(bytes) FROM dba_extents WHERE tablespace_name='EXAMPLE';
!
SUM(BYTES)
-------------------
SUM(DBA_DATA_FILES) !=
362414080
324141056
324141056
WHY?
SUM(DBA_EXTENTS) + SUM(DBA_FREE_SPACE)
!
SQL> SELECT sum(bytes) FROM dba_free_space WHERE tablespace_name='EXAMPLE';
!
SUM(BYTES)
-------------------
37224448 --(362414080-324141056-37224448)=1048576(File Header Bitmap)
60. Auto Extent Size
SQL> CREATE TABLESPACE demots1
2 DATAFILE '/u02/oradata/orcl/demots01.dbf' SIZE 3M
3 EXTENT MANAGEMENT LOCAL
4 AUTOALLOCATE
5 SEGMET SPACE MANAGEMENT AUTO;
Bitmap
1 1 0
1M 2M
8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
extent
Extent size:
64K : 1-16
1M : 17-79
8M : 80-200
64M : 201- ...
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
64
K
61. Uniform extent size
SQL> CREATE TABLESPACE demots2
2 DATAFILE '/u02/oradata/orcl/demots02.dbf' SIZE 3M
3 EXTENT MANAGEMENT LOCAL
4 UNIFORM SIZE 128K
5 SEGMENT SPACE MANAGEMENT AUTO;
1 1 0
Bitmap
1M 2M 8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
8
k
extent
Extent size:128K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
128
K
64. SQL> CREATE TABLE hr.t1
2> ( a NUMBER,
3> b VARCHAR2(100))
4> TABLESPACE demots1;
DDL=DML on Data Dictionary
1 11 1 1 1 1 1111111101110010100 x$ktfbue 11 1 1 0 1101111000000000000
obj$
123 T1
seg$
123 123 T1
tab$
col$
123 T1
123 T1 A N
123 T1 B V
SQL> INSERT INTO hr.t1
HWM
2> VALUES(1,’A’); 1 A
SQL> INSERT INTO hr.t1
2> VALUES(2,’B’);
2 B
3 C
SYSTEM DEMOTS1
65. Delete
HR.T1’s Definition HR.T1’s Data
1 11 1 1 1 1 1111111101110010100 x$ktfbue 11 1 1 1 1101111000000000000
obj$
123 T1
seg$
123 123 T1
tab$
col$
123 T1
123 T1 A Number
123 T1 B Varchar2
HWM
1 A
2 B
3 C
SQL> DELETE hr.t1
2> WHERE a=1;
SQL> DELETE hr.t1
2> WHERE b=’D’;
4 D
5 E
6 F
SYSTEM DEMOTS1
66. Truncate
HR.T1’s Definition HR.T1’s Data
1 11 1 1 1 1 1111111101110010100 x$ktfbue 11 1 1 0 1101111000000000000
obj$
123 T1
seg$
123 123 T1
tab$
col$
123 T1
123 T1 A Number
123 T1 B Varchar2
HWM
1 A
2 B
3 C
SQL> truncate table
2> hr.t1;
4 D
5 E
6 F
SYSTEM DEMOTS1
74. Begin/END of TX
Begin of TRANSACTION
上⼀一個TRANSACTION結束後,遇到第⼀一個的DML指令。︒
End of TRANSACTION
COMMIT
AUTO COMMIT
遇到DDL/DCL指令
正常結束SESSION
ROLLBACK
AUTO ROLLBACK
INSTANCE CRASH
SESSION不正常結束
75. Transaction ID
SQL> COMMIT; --結束⽬目前的交易
!
SQL> UPDATE TABLE t1 --開始另⼀一個交易.Transaction ID將先被指定.
2> SET salary=3000
3> WHERE empid=100;
!
SQL> SELECT xidusn,xidslot,xidsqn,ubafil,ubablk,ubasqn,status,ses_addr,xid
2> FROM v$transaction;
!
XIDUSN XIDSLOT XIDSQN UBAFIL UBABLK UBASQN STATUS SES_ADDR
XID
---------------- --------------- -------------- ------------- --------------- --------------- ------------ ------------------------- --------------------------
3 31 1253 3 1198
354 ACTIVE 000000007E454C58 03001F00E5040000
!
SQL> SELECT sid,type,id1,id2,lmode,request
2> FROM v$lock
3> WHERE type IN ('TM','TX');
!
SID TY ID1 ID2 LMODE REQUEST
----------- ----- ---------- ---------- ------------- ---------------
125 TM 77329 0
3 0
125 TX 196639 1253 6 0
XIDUSN=trunc(196639/power(2,16))
XIDSLOT=bitand(196639,to_number('ffff','xxxx'))
XIDSQN=1253
76. Transaction&Block
Transaction slots
100 Frank 10-May-12 2000
Row Header Column Data
Undo
Segment #1
Undo
Segment #2
Undo
Segment #3
Transaction Table
Trans
TBL
Index State Wrap DBA
1 9 1100
2 10 989
..... ...... ......
31 9 1252
SQL> COMMIT;
1 2 3 4 5
Row Directory
77. Transaction&Block
Transaction slots
3.31.1253
100 Frank 10-May-12 3000
Row Header Column Data
Undo
Segment #1
Undo
Segment #2
Undo
Segment #3
Transaction Table
Trans
TBL
Index State Wrap DBA
1 9 1100
2 10 989
...... ...... ......
31 10 1253 3.1198
SQL> COMMIT;
SQL> UPDATE TABLE t1
2> SET salary=3000
3> WHERE empid=100;
1 2 3 4 5
2
2000
Transaction ID
Row Directory