the self-managing database - oracle id: 40091 the self-managing database: automatic sga memory...

34

Upload: tranphuc

Post on 19-Jun-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management
Page 2: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Session id: 40091

The Self-Managing Database: Automatic SGA Memory Management

Tirthankar LahiriSenior Manager, Distributed Cache &

Memory ManagementOracle Corporation

Page 3: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

OutlineOverview of Oracle Shared Memory (SGA)Introducing Automatic SGA Management Benefits Using the featureHow Does it Work? Summary

Page 4: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

SGA Overview

SGA: Oracle’s “Shared Global Area”Comprises multiple memory components

Java Pool

DatabaseBuffer Cache

Redo Log BufferShared Pool

Large Pool

SGA

Fixed SGA

Page 5: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

SGA Overview

In past releases: Separate parameters for SGA components

DB_CACHE_SIZESHARED_POOL_SIZELARGE_POOL_SIZEJAVA_POOL_SIZE

Page 6: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

SGA Overview

Difficult to optimally set parametersUndersized component:

– Poor performance (excess IO, parses)– Out-of-memory errors (ORA-4031)

Oversized component: – Wastes memory – Configuring for the worst-case

Page 7: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

SGA Overview

Oracle9i introduced SGA memory advisories:– Buffer Cache Advice (v$db_cache_advice)– Shared Pool Advice (v$shared_pool_advice)

Predicts performance for different sizes

Buffer Cache Advice

Physical IOs

Buffer cache size

Page 8: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

SGA Overview

Advisories allow better sizing for components– Available out-of-the-box– Reduces trial and error– Recommendations based on actual workload– With Dynamic SGA:

Recommendations can be implemented online

Task of adjusting sizes still left to the DBA

Page 9: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Introducing Automatic SGA Memory Management

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

Page 10: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Introducing Automatic SGA Memory Management

Single parameter for SGA size

DB_CACHE_SIZESHARED_POOL_SIZELARGE_POOL_SIZEJAVA_POOL_SIZE

Enable Automatic Shared Memory Management

SGA_TARGET

Page 11: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Introducing Automatic SGA Memory Management

Set SGA_TARGET to the total SGA size

Java Pool

DatabaseBuffer Cache

Redo Log BufferShared Pool

Large Pool

SGA

Fixed SGA

SGA_TARGET = 8G

Page 12: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Introducing Automatic SGA Memory Management

Four most commonly configured components are automatically sized:

– Shared Pool– Large Pool– Java Pool– Buffer Cache (DEFAULT buffer pool)

STATISTICS_LEVEL must be set to TYPICAL

Page 13: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Benefits of Automatic SGA Management

Automatically adapts to workload changesMaximizes memory utilizationSingle Parameter makes it easier to useHelps eliminate out of memory errorsCan help improve performance

Large Batch Jobs

Java Pool

Shared Pool

Large Pool

Buffer Cache

Shared Pool

Large Pool

Buffer Cache

Java Pool

Online Users

Page 14: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management: SGA_TARGET Parameter

Includes everything in the SGA:– Fixed SGA and other internal allocations– Automatically sized SGA components

Default buffer cacheShared pool Large poolJava pool

– Manual SGA componentsLog bufferOther caches (KEEP/RECYCLE, other blocksizes)Streams pool (new in 10g)

Page 15: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

When SGA_TARGET is not set (or zero):– Auto-tuned parameters behave as in Oracle9i– Exception: SHARED_POOL_SIZE:

In Oracle10g internal startup overhead is includedMay need to increase value from Oracle9i Query to determine actual shared pool size in 9iShared Pool Size automatically adjusted during upgrade

Using Automatic SGA Management: Automatically Tuned Parameters

SELECT SUM(bytes)FROM v$sgastatWHERE pool = 'shared pool';

Page 16: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management: Automatically Tuned Parameters

When SGA_TARGET is set:– Default values of auto-tuned

parameters is zero– A non-zero value is a lower bound

on the size of the component – Actual component size may be

higher

Java Pool (1G)

Large Pool (1G)

Buffer Cache (3G)

Shared Pool (3G)

(Min size = 1G)

Parameters: SGA_TARGET = 8GLARGE_POOL_SIZE = 1GSHARED_POOL_SIZE = 1G

Sga

size

= 8

G

Page 17: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management: Determining the current component sizes

Page 18: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management: Manually Tuned Parameters

Some components not yet auto-tuned– Other buffer caches (Keep/Recycle)– Multiple blocksize caches– Streams Pool

Their parameters are user-specifiedPrecisely control the sizes of their components

Page 19: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management:Manually Tuned Parameters

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

Keep Cache(1G)

Parameters:SGA_TARGET = 8GDB_KEEP_CACHE_SIZE = 1G

Auto Tuned Components (7G)

SharedPool

Large Pool

Default Cache

Java Pool

Page 20: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management Using v$parameter

Initialization parameter values:SGA_TARGET = 8G DB_CACHE_SIZE = 0JAVA_POOL_SIZE = 0LARGE_POOL_SIZE = 0SHARED_POOL_SIZE = 0

Querying V$PARAMETER

SELECT name, value, isdefault FROM v$parameterWHERE name like '%size';

Page 21: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Enabling Automatic SGA Management

Page 22: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management : Resizing SGA_TARGET

SGA_TARGET is dynamicCan be increased till SGA_MAX_SIZECan be reduced till some component reaches minimum sizeChange in value of SGA_TARGET affects only automatically sized components

Page 23: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management : Resizing SGA_TARGET

SGA_MAX_SIZE=10G

SGA_TARGET=9G

DatabaseBuffer Cache

DatabaseBuffer Cache

Redo Log Buffer

Large Pool

SGA_TARGET = 8G

Fixed SGA

Shared Pool

Java Pool

Page 24: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Disabling Automatic SGA Management

SGA_TARGET = 0 disables auto-tuning– Auto parameters set to current component sizes– SGA size as a whole is unaffected

Parameters:sga_target = 8Gshared_pool_size=1G

sga size = 8G Parameters:sga_target = 0db_cache_size = 4Gshared_pool_size = 2Glarge_pool_size = 512Mjava_pool_size = 512M

sga size = 8G

SGA_TARGET=0

Page 25: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management Resizing Auto Tuned Parameters

• Results in component resize only if new value > current size• Otherwise silently changes the minimum size

SGA_TARGET = 8G

Java Pool

DatabaseBuffer Cache

Redo Log Buffer

Large Pool

SGA

Fixed SGA

Shared Pool

actual size = 2G

SHARED_POOL_SIZE=1G

Page 26: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Using Automatic SGA Management Resizing Manually Set Parameters

Manual parameter resize affects the tunable portion of the SGA

Parameters:SGA_TARGET = 8GDB_KEEP_CACHE_SIZE = 1G

KeepCache(1G)

Auto Tuned Components (7G)

SharedPool

Large Pool

Default Cache

Java Pool

KeepCache(2G)

Auto Tuned Components (6G)

Parameters:SGA_TARGET = 8GDB_KEEP_CACHE_SIZE = 2G

Page 27: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

How Does It Work?SGA Background Process

Background SGA Memory

Broker

Tracks component size

and pending resize

Coordinates sizing of SGA components

Page 28: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

How Does It Work?Basic SGA Tuning Principles

Based on workload informationCaptures statistics periodically in backgroundUses the different memory advisoriesMemory is moved to where most neededNo need to configure parameters for the worst-case

Page 29: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

How Does It Work?Persistence of auto-tuned values

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

For this reason use of spfile is recommended with Automatic SGA Management

Page 30: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Conclusions

Relieves the administrator from manually configuring the SGAInternal algorithm adjusts based on workloadNo need to configure for the worst-caseSimple usage model

Page 31: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Next Steps….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)

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”

Relevant web sites to visit for more information– http://otn.oracle.com/products/manageability/database/content.ht

ml

Page 32: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Reminder –please complete the OracleWorld online session survey

Thank you.

Page 33: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management

Q U E S T I O N SQ U E S T I O N SA N S W E R SA N S W E R S

Page 34: The Self-Managing Database - Oracle id: 40091 The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management