12.data Dictionary
12.data Dictionary
Nature of a Data Dictionary (DD) Rationale for a DD Structure of a DD Typical DD Contents Using SQL to View DD in Oracle grant and revoke Statements
A database contains information about entities of interest to users in an organization When created, the database itself becomes an entity about which information must be kept for various data administration purposes Data dictionary (or system catalog) is a database about the database Contents of a DD are commonly referred to as metadata DD can be updated, queried much as a regular database DBMS often maintains the DD
Nature of a DD
Rationale for a DD
Provides a summary of the structure of the database
helps DBA manage the database informs users of database scope
Facilitates communication between users and database administrators Allows the DBMS to manage the creation, access, and modification of tables and their components
Structure of a DD
DD can be integrated with the DBMS or stand-alone Relational systems all have some form of integrated DD (e.g., Oracle) Integrated DD is usually active, meaning it is automatically updated to reflect changes in the database A stand-alone DD is not directly linked to the database and must be updated manually
Typical DD Contents
Data elements
names, data type
Tables
owner, creation date, access specifications, size
Indexes
name, attributes involved, creation date
Authorized users
names, type(s) of access
Integrity Constraints
Sample query
select name, ctime from sys.obj$ where ctime > 01-feb-02;
View with
describe sys.col$
Sample query
select obj# from sys.col$ where upper(name) = city;
There are many additional system tables in the Oracle data dictionary
grant statement
connect, dba, resource
Several versions of grant statement connect: allows new users to have access to Oracle grant connect to jeff identified by pwxx4r; resource: allows users to create their own tables with all privileges (see later) on those tables grant resource to veda, greenthing; /* Assumes veda and greenthing exist dba: execute all commands on all database objects grant dba to mom, dick, mary identified by dad, ehsg, plymouth;
grant Statement
Table Privileges
Allows owner of a table to control access by other database users to data in the tables Types of access include select: allows users to select from specified table insert, delete, update, index, alter references: allows user to define foreign keys on specified table all: allows user all privileges specified above with grant option clause allows recipient to pass the privilege on
grant Statement
Table Privileges
grant insert on orders to paul with grant option; grant insert, delete, update on customers to marilyn; grant update (quantity) on products to anil; grant select on agents to public; /* Provides every user the privilege */