5-oracle-developer-tables-indexes-essentials-m5-slides
5-oracle-developer-tables-indexes-essentials-m5-slides
David Berry
http://buildingbettersoftware.blogspot.com/
Databases Require Changes Over Time
Oracle
Database Managing Managing
Data
Statistics Tables Columns
Dictionary
Series of views containing
Oracle Data metadata about all database
Dictionary objects in Oracle
Data Dictionary Course Content Focus
Definition
Contains An entry for every database object (table, view,
index, stored procedure, etc…)
Oracle Documentation http://bit.ly/Ora12cAllObjects
Key columns
object_name Name of the table, view, index, etc…
object_type Indicated if this object is a table, view, etc…
created Timestamp of when this object was created
last_ddl_time Timestamp of when the definition of this object was
last changed
status Indicated if the object is valid or invalid
USER_TABLES View
Definition
Contains One row for each table
Oracle Documentation http://bit.ly/Ora12cAllTables
Key columns
table_name Name of the table
num_rows Number of rows in the table
blocks Number of blocks that have been used in the table
avg_row_len Average length in bytes of a row in the table
last_analyzed Date that stats were most recently gathered against
the table
USER_TAB_COLS View
Definition
Contains An entry for every column in a table or a view
Oracle Documentation http://bit.ly/Ora12cAllTabCols
Key columns
table_name Name of the table or view the column belongs to
column_name Name of the column
data_type Data type of this column
num_distinct Number of distinct values in this column
num_nulls Number of rows in this column with a null value
USER_CONSTRAINTS View
Definition
Contains An entry for each constraint (primary key, foreign
key, check constraint)
Oracle Documentation http://bit.ly/Ora12cAllConstraints
Key columns
table_name Name of the table the constraint is associated with
constraint_name Name of the constraint
constraint_type Code that indicates the type of the constraint
r_constriant_name For foreign keys, the name of the unique constraint
in the parent table
deferrable Indicates if the constraint can be deferred
USER_INDEXES View
Definition
Contains An entry for each index
Oracle Documentation http://bit.ly/Ora12cAllindexes
Key columns
table_name Name of the table the index is on
index_name Name of index
uniqueness Indicated if this is a unique index
distinct_keys Number of distinct keys in the index
last_analyed Date that stats were most recently gathered against
the index
USER_IND_COLUMNS View
Definition
Contains An entry for each column in an index
Oracle Documentation http://bit.ly/Ora12cAllIndColumns
Key columns
table_name Name of the table the index is on
index_name Name of index
column_name Name of the column
column_position Position of the column in the index
Data Dictionary Summary
• Scheduled by Oracle
Automatically • Oracle detects objects with significant changes
• Executed by user
Manually • Used after large insert/delete operation
• Useful in test environments
Gathering Statistics Manually
http://bit.ly/Orac12cDbmsStats
Dropping a Table
Dependent
Tables
Foreign Keys and Dropping a Table