Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

   
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 

 

 

Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation

 

 


 

 

 

        
 

 Oracle DBMS_SPACE
Oracle Tips by Burleson Consulting

Advanced Oracle Utilities: The Definitive Reference by Rampant TechPress is written by the top Oracle database experts (Bert Scalzo, Donald Burleson, and Steve Callan).  The following is an excerpt from the book.

DBMS_SPACE

 

The dbms_space package provides a collection of procedures and functions to assist with the analysis of segment growth and space needs. This package can greatly assist with the key DBA task commonly referred to as capacity planning. There are a few enumerated constants that one must know to use this package:

 

OBJECT_TYPE_TABLE                  constant positive := 1;

OBJECT_TYPE_NESTED_TABLE           constant positive := 2;

OBJECT_TYPE_INDEX                  constant positive := 3;

OBJECT_TYPE_CLUSTER                constant positive := 4;

OBJECT_TYPE_LOB_INDEX              constant positive := 5;

OBJECT_TYPE_LOBSEGMENT             constant positive := 6;

OBJECT_TYPE_TABLE_PARTITION        constant positive := 7;

OBJECT_TYPE_INDEX_PARTITION        constant positive := 8;

OBJECT_TYPE_TABLE_SUBPARTITION     constant positive := 9;

OBJECT_TYPE_INDEX_SUBPARTITION     constant positive := 10;

OBJECT_TYPE_LOB_PARTITION          constant positive := 11;

OBJECT_TYPE_LOB_SUBPARTITION       constant positive := 12;

OBJECT_TYPE_MV                     constant positive := 13;

OBJECT_TYPE_MVLOG                  constant positive := 14;

OBJECT_TYPE_ROLLBACK_SEGMENT       constant positive := 15;

 

Asa_recommendations is a function that returns the findings from the automatic segment advisor. However, note that this requires proper OEM licensing; namely, that the optional OEM Diagnostics Pack has been purchased. It returns that information as type dbms_space. asa_reco_row_tb,  as shown below.

 

Argument

Type

In / Out

Default Value

ALL_RUNS

VARCHAR2

IN

TRUE

SHOW_MANUAL

VARCHAR2

IN

TRUE

SHOW_FINDINGS

VARCHAR2

IN

FALSE

Table 6.117:  Asa_recommendations Parameters

type asa_reco_row is record (

  tablespace_name       varchar2(30),

  segment_owner         varchar2(30),

  segment_name          varchar2(30),

  segment_type          varchar2(18),

  partition_name        varchar2(30),

  allocated_space       number,

  used_space            number,

  reclaimable_space     number,

  chain_rowexcess       number,

  recommendations       varchar2(1000),

  c1                    varchar2(1000),

  c2                    varchar2(1000),

  c3                    varchar2(1000),

  task_id               number,

  mesg_id               number

);

 

type asa_reco_row_tb is table of asa_reco_row;

 

Create_index_cost is a procedure that calculates or estimates the storage required to create an index on an existing table.

 

Argument

Type

In / Out

Default Value

DDL

VARCHAR2

IN

 

USED_BYTES

NUMBER

OUT

 

ALLOC_BYTES

NUMBER

OUT

 

PLAN_TABLE

VARCHAR2

IN

NULL

Table 6.118:  Create_index_cost Parameters

Create_table_cost is an overloaded procedure that calculates or estimates the storage required to create a new table. However, remember that the answer can vary widely based upon items such as tablespace storage attributes, tablespace block size, and such. Thus, create_table_cost offers two versions and/or methods of operation to provide for better estimates. The first method is based on the average row size and row count, and so this method is only as good as the estimates for those values.

 

Argument

Type

In / Out

Default Value

TABLESPACE_NAME

VARCHAR2

IN

 

AVG_ROW_SIZE

NUMBER

IN

 

ROW_COUNT

NUMBER

IN

 

PCT_FREE

NUMBER

IN

 

USED_BYTES

NUMBER

OUT

 

ALLOC_BYTES

NUMBER

OUT

 

Table 6.119:  Create_table_cost Parameters

The second create_table_cost method looks at the actual column properties like data type and size, and can often yield fairly reliable predictions. Note that the second parameter for column information requires using the create_table_cost_columns data type.

 

Argument

Type

In / Out

Default Value

TABLESPACE_NAME

VARCHAR2

IN

 

COLINFOS

SYS. CREATE_TABLE_COST_COLUMNS

IN

 

ROW_COUNT

NUMBER

IN

 

PCT_FREE

NUMBER

IN

 

USED_BYTES

NUMBER

OUT

 

ALLOC_BYTES

NUMBER

OUT

 

Table 6.120:  Create_table_cost_columns Parameters

type SYS.CREATE_TABLE_COST_COLINFO is object (

  col_type varchar(200),

  col_size number

);

 

type SYS.CREATE_TABLE_COST_COLUMNS is varray(50000) of create_table_cost_colinfo;

 

Free_blocks is a procedure that returns information about the free blocks in an object or segment. This represents all the free space and not just the free space above the high water mark. Use the scan_limit parameter only if one is interested in the question, "Are there X blocks on the free list?"

 

Argument

Type

In / Out

Default Value

SEGMENT_OWNER

VARCHAR2

IN

 

SEGMENT_NAME

VARCHAR2

IN

 

SEGMENT_TYPE

VARCHAR2

IN

 

FREELIST_GROUP_ID

NUMBER

IN

 

FREE_BLKS

NUMBER

OUT

 

SCAN_LIMIT

NUMBER

IN

NULL

PARTITION_NAME

VARCHAR2

IN

NULL

Table 6.121:  Free_blocks Parameters

     


Fo
r more details on Oracle utilities, see the book "Advanced Oracle Utilities" by Bert Scalzo, Donald K. Burleson, and Steve Callan.

You can buy it direct from the publisher for 30% off directly from Rampant TechPress.

Remote DBA Service
 

Oracle Tuning Book

 

Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

 

 

 

 

 

 

 

 

 

BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.