oracle data dictionary. what is data dictionary the oracle data dictionary is one of the most...

10
Oracle Data Dictionary

Upload: iris-sullivan

Post on 22-Dec-2015

226 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

Oracle Data Dictionary

Page 2: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

What Is Data Dictionary

• The oracle data dictionary is one of the most important components of the oracle DBMS

• It contains all information about the structures and objects of the database such as tables,columns, users, data files etc.

• The data stored in the data dictionary are also often called metadata

• Information in the data dictionary is written by ORACLE

Page 3: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

Data Dictionary Views •The views provided by the data dictionary

are divided into three groups: USER, ALL,and DBA

• The group name builds the prefix for each view name

Page 4: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

USER data dictionary• USER: Taples in the USER views contain information

about objects owned by the account performing the SQL query (current user)

• USER_TABLES contains a description of the user’s own relational tables.TABLE_NAME, TABLESPACE_NAME, CLUSTER_NAME,……

Statement: select TABLE_NAME from USER_TABLES;• USER_INDEXES all information about indexes created for tables. INDEX_NAME, INDEX_TYPE, TABLE_OWNER,

TABLE_NAME,…..Statement: select INDEX_NAME, TABLE_NAME from

USER_INDEXES;

Page 5: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

USER data dictionary

• USER_TAB_COLUMNS columns of the tables and views owned by the user.

TABLE_NAME, COLUMN_NAME, DATA_LENGTH, DATA_TYPE,……

Statement: select COLUMN_NAME, TABLE_NAME from USER_TAB_COLUMNS;

• USER_USERS information about the current user.USERNAME, USER_ID, ACCOUNT_STATUS,

LOCK_DATE, EXPIRY_DATE, DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, CREATED, EXTERNAL_NAME.Statement: select USER_ID from USER_USERS;

Page 6: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

USER data dictionary• USER_TAB_PRIVILEGES contain information on

grants on objects for which the user is the owner, grantor, or grantee.

GRANTEE, OWNER, TABLE_NAME, GRANTOR, PRIVILEGE, GRANTABLE.

Statement: select TABLE_NAME from USER_TAB_PRIVS;

Page 7: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

ALL data dictionary

• ALL: Rows in the ALL views include rows of the USER views and all information about objects that are accessible to the current user. The structure of these views is analogous to the structure of the USER views.

• ALL_TABLES contain descriptions of relational tables accessible to the user.

OWNER, TABLE_NAME, TABLESPACE_NAME,……..Statement: select TABLE_NAME from ALL_TABLES;

• ALL_INDEXES all information about indexes created for tables.

OWNER, INDEX_NAME, TABLE_OWNER, TABLE_NAME, TABLESPACE_NAME,……..

• Statement: select INDEX_NAME, TABLE_NAME from ALL_INDEXES;

Page 8: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

ALL data dictionary• ALL_TAB_COLUMNS list the columns of all tables

and views accessible to the user.OWNER, TABLE_NAME, COLUMN_NAME,

DATA_TYPE,……Statement: select COLUMN_NAME, TABLE_NAME from

ALL_TAB_COLIMNS;• ALL_USERS information about all users of the

database.USERNAME, USER_ID, CREATED.Statement: select USERNAME from ALL_USERS;• ALL_TAB_PRIVS list the grants on objects for which

the user is grantee.GRANTEE, TABLE_NAME, GRANTOR, PRIVILEGE,

GRANTABLE.Statement: select TABLE_NAME from

ALL_TAB_PRIVS;

Page 9: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

DBA Data Dictionary• DBA : The DBA views encompass information about

all database objects, regardless of the owner. Only users with DBA privileges can access these views.

• DBA _TABLES contain descriptions of all relational tables in the database.

OWNER, TABLE_NAME, TABLESPACE_NAME,……..Statement: select TABLE_NAME from DBA_TABLES;• DBA _INDEXES contain descriptions for all indexes

in the database OWNER, INDEX_NAME, TABLE_OWNER,

TABLE_NAME,……..Statement: select TABLE_NAME from DBA_INDEXES;

Page 10: Oracle Data Dictionary. What Is Data Dictionary The oracle data dictionary is one of the most important components of the oracle DBMS It contains all

DBA Data Dictionary• DBA _TAB_COLUMNS contain information which describe

columns of all tables, views.OWNER, TABLE_NAME, COLUMN_NAME, DATA_TYPE,

……Statement: select TABLE_NAME from DBA_TAB_COLIMNS;• DBA _USERS lists information about all users of the

database.USERNAME, USER_ID, PASSWORD, CREATED,……..Statement: select USERNAME from DBA_USERS;• DBA _TAB_PRIVS lists all grants on objects in the

database.GRANTEE, OWNER, TABLE_NAME, GRANTOR,

PRIVILEGE, GRANTABLE.Statement: select TABLE_NAME from DBA_TAB_PRIVS;