Sunteți pe pagina 1din 34

Session id: 40091

The Self-Managing Database:


Automatic SGA Memory Management

Tirthankar Lahiri
Senior Manager, Distributed Cache &
Memory Management
Oracle Corporation
Outline
y Overview of Oracle Shared Memory (SGA)
y Introducing Automatic SGA Management
y Benefits
y Using the feature
y How Does it Work?
y Summary
SGA Overview

y SGA: Oracle’s “Shared Global Area”


y Comprises multiple memory components

Database Redo Log


Shared Pool
Buffer Cache Buffer

Java Pool Fixed SGA Large Pool

SGA
SGA Overview

y In past releases: Separate parameters for


SGA components

DB_CACHE_SIZE
SHARED_POOL_SIZE
LARGE_POOL_SIZE
JAVA_POOL_SIZE
SGA Overview

y Difficult to optimally set parameters


y Undersized component:
– Poor performance (excess IO, parses)
– Out-of-memory errors (ORA-4031)
y Oversized component:
– Wastes memory
– Configuring for the worst-case
SGA Overview

y Oracle9i introduced SGA memory advisories:


– Buffer Cache Advice (v$db_cache_advice)
– Shared Pool Advice (v$shared_pool_advice)
y Predicts performance for different sizes
Buffer Cache Advice

Physical IOs

Buffer cache size


SGA Overview

y Advisories allow better sizing for components


– Available out-of-the-box
– Reduces trial and error
– Recommendations based on actual workload
– With Dynamic SGA:
y Recommendations can be implemented online
y Task of adjusting sizes still left to the DBA
Introducing Automatic SGA Memory
Management
y The Oracle Database 10g
– Single parameter for total SGA size
– Automatically sizes SGA components
– Memory is transferred to where most needed
– Uses workload information
– Uses internal advisory predictions
Introducing Automatic SGA Memory
Management
y Single parameter for SGA size
DB_CACHE_SIZE
SHARED_POOL_SIZE
LARGE_POOL_SIZE
JAVA_POOL_SIZE

Enable
Automatic Shared Memory Management

SGA_TARGET
Introducing Automatic SGA Memory
Management
y Set SGA_TARGET to the total SGA size

Database Redo Log


Shared Pool
Buffer Cache Buffer

Java Pool Fixed SGA Large Pool

SGA

SGA_TARGET = 8G
Introducing Automatic SGA Memory
Management

y Four most commonly configured components


are automatically sized:
– Shared Pool
– Large Pool
– Java Pool
– Buffer Cache (DEFAULT buffer pool)
y STATISTICS_LEVEL must be set to TYPICAL
Benefits of Automatic SGA Management

y Automatically adapts
Online Buffer Cache to workload changes
Large Batch
Users Jobs y Maximizes memory
Buffer Cache
utilization
Large Pool
y Single Parameter
makes it easier to
Large Pool use
y Helps eliminate out
Shared Pool Shared Pool of memory errors
y Can help improve
Java Pool Java Pool
performance
Using Automatic SGA Management:
SGA_TARGET Parameter

y Includes everything in the SGA:


– Fixed SGA and other internal allocations
– Automatically sized SGA components
y Default buffer cache
y Shared pool
y Large pool
y Java pool
– Manual SGA components
y Log buffer
y Other caches (KEEP/RECYCLE, other blocksizes)
y Streams pool (new in 10g)
Using Automatic SGA Management:
Automatically Tuned Parameters

y When SGA_TARGET is not set (or zero):


– Auto-tuned parameters behave as in Oracle9i
– Exception: SHARED_POOL_SIZE:
y In Oracle10g internal startup overhead is included
y May need to increase value from Oracle9i
y Query to determine actual shared pool size in 9i
y Shared Pool Size automatically adjusted during
upgrade

SELECT SUM(bytes)
FROM v$sgastat
WHERE pool = 'shared pool';
Using Automatic SGA Management:
Automatically Tuned Parameters
Parameters:
SGA_TARGET = 8G y When SGA_TARGET is set:
LARGE_POOL_SIZE = 1G
SHARED_POOL_SIZE = 1G – Default values of auto-tuned
parameters is zero
Buffer Cache (3G) – A non-zero value is a lower bound
on the size of the component
Sga size = 8G

Large Pool (1G) – Actual component size may be


higher
Shared Pool (3G)

(Min size = 1G)

Java Pool (1G)


Using Automatic SGA Management:
Determining the current component sizes
Using Automatic SGA Management:
Manually Tuned Parameters

y Some components not yet auto-tuned


– Other buffer caches (Keep/Recycle)
– Multiple blocksize caches
– Streams Pool
y Their parameters are user-specified
y Precisely control the sizes of their
components
Using Automatic SGA Management:
Manually Tuned Parameters

y When SGA_TARGET is set:


– Total size of manual parameters is subtracted
– Balance is given to the auto-tuned components

Parameters:
SGA_TARGET = 8G
DB_KEEP_CACHE_SIZE = 1G

Auto Tuned Components (7G)


Keep Cache
Shared Large Default Java (1G)
Pool Pool Cache Pool
Using Automatic SGA Management
Using v$parameter

y Initialization parameter values:


SGA_TARGET = 8G
DB_CACHE_SIZE = 0
JAVA_POOL_SIZE = 0
LARGE_POOL_SIZE = 0
SHARED_POOL_SIZE = 0

Querying V$PARAMETER
SELECT name, value, isdefault
FROM v$parameter
WHERE name like '%size';
Enabling Automatic SGA Management
Using Automatic SGA Management :
Resizing SGA_TARGET

y SGA_TARGET is dynamic
y Can be increased till SGA_MAX_SIZE
y Can be reduced till some component reaches
minimum size
y Change in value of SGA_TARGET affects
only automatically sized components
Using Automatic SGA Management :
Resizing SGA_TARGET

Shared Pool Database Redo Log


Buffer Cache Buffer

Java Pool Fixed SGA Large Pool

SGA_TARGET = 8G

SGA_TARGET=9G

SGA_MAX_SIZE=10G
Disabling Automatic SGA Management
y SGA_TARGET = 0 disables auto-tuning
– Auto parameters set to current component sizes
– SGA size as a whole is unaffected

sga size = 8G
sga size = 8G
Parameters:
sga_target = 0
Parameters: SGA_TARGET=0
db_cache_size = 4G
sga_target = 8G
shared_pool_size = 2G
shared_pool_size=1G
large_pool_size = 512M
java_pool_size = 512M
Using Automatic SGA Management
Resizing Auto Tuned Parameters

• Results in component resize only if new value > current size


• Otherwise silently changes the minimum size

Shared Pool Database Redo Log


SGA_TARGET = 8G
SHARED_POOL_SIZE=1G Buffer Cache Buffer
actual size = 2G

Java Pool Fixed SGA Large Pool

SGA
Using Automatic SGA
Management
Resizing Manually Set Parameters

y Manual parameter resize affects the tunable


portion of the SGA
Parameters: Auto Tuned Components (7G) Keep
SGA_TARGET = 8G Shared Large Default Java Cache
DB_KEEP_CACHE_SIZE = 1G Pool Pool Cache Pool (1G)

Parameters: Auto Tuned Keep


SGA_TARGET = 8G Components (6G) Cache
DB_KEEP_CACHE_SIZE = 2G (2G)
How Does It Work?
SGA Background Process

Coordinates Background Tracks


sizing of SGA SGA Memory component size
components Broker and pending
resize
How Does It Work?
Basic SGA Tuning Principles

y Based on workload information


y Captures statistics periodically in
background
y Uses the different memory advisories
y Memory is moved to where most needed
y No need to configure parameters for the
worst-case
How Does It Work?
Persistence of auto-tuned values

y If server parameter file (spfile) is used:


– Component sizes saved across shutdowns
– Saved values used to bootstrap component sizes
– Avoids having to relearn optimal values
y For this reason use of spfile is recommended
with Automatic SGA Management
Conclusions

y Relieves the administrator from manually


configuring the SGA
y Internal algorithm adjusts based on workload
y No need to configure for the worst-case
y Simple usage model
Next Steps….
y Recommended sessions
– The Self-Managing Database : Proactive Space and Schema
Object Management (Thurs, Sept 11, 8 AM)
– The Self-Managing Database : Automatic Health Monitoring
(Thurs, Sept. 11, 11 AM)
– The Invisible Oracle : Deploying Oracle Database in Embedded
Environment (Wed, Sept. 10, 4:30 PM)
y Recommended demos and/or hands-on labs
– Oracle Database 10g : Manage the Oracle Environment Hands-
On Lab
– Campground Demo : “The Self-Managing Database: Memory
Management”
y Relevant web sites to visit for more information
– http://otn.oracle.com/products/manageability/database/content.ht
ml
Reminder –
please complete the
OracleWorld online session
survey

Thank you.
QUESTIONS
ANSWERS

S-ar putea să vă placă și