Lesson 3 | Data dictionary views |
Objective | Name several data dictionary views and their purpose. |
Oracle Data Dictionary Views and Meta-data
Oracle Data Dictionary records metadata
Oracle maintains a
data dictionary that records metadata about
- each object,
- the object owner,
- a definition, and
- related privileges.
For objects that require
physical storage space of their own, Oracle will allocate space within a tablespace. Tablespaces can be either dictionary managed or locally managed. In a dictionary-managed tablespace, space management is recorded in the data dictionary. In a locally managed tablespace (the default), Oracle maintains a bitmap in each datafile of the tablespace to track space availability.Only quotas are managed in the data dictionary, dramatically reducing the contention for data dictionary tables. Prior to performing a direct upgrade, you should analyze the data dictionary tables. During the upgrade process to Oracle Database 11g, the data dictionary will be analyzed if it has not been analyzed already, so performing this step in advance will aid the performance of the upgrade.
- Aliases in View Creation
Internally, Oracle works with all column and table names in uppercase. This is how they are stored in its data dictionary, and this is how it always expects them to be. When aliases are typed to create a view, they should always exist without quotation marks around them. Putting double quotation marks around an alias can force the column name stored internally by Oracle to be in mixed case. If you do this, Oracle will not be able to find the column when you execute a select unless you enclose the column name within quotes during all your queries.
Never use double quotation marks in creating aliases for a view.
Data Dictionary Views
The following table lists a few of the hundreds of data dictionary views available to you.
Data dictionary view name |
Description |
ALL_CATALOG |
All tables, views, and synonyms that the current user is allowed to access |
ALL_USERS |
This includes names of all Oracle users. This view is available to the Database Administrator. Passwords are never displayed. |
DBA_CONSTRAINTS |
All constraints in the database |
DBA_ROLES |
All roles that exist in the database |
USER_CATALOG |
Tables, sequences, views, and other objects owned by the current user |
USER_ROLE_PRIVS |
Roles assigned to the current user |
USER_TAB_COL_STATISTICS |
Low, high, and average values in a table's columns |
USER_TAB_PRIVS |
Privileges granted to the current user |
USER_TAB_PRIVS_MADE |
Privileges granted to others by the current user |
USER_TABLES |
This shows tables owned by the current user. This view includes statistics such as the number of rows and space allocated and space used. |
USER_TYPES |
Object types created by the current user |
You can use the DESC command within SQL*Plus to display a list of the columns contained in any table or view, including the above data dictionary views. In the next lesson, you will begin looking at database tables using SQL*Plus.
The following text discusses five data dictionary views that can be answered by that view.
Five Data Dictionary views
This page shows the elements of five data dictionary views .
The correct matches are:
ALL_CATALOG
, What tables can I access that were created by other Oracle users?
DBA_ROLES
, How many roles were created in the entire database?
-
USER_ROLE_PRIVS
, What roles do I have assigned to me?
USER_TAB_COL_STATISTICS
, In my DAILY_SALES
table, what is the average value in the column called TOTAL_SALES
?
-
USER_TAB_PRIVS_MADE
, Did I grant the SELECT
privilege to the MANAGER
role?
- Dictionary Cache Concepts:
Information stored in the data dictionary cache includes
- usernames,
- segment information,
- profile data,
- tablespace information, and
- sequence numbers.
The dictionary cache also stores descriptive information, or metadata, about schema objects.
Oracle uses this metadata when parsing SQL cursors or during the compilation of PL/SQL programs
[1]Meta-data: Information (data) about database structures. For example, the meta-data about a table includes its name, its column names, and the tablespace in which it resides.
