You are on page 1of 40

Session id: 40170

The Self-managing Database:


Proactive Space and
Schema Object Management
Amit Ganesh
Director,
Data, Space and Transaction Processing
Oracle Corporation
Agenda

y Proactive Space Management


– Alerts
– Size estimation and growth trending
– Segment Advisor and Shrink
y Proactive Undo Management
– Alerts
– Auto-sizing
– Auto-tuning
Automatic Space Management

Oracle9i
y No external space
Application & SQL fragmentations
Management
– Locally Managed
Storage System Resource
Tablespace
Management Management y No space allocation
contention
Space – Automatic Segment
Backup & Recovery
Management Database Management Space Management
Management
y No Rollback Segments
Intelligent Infrastructure
– Automatic Undo
Management
Oracle Database 10g –
Self-Managing Database

Application & SQL


Management

Storage System Resource


Management Management

Database Space
Database Backup & Recovery
Management Management
Management
Control
Intelligent
Infrastructure
10g: Always working for you

y Collects continuously
y Records periodically to disk
y Learns from historical data
y Adapts to changing workload
y Alerts DBA when problems occur
y Advises proactively on problems

y Integrated with the Enterprise Manager


Proactive
Space
Management
Proactive Space Management in
10g
$$
Operations
Size Estimation
90

Growth
80
70
60
50

Planning
40
30

Trending
20
10
0
1st Qtr 2nd Qtr 3rd Qtr 4th Qtr

Segment
Actions Advisor
Tablespace
Shrink Alerts
Add file
Re-org/ rebuild
Resumable
Object Size Estimation
Tablespace Alerts

y Database Generated
y Warning, Critical
y Out of the box

y Tablespaces can be provisioned with more


disk space before out-of-space conditions
occur
Tablespace Thresholds
97% Critical
97% Critical
85% Warning
Locally 85% Warning
Managed
Tablespace Alert

Add files
Add Files
Resolve Space
Problem
Free up space
Freeing up space
Alert Computation
ory Check every 10 mns
em ion
- M lat Alert 97% Critical Cleared
n
I lcu
Ca
Alert 85% Warning Cleared

MMON

y Read only/Offline tablespaces: Do not setup alerts


y Temporary tablespace: Threshold corresponds to space
currently used by sessions.
y Undo tablespace: Threshold corresponds to space used
by active and unexpired extents.
y AUTOEXTENSIBLE files: Threshold is based on the
maximum file size.
Threshold Alert Tracking

Instance1 Instance2
File1 100MB 60MB … SCNt1 File1 100MB 60MB … SCNt1
File2 50MB 10MB … SCNt2 File2 50MB 10MB … SCNt2
… …
Filen Filen

File Size
Allocated Space
Data
Change SCN
aggregated
through GV$
MMON MMON
Tablespace
Tablespace Size:
150M Allocated: 70M File1 File2
Setting Thresholds Using EM

y Changing database default thresholds


y Changing a particular tablespace thresholds
– Directly in the context of the tablespace
– From the Edit Metric Thresholds page
Tablespace Threshold Page
Receiving Alerts in EM
Growth Trend Report

y Based on Automatic Workload Repository


Data
y Indicates past growth trend and predicts
future growth pattern
Growth Trend Report
Segment Advisor

y Determines whether an object is a good


candidate for a shrink operation
– Based on unused space that can be
released
– Considers estimated future space
requirements
y EM allows you to apply the recommended
shrink
y Can be invoked at the segment or
tablespace level
Segment Shrink

Unused Unused
Data
Space Space

HWM

Online and Shrink


Shrink
In-place Operation
Operation
Reclaimed Space

HWM
Benefits

Online & In-place Faster access

Shrunk
Segment

Better space utilization


Candidate Segments
Auto Segment Space Managed
Tablespace

Tables LOBs

Row
Movement
IOTs
Enabled

Materialized Indexes
Views
Dependency Maintenance
Indexes are maintained
Index

Table Shrink
Shrink
DBA

Trigger

Triggers are not fired


How Can I Shrink Segments?
ALTER … SHRINK SPACE [CASCADE]

TABLE INDEX MATERIALIZED VIEW MATERIALIZED VIEW LOG

MODIFY PARTITION MODIFY SUBPARTITION MODIFY LOB

ALTER TABLE employees ENABLE ROW MOVEMENT; 1

ALTER TABLE employees SHRINK SPACE CASCADE; 2


How Does it Work?
ALTER TABLE employees SHRINK SPACE COMPACT; 1

HWM

HWM

ALTER TABLE employees SHRINK SPACE; 2

HWM
EM Interface
Space Management : Before and Now
Scenario: Reclaim Wasted Space

Before Oracle10G
1. Launch Segment Advisor to
y Check to see which objects in the tablespace have pockets advise on which object(s) to
of wasted space due to deletion: shrink
1. Create a script that looks at DBA_TABLES view to 2. Accept the recommendations
compare the total space allocated for each object to shrink the objects online
(BLOCKS * DB_BLOCK_SIZE) in a tablespace to the and in-place
estimated space used by the object (AVG_ROW_LEN
* NUM_ROWS)
(assumes objects have been analyzed)
2. Review script output and identify target objects for
reorganization
3. Identify/Create “scratch” tablespace
4. For each object to be reorganized, use the Enterprise
Manager Reorg wizard to recreate each object along with its
dependencies
Proactive
Undo
Management
Oracle Database 10g

y Auto-sizing Undo Tablespace


y Auto-tuning Undo Retention
y Proactive Monitoring
y Undo Advisor
Auto-sizing Undo Tablespace

y A self-learning system
– Create Undo tablespace with autoextensible files

– Run your workload

– Done!

(undo tablespace size adapts to the application)


Auto-tuning Undo Retention

Before Oracle 10g: Auto-tuning


OLTP 6000

Tuned UR, seconds


DSS
4000
Tuned UR
Query Length
2000

0
Time
Small RBS/ Large RBS/
UR = 15 min UR = 5 hrs
Proactive Monitoring: Alerts
y Out of Undo Space Alert
y Long query warning Alert

Out of space Out of space ORA-1555


Warning Critical Failure

7:00am 7:10 7:20 7:30 7:40



Undo Advisor

Automatically analyzes the undo usage to


advice optimal:
– Undo tablespace size to support your longest
running query
– Undo tablespace size for a given undo
retention period to support Undo based
Flashback toolset
Undo Home: Automatic Advice
Undo Advisor: What if?
Summary

y Self-management engineered into the core of


Oracle Database 10g
y Self-management through:
– Auto-sizing and size estimation
– Built-in statistics gathering
– Server-driven Alerts
– Automatic Advisers
– Auto-tuning to adapt to changing workload
– Integration with the Enterprise Manager
Next Steps….
y Recommended sessions
– The Self-Managing Database : Automatic Health
Monitoring (Thursday, Sept. 11, 11 AM)
– Enterprise Manager : Scalable Oracle Management
(Thursday, Sept. 11, 1 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: Space
Management”
y Relevant web sites to visit for more information
– http://otn.oracle.com/products/manageability/database/cont
ent.html
Reminder:
Please complete the
OracleWorld online session
survey

Session # 40170

Thank you.
QUESTIONS
ANSWERS