Data Dictionary Tables in RDBMS
Last Updated :
04 Jul, 2024
In a Relational Database Management System (RDBMS), a data dictionary is a collection of READ-ONLY tables and views that contain metadata about the database. It typically contains data about all users in the system, their assigned roles and privileges, database objects, their structure, relationship, integrity constraints, default values and storage space details, auditing information, and many more. Since, it is READ-ONLY mode, only SELECT operation can be done on tables in the Data Dictionary.
Oracle Data Dictionary Structure
Oracle DBMS's data dictionary is comprised of 2 types of objects:
- Base Tables: Base Tables are the foundation of the Data Dictionary. It contains information about the database to which it is associated. It is READ-only, and only the Oracle server or processing engine can access it Users can't access it. The data in that table are stored in normalized form and cryptic formats.
- User Accessible Views: formatsThe data dictionary also contains views that are accessible to the user. It contains the information about base tables in a convenient way. They are extracted decoded versions of the Base table which contains useful information like user or table names. Generally, all users have access to this, unlike Base tables.
Both these tables and views are owned by SYS. No user should edit it as it can adversely affect the database.
Uses of Data Dictionary
The Oracle engine accesses this data dictionary whenever a DDL statement is evaluated. It is essential for any database to function. Its uses include Database administration, Query Optimization, Metadata management, Security and access control, and much more.
User Accessible Views
Let's see how DBMS users can use these Data Dictionary views.
- User-accessible views can be viewed by all users using SQL query depending on the permission given by the Database Admin.
- Data Dictionary views are classified into three types by their prefixes. Each Prefix and its scope are presented in the table below.
Prefix | Scope |
---|
USER | can view only what is in USER's scheme (generally exclude column OWNER) |
ALL | Can view everything that the user can access |
DBA | Can view everything what maximum any user can access |
USER Views
The views with the prefix USER generally refer to views that contain data about a particular user's own object, which includes data about objects created by that user, grants made by that user, and so on.
It is generally a subset of ALL_views. It has only data related to the user and has columns similar to other views.
Examples:
Some Common Views with the prefix USER are:
USER_OBJECTS - view that contains data about all objects
(tables, views, indexes, procedures, and functions, etc.) owned by that particular user
USER_TAB_COLUMNS - view that contains data about the columns of all
tables and views owned by that particular user.
USER_TABLES - view that contains data about all tables owned by that particular user.
USER_VIEWS - view that contains data about all views owned by that particular user.
USER_CONSTRAINTS - view that contains data about all constraints
(primary keys, foreign keys, and unique constraints, etc.) owned by the particular user.
USER_SEQUENCES - view that contains data about all
sequences owned by that particular user.
USER_TRIGGERS - view that contains data about all triggers
owned by that particular user.
USER_INDEXES - view that contains data about all indexes owned by that particular user.
USER_SYNONYMS - view that contains data about all synonyms owned by that particular user.
USER_TAB_COMMENTS - view that contains comments on tables and views owned by that particular user.
Example Query To Access the Views
Query to print all the objects (name and type) in a user's scheme
Syntax:
SELECT object_name, object_type FROM user_objects;
Query to print all the data about all Tables owned by the user:
SELECT * FROM user_tables;
ALL Views
Views with the prefix ALL are views that contain data about not only objects owned by the user but also objects with access via public or explicit grants of privileges or roles.
Examples:
Some Common Views with the prefix ALL are:
ALL_OBJECTS - views that contains data about all objects (tables, views, indexes, procedures, etc..) in the database
ALL_TAB_COLUMNS - views that contains data about all columns in all the tables and views in the database
ALL_TABLES - views that contains data about all tables and views in the database
ALL_VIEWS - views that contains data about all views in the database in the database
ALL_USERS - Views that contains data about data about all users in the database
ALL_CONSTRAINTS - Views that contains data about all constraints
(primary keys, foreign keys, unique constraints, etc. ) in the database
ALL_SEQUENCES - View that contains data about all sequences in the database
ALL_INDEXES - Views that contains data about all indexes in the database
ALL_TRIGGERS - Views that contains data about about all triggers in the database
ALL_INDEXES: View that contains data about all indexes in the database.
ALL_SYNONYMS - Views that contains data about all synonyms in the database
Example:
Query to print all the objects (name and type) to which the user has access:
SELECT owner, object_name, object_type FROM all_objects;
Query to print all the data about all Tables to which the user has access:
SELECT * FROM all_views;
DBA Views
Views with the prefix DBA are views that are generally accessed only by the Database Administrators or any user who has got the system privilege SELECT ANY TABLE. It will have access to the OWNER column as well. The prefix is generally SYS followed by the table name.
The views are similar to the ALL and USER views
Example:
Query to print all the objects (name and type) in the DataBase:
SELECT owner, object_name, object_type FROM sys.dba_objects;
Similar Reads
SQL Interview Questions Are you preparing for a SQL interview? SQL is a standard database language used for accessing and manipulating data in databases. It stands for Structured Query Language and was developed by IBM in the 1970's, SQL allows us to create, read, update, and delete data with simple yet effective commands.
15+ min read
SQL Tutorial Structured Query Language (SQL) is the standard language used to interact with relational databases. Whether you want to create, delete, update or read data, SQL provides the structure and commands to perform these operations. SQL is widely supported across various database systems like MySQL, Oracl
8 min read
DBMS Tutorial â Learn Database Management System Database Management System (DBMS) is a software used to manage data from a database. A database is a structured collection of data that is stored in an electronic device. The data can be text, video, image or any other format.A relational database stores data in the form of tables and a NoSQL databa
7 min read
Introduction of ER Model The Entity-Relationship Model (ER Model) is a conceptual model for designing a databases. This model represents the logical structure of a database, including entities, their attributes and relationships between them. Entity: An objects that is stored as data such as Student, Course or Company.Attri
10 min read
Normal Forms in DBMS In the world of database management, Normal Forms are important for ensuring that data is structured logically, reducing redundancy, and maintaining data integrity. When working with databases, especially relational databases, it is critical to follow normalization techniques that help to eliminate
7 min read
ACID Properties in DBMS In the world of DBMS, transactions are fundamental operations that allow us to modify and retrieve data. However, to ensure the integrity of a database, it is important that these transactions are executed in a way that maintains consistency, correctness, and reliability. This is where the ACID prop
8 min read
Introduction of DBMS (Database Management System) A Database Management System (DBMS) is a software solution designed to efficiently manage, organize, and retrieve data in a structured manner. It serves as a critical component in modern computing, enabling organizations to store, manipulate, and secure their data effectively. From small application
8 min read
SQL Query Interview Questions SQL or Structured Query Language, is the standard language for managing and manipulating relational databases such as MySQL, Oracle, and PostgreSQL. It serves as a powerful tool for efficiently handling data whether retrieving specific data points, performing complex analysis, or modifying database
15+ min read
CTE in SQL In SQL, a Common Table Expression (CTE) is an essential tool for simplifying complex queries and making them more readable. By defining temporary result sets that can be referenced multiple times, a CTE in SQL allows developers to break down complicated logic into manageable parts. CTEs help with hi
6 min read
DBMS Architecture 1-level, 2-Level, 3-Level A database stores important information that needs to be accessed quickly and securely. Choosing the right DBMS architecture is essential for organizing, managing, and maintaining the data efficiently. It defines how users interact with the database to read, write, or update information. The schema
7 min read