Tải bản đầy đủ (.pdf) (22 trang)

Tài liệu oracle data dictionary docx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (138.05 KB, 22 trang )

Oracle Data Dictionary
10
Introduction to Oracle: SQL and PL/SQL Using Procedure Builder10Ć2
Schedule: Timing Topic
20 minutes Lecture
15 minutes Practice
35 minutes Total
Class Management Note:
Files required for this lesson are:
Demonstration: l10tab.sql, l10obj2.sql, l10cons.sql
Practice: None
Oracle Data Dictionary 10Ć3
Objectives
The Oracle data dictionary is one of the most important components of the
Oracle7 Server. It consists of a set of tables and views that provide a read-only
reference to the database.
At the end of this lesson, you should be able to
D
Describe the data dictionary views a user may access.
D
Query data from the data dictionary.
Introduction to Oracle: SQL and PL/SQL Using Procedure Builder10Ć4
Oracle Data Dictionary 10Ć5
Overview
The Oracle data dictionary is one of the most important components of the Oracle7
Server. It is created when a database is created. Whenever the database is in
operation, the data dictionary is updated and maintained by the Oracle7 Server. All
data dictionary tables are owned by the SYS user. The base tables are rarely accessed
directly because the information in them is not easy to understand. Therefore, users
typically access data dictionary views because the information is presented in a
format that is easy for them to understand.


Tables Within the Oracle7 Database
Tables
Description
User tables Collection of tables created and maintained by the user,
such as S_EMP, that contain user information.
Data dictionary Collection of tables created and maintained by the Oracle7
Server, such as USER_OBJECTS, that contain information
about the database.
Example Data Dictionary Contents
D
Names of Oracle7 Server users
D
Privileges granted to users
D
Database object names (for example, tables, views, and indexes)
D
Table constraints
D
Auditing information, such as who has accessed or updated specified database
objects
Data Dictionary Uses
The data dictionary is a reference for all database users. It is a valuable source of
information for end users, application designers, and DBAs. The data dictionary is
also critical for the operation of the Oracle7 Server because the database relies on the
data dictionary to record and verify information about itself.
Introduction to Oracle: SQL and PL/SQL Using Procedure Builder10Ć6
Class Management Note:
The V$ views are initially accessible to the DBA. They are also special in
that they are not stored in disk files, but are based on information constantly
held in memory. In order for users to view the V$ tables, the DBA must

assign them to the MONITORER role.
Oracle Data Dictionary 10Ć7
Querying the Data Dictionary
You can query the data dictionary by issuing a SQL SELECT statement. Depending
on your privileges, you can query various views.
View Classes
Data dictionary view names reflect their intended use. There are four categories of
views; each category has a distinct prefix.
Prefix
Description
USER_ Contains objects owned by the user. For example, views with this prefix
allow the user to display information about tables created by the user and
privileges granted by the user.
ALL_ Accesses objects to which the user has been granted access rights, in
addition to objects owned by the user.
DBA_ Allows users with the DBA privilege to access any object in the
database.
V$ Displays database server performance and locking. Initially available
only to the DBA.
Additional Views
Several data dictionary views do not use the prefixes listed above. These include
synonyms for views with long names.
View Name
Description
DICTIONARY Lists all data dictionary tables, views, and synonyms.
TABLE_PRIVILEGES Grants on objects for which the user is the grantor,
grantee, or owner.
IND Is a synonym for USER_INDEXES.
Introduction to Oracle: SQL and PL/SQL Using Procedure Builder10Ć8
Class Management Note:

DEMO: l10tab.sql
PURPOSE: Display all tables owned by the user.
DEMO: l10obj2.sql
PURPOSE: Display all objects owned by the user based on a supplied
value. This script uses a substitution parameter and the UPPER function so
that you can enter only part of the object type and to make the comparison
case-insensitive.
1.Enter: START l10obj2
2.At the prompt for the object, enter: tab
3.Execute the file again. At the prompt, enter: seq
4.Edit the file to show students the SELECT statement.

×