zoukankan      html  css  js  c++  java
  • The Data Dictionary

    Introduction to the Data Dictionary

    One of the most important parts of an Oracle database is its data dictionary, which is a ready-only set of tables that provides information about the database. A data dictionary contains:

    - The definitions of all schema objects in the database (tables, views, indexes, clusters, synonyms, sequences, procedures, functions, packages, triggers, and so on)

    - How much space has been allocated for, and is currently used by, the schema objects.

    - Default values for columns

    - The names of Oracle users

    - Privileges and roles each user has been granted

    - Auditing information, such as who has accessed or updated various schema objects

    - Other general database information

    The data dictionary is structured in tables and views, just like other database data. All the data dictionary tables and views for a given database are stored in that database's SYSTEM tablespace.

    Not only is the data dictionary central to every Oracle database, it is an important tool for users, from end users to application designers and database administrators. Use SQL statements to access the data dictionary. Because the data dictionary is read only, you can issue only queries (SELECT statements) against it's tables and views.

    Structure of the Data Dictionary

    The data dictionary consists of the following:

    Base Tables - The underlying tables that store information about the associated database. Only Oracle should write to 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 views that summarize and display the information stored in the base tables of the data dictionary. These views decode the base table data into useful information, such as user or table names, using joins and WHERE clauses to simplify the information. Most users are given access to the views rather than the base tables.

    SYS, Owner of the Data Dictionary The Oracle user SYS owns all base tables and user-accessible views of the data dictionary. No Oracle user should ever alter (UPDATE, DELETE, or INSERT) any rows or schema objects contained in the SYS schema, because such activity can compromise data integrity. The security administrator must keep strict control of this central account.

    How the Data Dictionary Is Used the data dictionary has three primary uses:

    - Oracle accesses the data dictionary to find information about users, schema objects, and storage structures.

    - Oracle modifies the data dictionary every time that a data definition language (DDL) statement is issued.

    - Any Oracle user can use the data dictionary as a read-only reference for information about the database.

    How Oracle Uses 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.Oracle provides scripts to modify the data dictionary tables when a database is upgraded or downgraded.

    During database operation, Oracle reads the data dictionary to ascertain that schema 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.

    - Public Sysnonyms for Data Dictionary Views Oracle creates public synonyms for many data dictionary views so users can access them conveniently. The security administrator can also create additional public synonyms for schema objects that are used systemwide. Users should avoid naming their own schema objects with the same names as those used for public synonyms.

    - Cache the Data Dictionary for Fast Access Much of the data dictionary information is kept in the SGA in the dictionary cache, because Oracle constantly accesses the data dictionary during database operation to validate user access and to verify the state of schema objects. All information is stored in memory using the least recently used(LRU) algorithm.

    - Other Programs and the Data Dictionary Other Oracle products can reference existing views and create additional data dictionary tables or views of their own. 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.

    How to Use the Data Dictionary

    The views of the data dictionary serve as a reference for all database users. Access the data dictionary view with SQL statements. Some views are accessible to all Oracle users, and others are intended for database 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:

    Views with the Prefix USER

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

    - Refer to the user's own private environment in the database, including information about schema objects created by the user, grants made by the user, and so on

    - Display only rows pertinent to the user

    - Have columns identical to the other views, except that the column OWNER is implied.

    - Return a subset of the information in the ALL views

    - Can have abbreviated PUBLIC synonyms for convenience

    e.g: SELECT objecvt_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 schema objects to which the user has access through public or explicit grants o fprivileges an roles, in addition to schema 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 FROM ALL_OBJECTS;

    Views with the Prefix DBA

    Views with the prefix DBA show a global view of the entire database. Synonyms are not created for these views, because DBA views should be queried only by administrators. Therefore, to query the DBA views, adminstrators must prefix the view name with its owner, SYS, as in the following:

    SELECT owner, object_name FROM SYS.DBA_OBJECTS;

    Oracle recommends that you implement data dictionary protection to prevent users having the ANY system privileges from using such privileges on the data dictionary. If you enable dictionary protection (07_DICTIONARY_ACCESSIBILITY is false), then access to objects in the SYS schema (dictionary objects) is restricted to users with the SYS schema. These users are SYS and those who connect as SYSDBA.

    The DUAL Table

    The table named DUAL is a small table in the data dictionary that Oracle and user-written programs can reference to guarantee a known result. This table has one column called DUMMY and one row containing the value X.

    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.

    Dynamic performance tables are not true tables, and 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. These views are somethimes called fixed views because they cannot be altered or removed by the database administrator..

    SYS owns the dynamic performance tables; their names all begin with V_$. Views are create on these tables, and then public synonyms are created for the views. The synonym names begin with V$. For example, the V$DATAFILE view contains information about the dtabase's datafiles, and the V$FIXED_TABLE view contains information about all of the dynamic performance tables and views in the database.

  • 相关阅读:
    【原】费马小定理(Fermat little theorem)详解
    【原】水库抽样详解
    【原】模幂运算(Modular Exponentiation)算法
    【原】 POJ 3630 Phone List Trie树 解题报告
    【Joke】你可以去当程序员了
    【原】 POJ 3750 小孩报数问题 Joseph相关问题详解 解题报告
    【原】 POJ 3748 位操作 解题报告
    react 性能优化
    修改jsp文件,访问时没有变化。可能是修改了系统的时间,,,郁闷呢
    在Windows 7 下使用Visual Studio 2010 编写自动申请管理员权限运行的程序
  • 原文地址:https://www.cnblogs.com/landexia/p/2757962.html
Copyright © 2011-2022 走看看