Session id: 40170
The Self-managing Database: Proactive Space and Schema Object Management
Amit GaneshDirector,
Data, Space and Transaction ProcessingOracle Corporation
Agenda
Proactive Space Management– Alerts– Size estimation and growth trending– Segment Advisor and Shrink
Proactive Undo Management– Alerts– Auto-sizing– Auto-tuning
Automatic Space Management
Oracle9iNo external space fragmentations
– Locally Managed Tablespace
No space allocation contention
– Automatic Segment Space Management
No Rollback Segments– Automatic Undo
Management Intelligent Infrastructure
Application & SQLManagement
System ResourceManagement
SpaceManagement
Backup & RecoveryManagement
StorageManagement
Database Management
Oracle Database 10g –Self-Managing Database
Intelligent Infrastructure
Application & SQLManagement
System ResourceManagement
SpaceManagement
Backup & RecoveryManagement
StorageManagement
Database ManagementDatabase
Control
10g: Always working for you
Collects continuouslyRecords periodically to diskLearns from historical dataAdapts to changing workloadAlerts DBA when problems occurAdvises proactively on problems
Integrated with the Enterprise Manager
Proactive Space
Management
Proactive Space Management in 10g
Growth Trending 01020
30405060708090
1st Qtr 2nd Qtr 3rd Qtr 4th Qtr
Size Estimation$$
SegmentAdvisor
TablespaceAlertsShrink
Add fileRe-org/ rebuildResumable
OperationsOperations
PlanningPlanning
ActionsActions
Object Size Estimation
Tablespace Alerts
Database GeneratedWarning, CriticalOut of the box
Tablespaces can be provisioned with more disk space before out-of-space conditions occur
Tablespace Thresholds
85% Warning97% Critical
Alert
97% Critical97% Critical
85% Warning85% Warning
Add files
Freeing up space
Add FilesAdd Files
Free up spaceFree up space
Locally Locally Managed Managed
TablespaceTablespace
Resolve SpaceResolve Space
ProblemProblem
Alert Computation
Read only/Offline tablespaces: Do not setup alertsTemporary tablespace: Threshold corresponds to space currently used by sessions.Undo tablespace: Threshold corresponds to space used by active and unexpired extents.AUTOEXTENSIBLE files: Threshold is based on the maximum file size.
MMON
85% Warning
97% Critical
Check every 10 mns
Alert
Alert Cleared
Cleared
In-Mem
ory
Calcul
ation
Threshold Alert Tracking
SCNt210MB50MBSCNt1 60MB100MBFile1
File2
Filen
…
…
File SizeAllocated Space
Change SCN
…
Instance1
SCNt210MB50MBSCNt1 60MB100MBFile1
File2
Filen
…
……
Instance2
MMON MMON
Data aggregated
through GV$
Tablespace Size: 150M Allocated: 70M File1 File2
Tablespace
Setting Thresholds Using EM
Changing database default thresholdsChanging 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
Based on Automatic Workload Repository DataIndicates past growth trend and predicts future growth pattern
Growth Trend Report
Segment Advisor
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
EM allows you to apply the recommended shrinkCan be invoked at the segment or tablespace level
Segment Shrink
HWM
ShrinkOperation
Data UnusedSpaceUnusedSpace
Reclaimed Space
ShrinkShrink
OperationOperationOnline and Online and
InIn--placeplace
HWM
Benefits
Online & In-place Faster access
ShrunkSegment
Better space utilization
Candidate Segments Auto Segment Space Managed
Tablespace
Tables
IOTs
MaterializedViews
LOBs
Indexes
Row MovementEnabled
Dependency Maintenance
DBA
Shrink
Index
Table
Indexes are maintained
Shrink
Trigger
Triggers are not fired
How Can I Shrink Segments?ALTER … SHRINK SPACE [CASCADE]
ALTER TABLE employees SHRINK SPACE CASCADE;
ALTER TABLE employees ENABLE ROW MOVEMENT; 1
2
TABLE INDEX MATERIALIZED VIEW MATERIALIZED VIEW LOG
MODIFY PARTITION MODIFY LOBMODIFY SUBPARTITION
How Does it Work?ALTER TABLE employees SHRINK SPACE COMPACT; 1
HWM
HWM
HWM
ALTER TABLE employees SHRINK SPACE; 2
EM Interface
Space Management : Before and Now
Oracle10G1. Launch Segment Advisor to
advise on which object(s) to shrink
2. Accept the recommendations to shrink the objects online and in-place
Before
Check to see which objects in the tablespace have pockets of wasted space due to deletion:
1. Create a script that looks at DBA_TABLES view to compare the total space allocated for each object (BLOCKS * DB_BLOCK_SIZE) in a tablespace to the 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
reorganization3. Identify/Create “scratch” tablespace4. For each object to be reorganized, use the Enterprise
Manager Reorg wizard to recreate each object along with its dependencies
Scenario: Reclaim Wasted Space
Proactive Undo
Management
Oracle Database 10g
Auto-sizing Undo TablespaceAuto-tuning Undo RetentionProactive Monitoring Undo Advisor
Auto-sizing Undo Tablespace
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
OLTP DSS
0
2000
4000
6000
TimeT
un
ed
UR
, s
ec
on
ds
Tuned URQuery Length
Before Oracle 10g: Auto-tuning
Small RBS/UR = 15 min
Large RBS/UR = 5 hrs
Proactive Monitoring: AlertsOut of Undo Space AlertLong query warning Alert
Out of space Critical
Out of space Warning
ORA-1555 Failure
7:10…
7:00am 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
Self-management engineered into the core of Oracle Database 10gSelf-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….Recommended sessions
– The Self-Managing Database : Automatic Health Monitoring (Thursday, Sept. 11, 11 AM)
– Enterprise Manager : Scalable Oracle Management (Thursday, Sept. 11, 1 PM)
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”Relevant web sites to visit for more information
– http://otn.oracle.com/products/manageability/database/content.html
Reminder: Please complete the OracleWorld online session survey
Session # 40170
Thank you.
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
The Self-managing Database: Proactive Space and Schema Object ManagementAgendaAutomatic Space ManagementOracle Database 10g – Self-Managing Database10g: Always working for youProactive Space ManagementProactive Space Management in 10gObject Size EstimationTablespace AlertsTablespace ThresholdsAlert ComputationThreshold Alert TrackingSetting Thresholds Using EMTablespace Threshold PageReceiving Alerts in EMGrowth Trend ReportGrowth Trend ReportSegment AdvisorSegment ShrinkBenefitsCandidate SegmentsDependency MaintenanceHow Can I Shrink Segments?How Does it Work?EM InterfaceSpace Management : Before and NowProactive Undo ManagementOracle Database 10gAuto-sizing Undo TablespaceAuto-tuning Undo RetentionProactive Monitoring: AlertsUndo AdvisorUndo Home: Automatic AdviceUndo Advisor: What if?SummaryNext Steps….Reminder: Please complete the OracleWorld online session surveySession # 40170 Thank you.