Saturday, January 13, 2018

Data Dictionary

data_dict09

The Oracle data dictionary is the metadata of the database and contains the names and attributes of all objects in the database. The creation or modification of any object causes an update to the data dictionary that reflects those changes. This information is stored in the base tables that are maintained by the Oracle database, but you access these tables by using predefined views rather than reading the tables directly.
data_dictionary01
The data dictionary:
  • Is used by the Oracle database server to find information about users, objects, constraints,and storage
  • Is maintained by the Oracle database server as object structures or definitions are modified
  • Is available for use by any user to query information about the database
  • Is owned by the SYS user
  • Should never be modified directly using SQL
The Data Dictionary consists of two components:

Base Tables: These tables store descriptions of objects in the database.
  • These are the first objects created in the data dictionary.These are created when the oracle RDBMS software runs a special script named sql.bsq when a database is created by the CREATE DATABASE command – you do not see the sql.bsq script execute, but it does.
    You should never attempt to write to these tables – never use DML commands to attempt to update base tables directly.
    An example Base Table is IND$ that stores index information.
User-Accessible Views: These views summarize information in the base tables in order to make the information easier for a DBA to use.
  • These views are created by the catalog.sql script.
  • Using the Oracle Universal Installer to create a database, then the catalog.sql and catproc.sql scripts are run automatically.
  • An example data dictionary user-accessible view is TABS – it stores information about tables you create as a system user. TABS is a synonym for the view ALL_TABLES.
The Data Dictionary stores information about all database objects created by system users and information systems professionals including tables, views, indexes, clusters, procedures, functions, synonyms, sequences, triggers and the like. For each object, the Data Dictionary stores:
  • Disk space allocation (usually in bytes).
  • Integrity constraint information.
  • Default values for columns.
  • Oracle user names (accounts)
  • Privilege and role information for users.
  • Auditing information – who has accessed/updated objects.
Data Dictionary Usage

The Data Dictionary is used by the Oracle RDBMS as illustrated in the figure shown below.
views
DBA: These views display information about objects stored in all schemas (a schema is a logical organization of objects belong to an individual system user). These views are named DBA_xxx where xxx is the object name.Because these views belong to the DBA and were created by the owner SYS so these views not access by public .
Example:
SELECT owner, object_name, object_type
FROM SYS.DBA_OBJECTS;

ALL: These views display "all" information that an individual user of the database is authorized to access – this will include information about your objects as well as information about objects for which you have access permissions.
If you connect to the database, the ALL_xxx views will display all information about objects of all database schemas (if you have access permissions).
SELECT owner, object_name, object_type FROM ALL_OBJECTS;
USER: These views display information that you would most likely want to access.
  • These USER_xxx views refer to your own objects in your own schema.
  • These views display only rows pertinent to you as a user.
  • These views are a subset of the ALL views.
  • These rows do not usually display the OWNER column.
            SELECT object_name, object_type  FROM USER_OBJECTS;
In general, Data Dictionary Views answer questions about:
  • when an object was created,
  • Is the object part of another objects,
  • who owns the object,
  • what privileges do you have as a system user,what restrictions are on an object.
Practice selecting information from the following three views: dba_objects, all_objects, user_objects. You may wish to use the SQL*Plus command DESC to describe the views.Additional queries you may wish to execute to practice accessing parts of the data dictionary:
SELECT table_name, comments
FROM dictionary
WHERE table_name LIKE '%SEGMENTS%';

Dynamic Performance Tables and Views

The Oracle Server records database activity to the Dynamic Performance Tables.
These are complemented by Dynamic Performance Views - virtual tables that exist only in memory when the database is running.
  • The tables provide real-time condition information about database operation.
  • DBAs use these tables—most ,users should not be able to access these tables.
  • The tables cannot be altered – they are fixed and are owned by the user SYS.
  • All Dynamic Performance Tables have names that begin with the letters V_$.
  • Views of these tables are created along with synonyms that begin with the letters V$.
  • Information about the database's datafiles and information about all of the dynamic performance tables and views.

Examples Dynamic Performance Table views:
V$CONTROLFILE: Lists the names of the control files
V$DATABASE: Contains database information from the control file.
V$DATAFILE: Contains datafile information from the control file
V$INSTANCE: Displays the state of the current instance
V$PARAMETER: Lists parameters and values currently in effect for the session
V$SESSION: Lists session information for each current session
V$SGA: Contains summary information on the system global area (SGA)
V$SPPARAMETER: Lists the contents of the SPFILE
V$TABLESPACE: Displays tablespace information from the control file
V$THREAD: Contains thread information from the control file
V$VERSION: Version numbers of core library components in the Oracle server

The DUAL Table

Oracle maintains a table named DUAL that is used by Oracle and by user programs to produce a guaranteed known result such as the production of a value through use of an Oracle defined function.
The table has one column named DUMMY and one row containing the value X.
SYS owns the DUAL table, but all users can select from it.
Selecting from DUAL is useful for computing a constant expression with a SELECT statement, since DUAL has only one row, the constant is returned only once.
Example
SQL> select 1+4 from dual;
       1+4
----------
         5


How the Data Dictionary Is Used

Oracle (internally) accesses information about users, schema objects, and storage structures.
This is done to validate a query executed by a system user.
Validates permission and security.
Verifies that referenced objects in queries actually exist.
Oracle modifies the data dictionary for each DDL statement executed.
Oracle users access the data dictionary as a read-only reference.

General Overview
– DICTIONARY, DICT_COLUMNS

• Schema objects
– DBA_TABLES, DBA_INDEXES, DBA_TAB_COLUMNS,
DBA_CONSTRAINTS

• Space allocation
– DBA_SEGMENTS, DBA_EXTENTS

• Database structure
– DBA_TABLESPACES, DBA_DATA_FILES

Modifying the Data Dictionary:

Only Oracle (SYS) should ever modify the data dictionary.During upgrades to new release versions of the Oracle RDBMS, scripts are provided to upgrade the data dictionary.

14 comments:

  1. Good blog .The important thing is that in this blog content written clearly and understandable. The content of information is very informative. oracle training in chennai

    ReplyDelete
  2. Want to set your career towards Python? Then Infycle is with you to make this into your life. Infycle Technologies gives the best Python Training in Chennai, with 100% hands-on training guided by professional teachers in the field. In addition to this, placement guidance will be given to the candidates to face the interviews without struggles. Apart from all, the candidates will be placed in the top MNC's with a great salary package. To get it all, call 7502633633 and make this happen for your happy life.Best Python Training in Chennai | Infycle Technologies

    ReplyDelete
  3. Sharing the same interest, Infycle feels so happy to share our detailed information about all these courses with you all! Do check them out
    Best Hadoop training in chennai & get to know everything you want to about software trainings.

    ReplyDelete
  4. Reach to the best
    Data Science Training institute in Chennai
    for skyrocketing your career, Infycle Technologies. It is the best Software Training & Placement institutes in and around Chennai. that also gives the best placement training for personality tests, interview preparation, and mock interviews for leveling up the candidate's grades to a professional level.

    ReplyDelete
  5. Reach to the best
    Data Science Training institute in Chennai
    for skyrocketing your career, Infycle Technologies. It is the best Software Training & Placement institutes in and around Chennai. that also gives the best placement training for personality tests, interview preparation, and mock interviews for leveling up the candidate's grades to a professional level.

    ReplyDelete
  6. Finish the Get Big Data Certification in Chennai from Infycle Technologies, the best software training institute in Chennai which is providing professional software courses such as Data Science, Artificial Intelligence, Java, Hadoop, Selenium, Android, and iOS Development, etc with 100% hands-on practical training. Dial 7502633633 to get more info and a free demo and to grab the certification for having a peak rise in your career.

    ReplyDelete
  7. Grab the extraordinary Oracle Course with PLSQL from Infycle Technologies, the best software training institute in Chennai. Infycle offers the Best Oracle PLSQL Training in Chennai, with various IT demanding courses such as Big Data, Python, DevOps, Selenium, Full-Stack development, etc., in complete hands-on practical training with professional tutors in the field. In addition to that, the mock interviews will be done for the candidates so that they can face the interviews with total confidence. To have all these within your hands, call 7502633633 for having a free demo.

    ReplyDelete
  8. Infycle Technologies, the No.1 software training institute in Chennai offers the No.1 Big Data Hadoop training in Chennai for students, freshers, and tech professionals. Infycle also offers other professional courses such as DevOps, Artificial Intelligence, Cyber Security, Python, Oracle, Java, Power BI, Selenium Testing, Digital Marketing, Data Science, etc., which will be trained with 200% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7502633633 to get more info and a free demo. No.1Big Data Hadoop Training in Chennai | Infycle Technologies

    ReplyDelete
  9. Infycle Technologies, the top software training institute and placement center in Chennai offers the Best Digital Marketing course in Chennai for freshers, students, and tech professionals at the best offers. In addition to Digital Marketing, other in-demand courses such as DevOps, Data Science, Python, Selenium, Big Data, Java, Power BI, Oracle will also be trained with 100% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7504633633 to get more info and a free demo.

    ReplyDelete
  10. Infycle Technologies, the best software training institute in Chennai offers excellent Big Data Hadoop training in Chennai for students, freshers, and tech professionals. Infycle also offers other professional courses such as Java, DevOps, Artificial Intelligence, Cyber Security, Python, Oracle, Java, Power BI, Selenium Testing, Digital Marketing, Data Science, etc., which will be trained with 100% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7504633633 to get more info and a free demo.Get Big Data Hadoop Training in Chennai | Infycle Technologies

    ReplyDelete
  11. Don’t follow your role model. Be the Role model person for others. But it's so simple by getting Hadoop training in Chennai. Because it is an assurance course to bounce back from a double salary. For joining call 7502633633.

    ReplyDelete
  12. Learn Amazon Web Services for excellent job opportunities from Infycle Technologies, the Excellent AWS Training in Chennai. Infycle Technologies gives the most trustworthy AWS course in Chennai, with full hands-on practical training from professional trainers in the field. Along with that, the placement interviews will be arranged for the candidates, so that, they can meet the job interviews without missing them. To transform your career to the next level, call 7502633633 to Infycle Technologies and grab a free demo to know more

    ReplyDelete
  13. Very Interesting Post! I regularly follow this kind of Blog.
    Importance of Customized Software.

    ReplyDelete