Skip to content

Table Storage Parameter Summary (dtabstor.sql)

This script analyzes table storage parameters by summarizing PCT_FREE and PCT_USED settings across database tables, grouped by schema owner. It provides insight into storage configuration patterns, helping identify inconsistent storage parameters and opportunities for standardization. The script is essential for storage optimization, configuration management, and ensuring consistent storage policies across database schemas.

rem dtabstor.sql
rem
ttitle 'Table Storage Summary'
rem
col owner format a12 heading 'OWNER'
col pct_free format 999 heading 'PCT|FREE'
col pct_used format 999 heading 'PCT|USED'
col table_count format 99999 heading 'TABLE|COUNT'
rem
break on owner
rem
select owner,
pct_free,
pct_used,
count(*) table_count
from sys.dba_tables
where owner like upper('&owner')
group by owner, pct_free, pct_used
/
  • Storage Parameter Analysis: Examines PCT_FREE and PCT_USED settings
  • Schema-Level Grouping: Groups results by owner for organized analysis
  • Configuration Counting: Shows number of tables with each parameter combination
  • Pattern Recognition: Identifies storage configuration patterns and inconsistencies
  • Flexible Filtering: Filter by specific owner or analyze all schemas
  • Standardization Support: Helps identify configuration standardization opportunities
@dtabstor.sql

Input Parameters:

  • owner: Schema owner name or pattern (use % for all schemas)
SELECT on SYS.DBA_TABLES
Table Storage Summary
OWNER PCT PCT TABLE
FREE USED COUNT
------------ ---- ---- -----
HR 10 40 15
20 80 3
SALES 10 40 25
15 75 5
20 80 2
FINANCE 10 40 12
10 60 8
WAREHOUSE 5 95 50
10 40 15
  • OWNER: Schema owner name
  • PCT FREE: Percentage of free space reserved in each block for updates
  • PCT USED: Threshold for block to be considered for new row inserts
  • TABLE COUNT: Number of tables with this specific parameter combination
-- PCT_FREE determines:
-- Percentage of block space reserved for row updates
-- Space available for existing row expansion
-- When blocks become unavailable for new inserts
-- Update performance and row chaining prevention
-- Typical PCT_FREE settings:
-- 10%: Standard for most tables (default)
-- 20-30%: Tables with frequent updates
-- 5%: Read-only or append-only tables
-- 0%: Data warehouse fact tables
-- PCT_USED determines:
-- Threshold for blocks to be available for inserts
-- When blocks return to freelist
-- Space utilization efficiency
-- Insert performance characteristics
-- Parameter relationship:
-- PCT_FREE + PCT_USED must be < 100
-- Gap between them creates hysteresis
-- Prevents frequent freelist additions/removals
-- Affects space utilization and performance
  1. Storage Configuration Analysis

    • Review storage parameter consistency
    • Identify non-standard configurations
    • Plan storage standardization
    • Assess configuration impact
  2. Performance Optimization

    • Optimize storage for workload patterns
    • Reduce row chaining and migration
    • Improve insert and update performance
    • Plan block utilization efficiency
  3. Space Management

    • Analyze space utilization patterns
    • Plan storage efficiency improvements
    • Assess wasted space due to poor parameters
    • Support capacity planning
  4. Configuration Standardization

    • Establish storage parameter standards
    • Identify tables needing parameter updates
    • Plan configuration migration
    • Ensure consistent policies
-- Identify configuration patterns:
-- Default settings (10% FREE, 40% USED)
-- Custom optimized settings
-- Unusual or problematic combinations
-- Schema-specific patterns
-- Assess parameter alignment with workload:
-- OLTP tables: Higher PCT_FREE for updates
-- Data warehouse: Lower PCT_FREE for space efficiency
-- Archive tables: Minimal PCT_FREE
-- Staging tables: Optimized for bulk operations
-- Space utilization factors:
-- Higher PCT_FREE = less space efficient
-- Lower PCT_USED = more frequent freelist management
-- Gap size affects performance stability
-- Schema-wide impact assessment
-- Update performance considerations:
-- Insufficient PCT_FREE causes row chaining
-- Excessive PCT_FREE wastes space
-- Workload-specific optimization needs
-- Performance vs. space trade-offs
-- OLTP optimization guidelines:
-- PCT_FREE: 15-25% for high update tables
-- PCT_FREE: 10% for moderate update tables
-- PCT_USED: 40% for balanced performance
-- Consider row growth patterns
-- Data warehouse optimization:
-- PCT_FREE: 0-5% for fact tables
-- PCT_FREE: 10% for dimension tables
-- PCT_USED: 80-95% for space efficiency
-- Optimize for bulk loading
-- Mixed workload considerations:
-- Analyze table-specific access patterns
-- Balance space efficiency and performance
-- Consider partitioning for different parameters
-- Monitor and adjust based on metrics
-- Establish schema standards:
-- Application-specific parameter sets
-- Default configurations by table type
-- Exception handling procedures
-- Configuration documentation
-- Standardization implementation:
-- Identify tables needing changes
-- Plan maintenance windows
-- Test parameter changes
-- Monitor performance impact
-- Analyze specific schema:
Enter value for owner: HR
-- Review all schemas:
Enter value for owner: %
-- Analyze schema patterns:
Enter value for owner: %APP%
-- Row chaining indicators:
-- PCT_FREE too low for update patterns
-- Frequent row migration
-- Poor update performance
-- Solution: Increase PCT_FREE
-- Space waste indicators:
-- PCT_FREE too high for workload
-- Excessive unused space in blocks
-- Poor space utilization
-- Solution: Decrease PCT_FREE
-- Freelist issues:
-- PCT_USED set too low
-- Frequent freelist management overhead
-- Insert performance problems
-- Solution: Optimize PCT_USED setting
-- Adjust storage parameters:
ALTER TABLE table_name
STORAGE (PCTFREE 15 PCTUSED 75);
-- Consider table reorganization after changes
-- Monitor performance impact
-- Validate space utilization improvements
-- Monitor parameter effectiveness:
-- Track row chaining statistics
-- Monitor space utilization
-- Assess performance metrics
-- Adjust parameters as needed
-- Correlate with chaining statistics:
SELECT
owner, table_name,
pct_free, pct_used,
chain_cnt, avg_row_len
FROM dba_tables
WHERE chain_cnt > 0
ORDER BY chain_cnt DESC;
-- Analyze space efficiency:
SELECT
owner, pct_free, pct_used,
AVG(blocks) as avg_blocks,
AVG(empty_blocks) as avg_empty_blocks
FROM dba_tables
GROUP BY owner, pct_free, pct_used;
-- Storage parameter guidelines:
-- Document workload-specific settings
-- Define default configurations
-- Create exception approval process
-- Regular configuration reviews
-- Tailor settings to application needs:
-- OLTP: Higher PCT_FREE for updates
-- Reporting: Lower PCT_FREE for space efficiency
-- Archive: Minimal PCT_FREE
-- Staging: Bulk operation optimization
-- Monitoring schedule:
-- Monthly configuration reviews
-- Quarterly performance assessments
-- Annual standardization audits
-- Change impact evaluations
-- Track performance metrics:
-- Row chaining statistics
-- Space utilization efficiency
-- Insert/update performance
-- User response times
-- Initial assessment steps:
-- Run script for all schemas
-- Identify configuration patterns
-- Document current state
-- Assess performance correlations
-- Optimization process:
-- Develop workload-specific standards
-- Plan parameter changes
-- Test in development environment
-- Implement in production
-- Ongoing monitoring:
-- Regular configuration audits
-- Performance impact tracking
-- Space utilization monitoring
-- Continuous improvement

This script is essential for:

  1. Storage Configuration Analysis - Understanding current storage parameter patterns
  2. Performance Optimization - Optimizing storage for specific workload requirements
  3. Standardization Planning - Establishing consistent storage policies
  4. Space Management - Improving storage efficiency and utilization
  5. Configuration Management - Maintaining optimal storage parameters across schemas