Les01 RW

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Oracle Database Architecture: Overview

Copyright © 2006, Oracle. All rights reserved.


Objectives

After completing this lesson, you should be able to:


• Describe the Oracle Database architecture and
components
• Make qualified decisions about your tuning
actions

1-2 Copyright © 2006, Oracle. All rights reserved.


Oracle Database Architecture: Overview

• The Oracle Database consists of two main


components:
– The database: physical structures
– The instance: memory structures
• The size and structure of these components
impact performance.

1-3 Copyright © 2006, Oracle. All rights reserved.


Oracle Instance Management
SGA

Shared pool Streams pool Large pool

Database Redo log


Java pool
buffer cache buffer

System Process Database Log


Monitor Monitor Writer Writer
SMON PMON DBW0 LGWR
Archived
redo log
files

Check
Archiver
point Control Redo log ARC0
CKPT Data
file files
files

1-4 Copyright © 2006, Oracle. All rights reserved.


Database Physical Structure

Control files

Data files Online redo log files

Parameter file Password file Archive log files

1-5 Copyright © 2006, Oracle. All rights reserved.


Oracle Memory Structures

PGA PGA PGA

Server Server Server


process 1 process 2 process 3

SGA

Shared pool Streams pool Large pool

Database Redo log


Java Pool
buffer cache buffer

1-6 Copyright © 2006, Oracle. All rights reserved.


Automatic Shared Memory Management

SGA

Shared pool Fixed SGA Large pool

Database Redo log


Java pool
buffer cache buffer

Which size to choose?

1-8 Copyright © 2006, Oracle. All rights reserved.


Shared Pool

• The shared pool consists of:


– Data dictionary cache containing information on
objects, storage, and privileges
– Library cache containing information such as SQL
statements, parsed or compiled PL/SQL blocks, and
Java classes
• Appropriate sizing of the shared pool affects
performance by:
– Reducing disk reads
– Allowing shareable SQL code
– Reducing parsing, thereby saving CPU resources
– Reducing latching overhead, thereby improving
scalability

1-9 Copyright © 2006, Oracle. All rights reserved.


Shared SQL Areas

Cursor for Cursor for


SELECT statement 2 SELECT statement 1

SGA Shared SQL

SELECT SELECT SELECT


statement 1 statement 2 statement 1

User A User B User C

1 - 10 Copyright © 2006, Oracle. All rights reserved.


Program Global Area (PGA)

• PGA is a memory area that contains:


– Session information
– Cursor information
– SQL execution work areas
Sort area
Hash join area
Bitmap merge area
Bitmap create area
• Work area size influences SQL performance.
• Work areas can be automatically or manually
managed.

1 - 11 Copyright © 2006, Oracle. All rights reserved.


Automated SQL Execution Memory (PGA)
Management

• Allocation and tuning of PGA memory is simplified


and improved.
– Efficient memory allocation for varying workloads
– Queries optimized for both throughput and
response times
• DBAs can use parameters to specify the policy for
PGA sizing.

1 - 13 Copyright © 2006, Oracle. All rights reserved.


Connecting to an Instance

User Server

Oracle database

User Server

Client

Application server Server

User Server
Browser

1 - 14 Copyright © 2006, Oracle. All rights reserved.


SQL Statement Processing Phases

Open Close

Parse Bind Execute Fetch

1 - 16 Copyright © 2006, Oracle. All rights reserved.


SQL Statement Processing Phases: Parse

• Parse phase:
– Searches for the statement in the shared pool
– Checks syntax
– Checks semantics and privileges
– Merges view definitions and subqueries
– Determines execution plan
• Minimize parsing as much as possible:
– Parse calls are expensive
– Avoid reparsing
– Parse once, execute many times

1 - 17 Copyright © 2006, Oracle. All rights reserved.


SQL Statement Processing Phases: Bind

• Bind phase:
– Checks the statement for bind variables
– Assigns or reassigns a value to the bind variable
• Bind variables impact performance when:
– They are not used, and your statement would
benefit from a shared cursor
– They are used, and your statement would benefit
from a different execution plan

1 - 19 Copyright © 2006, Oracle. All rights reserved.


SQL Statement Processing Phases:
Execute and Fetch

• Execute phase:
– Executes the SQL statement
– Performs necessary I/O and sorts for data
manipulation language (DML) statements
• Fetch phase:
– Retrieves rows for a query
– Sorts for queries when needed
– Uses an array fetch mechanism

1 - 20 Copyright © 2006, Oracle. All rights reserved.


Processing a DML Statement

Database SGA
2 Database
buffer cache
1
Data Redo log
Server 3 buffer
files process
Shared pool
UPDATE
Control employees ...
files
4

User
Redo process
log files

1 - 21 Copyright © 2006, Oracle. All rights reserved.


COMMIT Processing
Instance
Database SGA
Database
buffer cache

Data Redo log


Server buffer
files process
Shared pool

Control
files

User
process
Redo
log files LGWR

1 - 23 Copyright © 2006, Oracle. All rights reserved.


Functions of the Oracle Query Optimizer

The Oracle query optimizer determines the most


efficient execution plan and is the most important step
in the processing of any SQL statement.
The optimizer:
• Evaluates expressions and conditions
• Uses object and system statistics
• Decides how to access the data
• Decides how to join tables
• Decides which path is most efficient

1 - 25 Copyright © 2006, Oracle. All rights reserved.


Top Database Performance Issues

• Bad connection management


• Poor use of cursors and the shared pool
• Bad SQL
• Nonstandard initialization parameters
• I/O issues
• Long full-table scans
• In-disk sorts
• High amounts of recursive SQL
• Schema errors and optimizer problems

1 - 26 Copyright © 2006, Oracle. All rights reserved.


Summary

In this lesson, you should have learned about the


Oracle Database architecture and various components
that require tuning.

1 - 28 Copyright © 2006, Oracle. All rights reserved.

You might also like