Oracle7 Server Concepts Manual Go to Product Documentation Library
Go to books for this product
Go to Contents for this book
Go to Index

Go to previous file in sequence Go to next file in sequence

The Data Dictionary

LEXICOGRAPHER -- A writer of dictionaries, a harmless drudge.

Samuel Johnson: Dictionary

This chapter describes the central set of read-only reference tables and views of each Oracle database, known collectively as the data dictionary. The chapter includes:

Not only is the data dictionary central to every Oracle database, it is an important tool for all users, from end users to application designers and database administrators. Even beginning users can benefit from understanding and using the data dictionary. However, no user should ever alter (update, delete, or insert) any rows or objects in the data dictionary; such activity can compromise data integrity.

An Introduction to the Data Dictionary

One of the most important parts of an Oracle database is its data dictionary. The data dictionary is a read-only set of tables that provides information about its associated database. For example, a data dictionary can provide the following information:

The data dictionary is structured in tables and views, just like other database data. To access the data dictionary, you use SQL. Because the data dictionary is read-only, users can issue only queries (SELECT statements) against the tables and views of the data dictionary.

The Structure of the Data Dictionary

A database's data dictionary is comprised of

base tables

The foundation of the data dictionary is comprised of a set of base or underlying tables that store information about the associated database. Only Oracle should write and read these tables; users rarely access them directly because they are normalized, and most of the data is stored in a cryptic format.

user accessible views

The data dictionary contains user accessible views that summarize and conveniently display the information in the base tables of the dictionary. The views decode the information in the base tables into useful information, such as user or table names, and use joins and WHERE clauses to simplify the information. Most users are given access to the views rather than the base tables.

SYS, the Owner of the Data Dictionary

The Oracle user SYS owns all base tables and user accessible views of the data dictionary. Therefore, no Oracle user should ever alter any object contained in the SYS schema and the security administrator should keep strict control of this central account.

Note: Altering or manipulating the data in underlying data dictionary tables can permanently and detrimentally affect the operation of a database.

How the Data Dictionary Is Used

The data dictionary has two primary uses:

How Oracle and Other Oracle Products Use the Data Dictionary

Data in the base tables of the data dictionary is necessary for Oracle to function. Therefore, only Oracle should write or change data dictionary information.

During database operation, Oracle reads the data dictionary to ascertain that objects exist and that users have proper access to them. Oracle also updates the data dictionary continuously to reflect changes in database structures, auditing, grants, and data.

For example, if user KATHY creates a table named PARTS, new rows are added to reflect the new table, columns, segment, extents, and the privileges that KATHY has on the table. This new information is then visible the next time the dictionary views are queried.

Caching of the Data Dictionary for Fast Access

Because Oracle constantly accesses the data dictionary during database operation to validate user access and to verify the state of objects, much of the data dictionary information is cached in the SGA. All information is stored in memory using the LRU (least recently used) algorithm. Information typically kept in the caches is that required for parsing. The COMMENTS columns describing the tables and columns are not cached unless they are frequently accessed.

Other Programs and the Data Dictionary

Other Oracle products can create additional data dictionary tables or views of their own and reference existing views. Application developers who write programs that refer to the data dictionary should refer to the public synonyms rather than the underlying tables: the synonyms are less likely to change between software releases.

Adding New Data Dictionary Items

You can add new tables or views to the data dictionary. If you add new data dictionary objects, the owner of the new objects should be the user SYSTEM or a third Oracle user. Never create new objects belonging to user SYS, except by running script provided by Oracle Corporation for creating data dictionary objects.

Deleting Data Dictionary Items

Because all changes to the data dictionary are performed by Oracle in response to DDL statements, no data in any data dictionary tables should be deleted or altered by any user.

The single exception to this rule is the table SYS.AUD$. When auditing is enabled, this table can grow without bound. Although you should not drop the AUDIT_TRAIL table, the security administrator can delete data from it because the rows are for information only and are not necessary for Oracle to run.

Public Synonyms for Data Dictionary Views

Public synonyms are created on many data dictionary views so they can be conveniently accessed by users. The security administrator can create additional public synonyms for objects used systemwide. However, other users should avoid naming their own objects with the same names as those used for public synonyms.

How Oracle Users Can Use the Data Dictionary

The views of the data dictionary serve as a reference for all database users. Access to the data dictionary views is via the SQL language. Certain views are accessible to all Oracle users, while others are intended for administrators only.

The data dictionary is always available when the database is open. It resides in the SYSTEM tablespace, which is always online.

The data dictionary consists of sets of views. In many cases, a set consists of three views containing similar information and distinguished from each other by their prefixes:

Prefix Scope
USER user's view (what is in the user's schema)
ALL expanded user's view (what the user can access)
DBA database administrator's view (what all users can access)
Table 8 - 1. Data Dictionary View Prefixes

The set of columns is identical across views with these exceptions:

Views with the Prefix USER

The views most likely to be of interest to typical database users are those with the prefix USER. These views

For example, the following query returns all the objects contained in your schema:

SELECT object_name, object_type FROM user_objects; 

Views with the Prefix ALL

Views with the prefix ALL refer to the user's overall perspective of the database. These views return information about objects to which the user has access via public or explicit grants of privileges and roles, in addition to objects that the user owns. For example, the following query returns information about all the objects to which you have access:

SELECT owner, object_name, object_type FROM all_objects; 

Views with the Prefix DBA

Views with the prefix DBA show a global view of the entire database. Therefore, they are meant to be queried only by database administrators. Any user granted the system privilege SELECT ANY TABLE can query the DBA-prefixed views of the data dictionary.

Synonyms are not created for these views, as the DBA views should only be queried by administrators. Therefore, to query the DBA views, administrators must prefix the view name with its owner, SYS, as in

SELECT owner, object_name, object_type FROM sys.dba_objects; 

Administrators can run the script file DBA_SYNONYMS.SQL to create private synonyms for the DBA views in their accounts if they have the SELECT ANY TABLE system privilege. Executing this script creates synonyms for the current user only.


The table named DUAL is a small table that Oracle and user-written programs can reference to guarantee a known result. This table has one column and one row.

The Dynamic Performance Tables

Throughout its operation, Oracle maintains a set of "virtual" tables that record current database activity. These tables are called dynamic performance tables.

Because dynamic performance tables are not true tables, they should not be accessed by most users. However, database administrators can query and create views on the tables and grant access to those views to other users.

SYS owns the dynamic performance tables and their names all begin with V_$. Views are created on these tables, and then synonyms are created for the views. The synonym names begin with V$.

Go to previous file in sequence Go to next file in sequence
Prev Next
Copyright © 1996 Oracle Corporation.
All Rights Reserved.
Go to Product Documentation Library
Go to books for this product
Go to Contents for this book
Go to Index