Oracle Data Dictionary or System Meta Data

  •  Data Dictionary is a set of read-only tables and views that contain information about the database’s structure, including details on schemas, users, privileges, and system settings. 
  • It is created when the database is first set up and is automatically updated when database objects are created, altered, or dropped.
  • All data dictionary tables and views for a database are stored in the SYSTEM tablespace. Because the SYSTEM tablespace is always online when the database is open, the data dictionary is always available when the database is open.
  • Database user account SYS owns all base tables and user-accessible views of the data dictionary.

data dictionary contains information such as

  1. The definitions of every schema object in the database, including default values for columns and integrity constraint information
  2. The amount of space allocated for and currently used by the schema objects
  3. The names of Oracle Database users, privileges and roles granted to users, and auditing information related to users

Base Tables: These store information about the database. Only Oracle Database should write to and read these tables. Users rarely access the base tables directly because they are normalized, and most data is stored in a cryptic format.

Data Dictionary Views: These are views built on the base tables and provide an interface for users to query metadata. These are usually prefixed with USER_, ALL_, or DBA_.

Types of Data Dictionary Views:

  1. Static Views
  2. Dynamic Views or Dynamic Performance Views
  3. Global Dynamic Performance Views

Static View:

automatically updated when database objects are created, altered, dropped, or perform DDL operation.

1.USER Views - information about database objects that are owned by the current user.
Examples: USER_TABLES, USER_INDEXES

2.ALL Views - information about objects to which the user has access, regardless of ownership.
Examples: ALL_TABLES, ALL_TAB_COLUMNS

3.DBA Views - information about all objects in the database. Only users with DBA privileges can access these views.
Examples: DBA_TABLES, DBA_USERS, DBA_TAB_PRIVS

Dynamic  Views or Dynamic Performance Views:

  • Oracle Database maintains a set of virtual tables that record current database activity. 
  • These views are dynamic because they are continuously updated while a database is open and in use. 
  • The views are sometimes called V$ views because their names begin with V$. 
  • Dynamic performance views are called fixed views because they cannot be altered or removed by a database administrator. 
  • Read consistency is not guaranteed for the views because the data is updated dynamically.

Dynamic performance views contain information such as ,

  1. System and session parameters
  2. Memory usage and allocation
  3. File states (including RMAN backup files)
  4. Progress of jobs and tasks
  5. SQL execution
  6. Statistics and metrics

The dynamic performance views have the primary uses:

  • Oracle Enterprise Manager uses the views to obtain information about the database.
  • Administrators can use the views for performance monitoring and debugging.

Example:
SELECT name FROM V$FIXED_TABLE WHERE NAME LIKE 'V$%';

List:

General Information:

V$DATABASE - Displays database information such as database name, creation time, etc.
V$INSTANCE - Provides information about the current instance.
V$VERSION - Shows version numbers of core Oracle components.
V$PARAMETER - Displays current values of initialization parameters.

Sessions and Users:

V$SESSION - Displays session information for each current session.
V$PROCESS - Shows information about the currently running processes.
V$SESS_IO - Provides I/O statistics for user sessions.
V$SESSION_WAIT - Displays the events for which active sessions are waiting.
V$SESSION_LONGOPS - Displays the status of long-running operations.

Memory and Buffer Cache:

V$SGA - Displays the size of the System Global Area (SGA).
V$SGASTAT - Provides detailed statistics on the SGA memory usage.
V$DB_CACHE_ADVICE - Provides advice on the effects of modifying the database buffer cache size.
V$BUFFER_POOL - Displays information on the buffer pools in the instance.
V$CACHE - Provides information about the usage of the database buffer cache.

Performance:

V$SYSSTAT - Displays system statistics.
V$SYSTEM_EVENT - Shows a summary of all wait events in the system.
V$WAITSTAT - Provides block contention statistics.
V$SQLAREA - Displays statistics for shared SQL areas.
V$SQL - Provides information on SQL statements in the shared pool.
V$LATCH - Displays latch statistics.
V$LOCK - Shows locking information for sessions.

I/O and Storage:

V$DATAFILE - Provides datafile information.
V$TEMPFILE - Displays information about temporary files.
V$CONTROLFILE - Lists all control files associated with the database.
V$LOG - Shows redo log file information.
V$ARCHIVED_LOG - Provides details about archived redo logs.
V$TABLESPACE - Displays tablespace information.
V$FILESTAT - Gives I/O statistics for each datafile.
V$TEMPSTAT - Displays I/O statistics for temporary tablespaces.

ASM (Automatic Storage Management):

V$ASM_DISK - Provides information on ASM disks.
V$ASM_DISKGROUP - Displays ASM disk group information.
V$ASM_CLIENT - Shows clients using ASM.
V$ASM_OPERATION - Displays ongoing ASM operations.

Backup and Recovery:

V$BACKUP - Displays information about datafile backups.
V$BACKUP_REDOLOG - Shows redo log backup information.
V$RECOVERY_FILE_DEST - Provides information about the Flash Recovery Area.
V$RESTORE_POINT - Lists restore points in the database.
V$FLASH_RECOVERY_AREA_USAGE - Displays usage of the Flash Recovery Area.

Global Dynamic Performance Views:

  • which are essentially the RAC (Real Application Clusters) equivalent of the V$ views. They provide information across all instances in a clustered environment. 
  • Each GV$ view has a corresponding V$ view, with an additional INST_ID column that indicates the instance from which the data originates.

SELECT name FROM V$FIXED_TABLE WHERE NAME LIKE 'GV$%';

List:

General Information:

GV$DATABASE - Provides database information for all instances in the cluster.
GV$INSTANCE - Shows information about all instances in the cluster.
GV$VERSION - Displays the version information for Oracle components across instances.
GV$PARAMETER - Displays initialization parameters for all instances.

Sessions and Users:

GV$SESSION - Displays session information for all sessions across all instances.
GV$PROCESS - Shows processes running on all instances.
GV$SESS_IO - Provides I/O statistics for user sessions across instances.
GV$SESSION_WAIT - Displays events for which active sessions are waiting across instances.
GV$SESSION_LONGOPS - Shows the status of long-running operations across all instances.

Memory and Buffer Cache:

GV$SGA - Provides information on the size of the System Global Area (SGA) across instances.
GV$SGASTAT - Displays detailed statistics on the SGA usage across instances.
GV$DB_CACHE_ADVICE - Provides advice on modifying the database buffer cache size across instances.
GV$BUFFER_POOL - Displays information about buffer pools in all instances.
GV$CACHE - Provides information on the usage of the database buffer cache across instances.

Performance:

GV$SYSSTAT - Displays system statistics for all instances.
GV$SYSTEM_EVENT - Shows a summary of all wait events across instances.
GV$WAITSTAT - Displays block contention statistics across all instances.
GV$SQLAREA - Provides statistics for shared SQL areas across instances.
GV$SQL - Shows SQL statements in the shared pool across all instances.
GV$LATCH - Displays latch statistics across all instances.
GV$LOCK - Displays lock information for sessions across all instances.

I/O and Storage:

GV$DATAFILE - Provides datafile information for all instances.
GV$TEMPFILE - Shows information about temporary files across instances.
GV$CONTROLFILE - Lists all control files for the entire cluster.
GV$LOG - Displays redo log information across all instances.
GV$ARCHIVED_LOG - Provides information about archived redo logs across instances.
GV$TABLESPACE - Displays tablespace information across instances.
GV$FILESTAT - Shows I/O statistics for each datafile across instances.
GV$TEMPSTAT - Displays I/O statistics for temporary tablespaces across instances.

ASM (Automatic Storage Management):

GV$ASM_DISK - Displays information about ASM disks across instances.
GV$ASM_DISKGROUP - Shows ASM disk group information across instances.
GV$ASM_CLIENT - Displays clients using ASM across instances.
GV$ASM_OPERATION - Provides details on ongoing ASM operations across instances.

Backup and Recovery:

GV$BACKUP - Shows datafile backup information across instances.
GV$BACKUP_REDOLOG - Displays redo log backup information across instances.
GV$RECOVERY_FILE_DEST - Provides information about the Flash Recovery Area across instances.
GV$RESTORE_POINT - Lists restore points across instances.
GV$FLASH_RECOVERY_AREA_USAGE - Shows Flash Recovery Area usage across instances.

Other Views:

1. SESSION_PRIVS - Lists the privileges that have been granted to the user session.
SELECT * FROM SESSION_PRIVS;
2. DICTIONARY - Provides a listing of all Oracle dictionary tables and views.
SELECT * FROM DICTIONARY;
3. DICT_COLUMNS - Details the columns present in the data dictionary views.
SELECT * FROM DICT_COLUMNS;
4. TABLE_PRIVILEGES - lists the privileges on tables that are available to the current user.
SELECT * FROM TABLE_PRIVILEGES;

Multi-tenant Architecture Views:

View Name

Description

Scope

CDB_TABLES

Displays information about all tables across CDB and PDBs.

All containers

CDB_USERS

Shows information about users across all PDBs and the CDB root.

All containers

CDB_PDBS

Lists all PDBs in the CDB and their statuses.

Container-level

CDB_DATA_FILES

Provides information on all data files in the containers.

All containers

CDB_VIEWS

Lists all views in both the CDB and PDBs.

All containers

CDB_SEGMENTS

Information on storage segments in all containers.

All containers

CDB_TAB_COLUMNS

Provides column information for tables in the CDB and PDBs.

All containers

CDB_TEMP_FILES

Displays information about temporary files in all PDBs and the CDB root.

All containers

CDB_CONSTRAINTS

Displays constraints across all tables in both the CDB and PDBs.

All containers

CDB_IND_COLUMNS

Provides details about indexed columns across all containers.

All containers

CDB_LOBS

Displays LOBs (large objects) in the CDB and all PDBs.

All containers

CDB_ROLE_PRIVS

Shows role privileges granted across all containers.

All containers

CDB_SYS_PRIVS

Lists system privileges granted to users and roles across the containers.

All containers

X$ views:

  • X$ views in Oracle are internal tables that directly expose data from Oracle’s internal memory structures. As they are undocumented and primarily intended for Oracle kernel diagnostics, they should be used cautiously. 
  • These tables are the foundation for many of the dynamic performance views (V$ views) and provide low-level access to the database’s internal workings.

SELECT * FROM V$FIXED_TABLE WHERE NAME LIKE 'X$%';

X$ Table Name

Description

Associated V$ View / Usage

Example Query

X$KSUSE

Stores information about user sessions

V$SESSION

SELECT * FROM X$KSUSE WHERE ROWNUM < 10;

X$KSMSS

Memory usage statistics for shared pool and other areas

V$SGASTAT

SELECT * FROM X$KSMSS WHERE ROWNUM < 10;

X$KCBFWAIT

Tracks buffer cache waits

Performance diagnostics on buffer cache contention

SELECT * FROM X$KCBFWAIT WHERE ROWNUM < 10;

X$KCBWBPD

Information about dirty buffers in the buffer cache

Buffer cache management and tuning

SELECT * FROM X$KCBWBPD WHERE ROWNUM < 10;

X$KCCRT

Redo thread information

V$THREAD, V$LOG

SELECT * FROM X$KCCRT WHERE ROWNUM < 10;

X$KSQST

Enqueue (lock) statistics

V$LOCK, diagnosing locking issues

SELECT * FROM X$KSQST WHERE ROWNUM < 10;

X$KSPPI

Initialization parameter information

V$PARAMETER, V$SPPARAMETER

SELECT * FROM X$KSPPI WHERE ROWNUM < 10;

X$KSDPF

Datafile information

V$DATAFILE

SELECT * FROM X$KSDPF WHERE ROWNUM < 10;

X$KTATL

Transaction table information for undo segments

Monitoring transactions and undo segments

SELECT * FROM X$KTATL WHERE ROWNUM < 10;

X$LE

Lock elements, provides lock tracking

Lock activity diagnostics

SELECT * FROM X$LE WHERE ROWNUM < 10;

X$KTUXC

Transaction control structures

V$TRANSACTION

SELECT * FROM X$KTUXC WHERE ROWNUM < 10;

X$KSMSP

Shared pool memory allocations

Shared pool memory tuning and management

SELECT * FROM X$KSMSP WHERE ROWNUM < 10;

X$KTIFN

Free buffer waits

Buffer cache tuning to reduce wait times

SELECT * FROM X$KTIFN WHERE ROWNUM < 10;

X$KCFIO

Disk I/O operations

Diagnosing disk I/O performance issues

SELECT * FROM X$KCFIO WHERE ROWNUM < 10;

X$KGLRD

Library cache information

SQL statement caching, related to the shared pool

SELECT * FROM X$KGLRD WHERE ROWNUM < 10;


Check All Data Dictionary Views: https://docs.oracle.com/cd/E11882_01/nav/catalog_views.htm


Comments