打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
[Laskey99] Chapter 14. The Oracle Data Dictionary

Chapter 14. The Oracle Data Dictionary

data dictionary is a collection oftables and related views that enable you to see the inner workingsand structure of the Oracle database. By querying these tables andviews, you can obtain information about every object and every userof the database. For example, you can determine the amount of I/O toeach datafile, the values of the INIT.ORAparameters, and much more. All of the Oracle monitoring tools look atthe information available in the data dictionary and present it in aneasy-to-use format.

Traditionally, the data dictionary has consisted of a series of viewsowned by SYS. These views, known as static data dictionaryviews, present information contained in tablesthat are updated when Oracle processes a DDL statement. The SYStables and views, as well as a set of public synonyms for the views,are all created by the catalog.sql script. Inaddition, the installation of some Oracle features creates tables andviews in the SYSTEM schema. In general, tables and views owned bySYSTEM exist to support functionality provided by PL/SQL storedprocedures rather than fundamental Oracle functionality.

An additional set of views is composed of the dynamicperformance data dictionaryviews,commonly referred to as the V$ views(or, mistakenly, as the V$ tables). TheseV$ views are based on a set of internal memory structures maintainedby Oracle as virtual tables, which all begin with an "X$"prefix. Just as the static data dictionary views provide informationabout the database, the V$ views and the underlyingX$ tables provide information about theinstance.

Table 14.1 distinguishes between the types ofinformation you will find in the static data dictionary views and inthe dynamic performance data dictionary views.

Table 14.1. Basic Data Dictionary Divisions
If You Need to Find Information About... Use These Data Dictionary Views
Database objects Static data dictionary views
Instance objects Dynamic performance data dictionary views
Database data files Static data dictionary views
Archive log files Dynamic performance data dictionary views
Users allowed to access the database Static data dictionary views
Users currently connected to the database Dynamic performance data dictionary views

14.1. Static Data Dictionary Views

The static data dictionary views haveexisted in their current format since Oracle Version 6. These areviews owned by SYS that are built upon tables owned by SYS and giveyou the ability to find information about database objects. Table 14.2 shows which static data dictionary viewsshould be used to find specific types of information.

Table 14.2. Static Data Dictionary Views
If You Need to Find Information About... Use These Data Dictionary Views
Objects owned by you Views that begin with USER_
Objects to which you have been granted access Views that begin with ALL_
All objects in the database Views that begin with DBA_
Tables DBA_TABLES

DBA_NESTED_TABLES

DBA_OBJECT_TABLES

DBA_PART_TABLES

DBA_TAB_COMMENTS

DBA_TAB_PARTITIONS

DBA_TAB_HISTOGRAMS
Columns DBA_CLU_COLUMNS

DBA_COLL_TYPES

DBA_COL_COMMENTS

DBA_COL_PRIVS

DBA_CONS_COLUMNS

DBA_IND_COLUMNS

DBA_TAB_COL_STATISTICS

DBA_TAB_COLUMNS

DBA_TRIGGER_COLS

DBA_UPDATABLE_COLUMNS
Views DBA_VIEWS
Tablespaces DBA_TABLESPACES

DB_TS_QUOTAS

DBA_DATA_FILES
Constraints DBA_CONSTRAINTS DBA_CONS_COLUMNS
Indexes DBA_INDEXES

DBA_IND_COLUMNS

DBA_PART_INDEXES

DBA_IND_PARTITIONS
Auditing DBA_AUDIT_TRAIL

DBA_AUDIT_SESSION

DBA_EXITS

DBA_AUDIT_OBJECT

DBA_AUDIT_STATEMENT
Procedures/packages DBA_SOURCE

ALL_ARGUMENTS

DBA_ERRORS

DBA_OBJECT_SIZE

DBA_LIBRARIES

PUBLIC_DEPENDENCIES
Snapshots DBA_REGISTERED_SNAPSHOTS

DBA_SNAPSHOT_LOGS

DBA_SNAPSHOT_REFRESH_TIMES

DBA_SHAPSHOT_LOG_FILTER_COLS

DBA_SNAPSHOTS
Sequences DBA_SEQUENCES

14.1.1. Families of Views

Most of the data dictionary isconstructed in a matrix fashion. The first way to categorize datadictionary views is by the breadth of information they cover. Viewscan be divided into four groups:

  • Views that allow you to see objects you own. Most of these views begin with USER_.

  • Views that allow you to see objects that you own or that were granted to you. Most of these views begin with ALL_.

  • Views that allow you to see all objects in the database. These are primarily for use by the DBA. Most of these views begin with DBA_.

  • A handful of other views that provide information of general interest about the database.

The second way to categorize data dictionary views is by content.Many of the USER_, ALL_, and DBA_ views are grouped in families,according to how their view names end (e.g., TABLES, COLUMNS, and soon). Groups of views provide information about various topics,including:

  • Tables

  • Storage

  • Columns

  • Views

  • Objects

  • Networking objects

As this is a book for DBAs, in this chapter we'll concentrateon the DBA_ views and the other views of interest to DBAs. The ALL_views have the same structure as the DBA_ views. The USER_ views havethe same structure as the DBA_ views with the exception that they donot include the OWNER column.

14.1.2. Commonly Used Data Dictionary Views

This section summarizes the static data dictionary views you'llcommonly use. Views are divided into functional categories andarranged alphabetically by category.

14.1.2.1. Advanced Queuing

These views provide information about themessage queues:


DBA_QUEUE_SCHEDULES

Shows when particular queued messages are to be delivered.


DBA_QUEUE_TABLES

Lists the tables used to hold the queues defined as part of theAdvanced Queuing facility.


DBA_QUEUES

Lists the queues defined as part of the Advanced Queuing facility.

14.1.2.2. Audit trail

These views (and some tables)provide information about the status of auditing and the actual audittrail. For further information, see Chapter 7.


ALL_DEF_AUDIT_OPTS

Lists the default auditing options in effect for new objects.


AUDIT_ACTIONS

Lists the audit codes and descriptions.


DBA_AUDIT_EXISTS

Contains audit trail information generated by AUDIT EXISTS and AUDITNOEXISTS.


DBA_AUDIT_OBJECT

Contains audit trail information for object auditing.


DBA_AUDIT_SESSION

Contains audit trail information for all connects and disconnectsfrom the instance.


DBA_AUDIT_STATEMENT

Contains audit trail information for all audited statements.


DBA_AUDIT_TRAIL

Contains all audit trail information. The other DBA_AUDIT_ views aresubsets of this view.


DBA_OBJ_AUDIT_OPTS

Lists all object auditing options in effect.


DBA_PRIV_AUDIT_OPTS

Lists all system privilege auditing options in effect.


DBA_STMT_AUDIT_OPTS

Lists all statement auditing options in effect.


STMT_AUDIT_OPTION_MAP

Lists the valid SQL statements that can be specified for statementauditing.


SYSTEM_PRIVILEGE_MAP

Lists the valid system privileges that can be specified for systemprivilege auditing.


TABLE_PRIVILEGE_MAP

Lists the valid object audit options that can be specified for schemaobject auditing.

14.1.2.3. Constraints

These views provide information aboutconstraints and columns included in the constraints:


DBA_CONS_COLUMNS

Shows which columns are affected by each constraint.


DBA_CONSTRAINTS

Lists all constraints defined in the database.

14.1.2.4. Dictionary

These views provide informationabout the objects in the data dictionary:


DBA_CATALOG

Lists all tables, views, sequences, and synonyms in the database.


DBA_DEPENDENCIES

Lists dependencies between database objects. Used to determine whichobjects become invalid after other objects are altered or dropped.


DBA_OBJECTS

Lists all objects in the database. Note that this name predates theObjects Option and is not restricted to objects created using theObjects Option.


DICT_COLUMNS

Lists all columns defined in the data dictionary views.


DICTIONARY

Lists all data dictionary views.

14.1.2.5. Indexes

These views provide information aboutindexes and indexed columns:


DBA_IND_COLUMNS

Lists all indexed columns.


DBA_INDEXES

Lists all indexes.


INDEX_HISTOGRAM

Contains information about the distribution of index keys within thetable. Populated for one index at a time by the ANALYZE INDEX ...VALIDATE STRUCTURE command.


INDEX_STATS

Contains information about the structure of an index. Populated forone index at a time by the ANALYZE INDEX ... VALIDATE STRUCTUREcommand.

14.1.2.6. Jobs

These views provide information about thejob queues managed by the Oracle built-in DBMS_ JOBS package. These jobqueues are used by the replication facilities and by OracleEnterprise Manager, but are available for use by any application.


DBA_ JOBS

Lists all jobs defined.


DBA_ JOBS_RUNNING

Lists all currently running jobs.

14.1.2.7. Large objects (LOBs)

These views provide information aboutlarge objects (LOBs):


DBA_DIRECTORIES

Lists all defined external directories. Directories are where BFILEsare stored.


DBA_LOBS

Lists all large objects defined in the database.

14.1.2.8. Locks

These views provide information about thecurrent status of locks in the database:


DBA_BLOCKERS

Lists all sessions holding locks for whose release others are waiting.


DBA_DDL_LOCKS

Lists all existing DDL locks.


DBA_DML_LOCKS

Lists all existing DML locks.


DBA_KGLLOCK

Lists all KGL (library cache) locks in the database.


DBA_LOCK_INTERNAL

Contains internal information for each lock defined in DBA_LOCKS.


DBA_LOCKS

Lists all locks held or requested in the database.


DBA_WAITERS

Lists all sessions that are waiting on a lock held by another session.


DBMS_LOCK_ALLOCATED

Shows which locks the current user has allocated.

14.1.2.9. Net8

These views provide information about thestatus of Net8 and remote databases. See Chapter 5, for more details on the use andimplementation of Net8.


DBA_2PC_NEIGHBORS

Contains information about the commit point for distributedtransactions listed in DBA_2PC_PENDING.


DBA_2PC_PENDING

Lists information about distributed transactions requiring recovery.


DBA_DB_LINKS

Lists all database links.


DBA_PENDING_TRANSACTIONS

Contains further information used by XA for distributed transactionslisted in DBA_2PC_PENDING.


GLOBAL_NAME

Shows the value of the global name. Can be used to determine whichdatabase the application is connected to.


TRUSTED_SERVERS

Specifies which servers have been identified as trusted.

14.1.2.10. Objects Option

These views provideinformation relating to objects created using Oracle's ObjectsOption:


DBA_COLL_TYPES

Lists collection types created.


DBA_METHOD_PARAMS

Lists all parameters for methods defined in DBA_TYPE_METHODS.


DBA_METHOD_RESULTS

Lists all method results for methods defined in DBA_TYPE_METHODS.


DBA_NESTED_TABLES

Lists all nested tables created using features from the ObjectsOption.


DBA_OBJECT_TABLES

Lists all tables created using features from the Objects Option.


DBA_REFS

Lists the REF columns and attributes for objects.


DBA_TYPE_ATTRS

Lists attributes of all types.


DBA_TYPE_METHODS

Lists methods created to support each type defined in DBA_TYPES.


DBA_TYPES

Lists all types created.

14.1.2.11. Partitioning

These views provide information aboutpartitioned tables and indexes:


DBA_IND_PARTITIONS

Lists all index partitions. There is one row for each index partition.


DBA_PART_COL_STATISTICS

Contains distribution information about partitioned columns that havebeen analyzed; comparable to DBA_TAB_COL_STATISTICS for partitionedtables.


DBA_PART_HISTOGRAMS

Contains information about histograms created on individualpartitions.


DBA_PART_INDEXES

Lists all partitioned indexes. There is one row for each partitionedindex.


DBA_PART_KEY_COLUMNS

Lists the partition key columns for all partitions.


DBA_PART_TABLES

Lists all partitioned tables. There is one row for each partitionedtable.


DBA_TAB_PARTITIONS

Lists all table partitions. There is one row for each table partition.

14.1.2.12. PL/SQL

These views provide information about PL/SQL functions, procedures,packages, and triggers:


ALL_ARGUMENTS

Lists all valid arguments for stored procedures and functions.


DBA_ERRORS

Shows all errors from compiling objects.


DBA_LIBRARIES

Lists the external libraries that can be called from PL/SQL packages,procedures, and functions.


DBA_OBJECT_SIZE

Shows the size of the compiled code for each PL/SQL package,procedure, function, and trigger.


DBA_SOURCE

Shows PL/SQL source for packages, procedures, and functions.


DBA_TRIGGER_COLS

Lists columns that are referenced in triggers.


DBA_TRIGGERS

Shows PL/SQL code for database triggers.


PUBLIC_DEPENDENCY

Lists dependencies using only object numbers.

14.1.2.13. Security

These views provide informationabout users and grants. Please refer to Chapter 6,for more details on security.


DBA_COL_PRIVS

Lists all column grants made in the database.


DBA_PROFILES

Lists all defined profiles.


DBA_ROLE_PRIVS

Lists all roles granted to users and to other roles.


DBA_ROLES

Lists all roles.


DBA_SYS_PRIVS

Shows which system privileges have been assigned to which users.


DBA_TAB_PRIVS

Shows all object privileges. Includes not only tables but also views,sequences, packages, procedures, and functions.


DBA_USERS

Lists all users.


RESOURCE_COST

Shows the assigned cost of each resource for composite limits.


RESOURCE_MAP

Maps profile resource numbers to resource names.


ROLE_ROLE_PRIVS

Lists roles granted to other roles. A subset of DBA_ROLE_PRIVS.


ROLE_SYS_PRIVS

Lists system privileges granted to roles. A subset of DBA_SYS_PRIVS.


ROLE_TAB_PRIVS

Lists table grants granted to roles. A subset of DBA_TAB_PRIVS.


SESSION_PRIVS

Shows which system privileges are active for the current session.


SESSION_ROLES

Shows which roles are active for the current session


USER_PASSWORD_LIMITS

Shows the password limits in effect for the current session. There isno corresponding DBA_PASSWORD_LIMITS.

14.1.2.14. Sequences

This view provides information about sequences:


DBA_SEQUENCES

Lists all sequences in the database.

14.1.2.15. Server management

These views provideinformation about the current status of the database:


NLS_DATABASE_PARAMETERS

Shows the National Language Support (NLS) parameters in effect at thedatabase level.


NLS_INSTANCE_PARAMETERS

Shows the NLS parameters in effect at the instance level.


NLS_SESSION_PARAMETERS

Shows the NLS parameters in effect at the session level.


PRODUCT_COMPONENT_VERSION

Shows the current release level of all installed Oracle options.


SM$VERSION

Oracle version level packaged for Server Manager to use.

14.1.2.16. Storage

These views provide information aboutinternal storage in the database, including datafiles, tablespaces,free extents, used extents, and segments:


DBA_DATA_FILES

Lists all data files in use by the database.


DBA_EXTENTS

Lists every allocated extent for every segment.


DBA_FREE_SPACE

Lists every free extent. With DBA_EXTENTS, should account for allstorage in DBA_DATA_FILES.


DBA_FREE_SPACE_COALESCED

Lists every extent that is at the start of a block of free extents.


DBA_ROLLBACK_SEGS

Lists all rollback segments.


DBA_SEGMENTS

Lists all segments.


DBA_TABLESPACES

Lists all tablespaces.


DBA_TS_QUOTAS

Shows the granted quota and used storage in tablespaces by user.

14.1.2.17. Synonyms

This view provides information about synonyms:


DBA_SYNONYMS

Lists all synonyms in the database.

14.1.2.18. Tables, clusters, and views

These views provide information abouttables, clusters, and views:


DBA_ALL_TABLES

Lists all object and relational tables.


DBA_CLU_COLUMNS

Lists all cluster keys.


DBA_CLUSTER_HASH_EXPRESSIONS

Lists the hash values used for the optional cluster hash indexes.


DBA_CLUSTERS

Lists all clusters in the database.


DBA_COL_COMMENTS

Shows comments on all table and view columns.


DBA_TAB_COL_STATISTICS

Contains column information about analyzed columns. This is a subsetof the information available in DBA_TAB_COLUMNS.


DBA_TAB_COLUMNS

Shows all table and view columns.


DBA_TAB_COMMENTS

Shows all comments on tables and views.


DBA_TAB_HISTOGRAMS

Shows all table histograms.


DBA_TABLES

Shows all relational tables.


DBA_UPDATABLE_COLUMNS

Lists columns in views with joins that can be updated.


DBA_VIEWS

Shows all views.

14.1.2.19. Others

These other views and tables are used by individual users:


CHAINED_ROWS

Populated by the ANALYZE TABLE command to show all chained rows in atable. Created using the utlchain.sql script.


EXCEPTIONS

Contains a list of all rows that have a constraint violation.Populated when attempting to create or enable a constraint. Createdusing the utlexcpt.sql script.


PLAN_TABLE

Used by the EXPLAIN_PLAN process to show theexecution plan for a SQL statement. Created using theutlxplan.sql script.

14.1.3. Other Static Data Dictionary Views

The following views show important information about the structure ofthe database, but are normally not referenced by DBAs directly. Theyare listed here for completeness.

14.1.3.1. Advanced replication

These views provide information used by Oracle'sadvancedreplication facilities. Oracle currently recommends using theReplication Manager to obtain the information in these views.

DBA_ANALYZE_OBJECTS
DBA_REGISTERED_SNAPSHOT_GROUPS
DBA_REPAUDIT_ATTRIBUTE
DBA_REPAUDIT_COLUMN
DBA_REPCAT
DBA_REPCATLOG
DBA_REPCOLUMN
DBA_REPCOLUMN_GROUP
DBA_REPCONFLICT
DBA_REPDDL
DBA_REPGENERATED
DBA_REPGENOBJECTS
DBA_REPGROUP
DBA_REPGROUPED_COLUMN
DBA_REPKEY_COLUMNS
DBA_REPOBJECT
DBA_REPPARAMETER_COLUMN
DBA_REPPRIORITY
DBA_REPPRIORITY_GROUP
DBA_REPPROP
DBA_REPRESOL_STATS_CONTROL
DBA_REPRESOLUTION
DBA_REPRESOLUTION_METHOD
DBA_REPRESOLUTION_STATISTICS
DBA_REPSCHEMA
DBA_REPSITES
DEFCALLDEST
14.1.3.2. Export

These views provide information to the Export and Import utilities. Pleaserefer to Chapter 4, for more information on theseviews.

DBA_EXP_FILES
DBA_EXP_OBJECTS
DBA_EXP_VERSION
14.1.3.3. Gateways

These views provide information needed to support foreign datasources (FDSs) or data gateways:

HS_ALL_CAPS
HS_ALL_DD
HS_ALL_INITS
HS_BASE_CAPS
HS_BASE_DD
HS_CLASS_CAPS
HS_CLASS_DD
HS_CLASS_INIT
HS_EXTERNAL_OBJECT_PRIVILEGES
HS_EXTERNAL_OBJECTS
HS_EXTERNAL_USER_PRIVILEGES
HS_FDS_CLASS
HS_FDS_INST
HS_INST_CAPS
HS_INST_DD
HS_INST_INIT
14.1.3.4. Oracle Parallel Server

These views provide information about the status of the OracleParallel Server environment:

FILE_LOCK
FILE_PING
14.1.3.5. Remote procedure calls

These views provide information about the status of remote procedurecalls (RPCs):

DEFCALL
DEFDEFAULTDEST
DEFERRCOUNT
DEFERROR
DEFLOB
DEFPROPAGATOR
DEFSCHEDULE
DEFTRAN
DEFTRANDEST
ORA_KGLR7_DB_LINKS
ORA_KGLR7_DEPENDENCIES
ORA_KGLR7_IDL_CHAR
ORA_KGLR7_IDL_SB4
ORA_KGLR7_IDL_UB1
ORA_KGLR7_IDL_UB2
14.1.3.6. Snapshots

These views provide information about snapshots:

DBA_RCHILD
DBA_REFRESH
DBA_REFRESH_CHILDREN
DBA_REGISTERED_SNAPSHOTS
DBA_RGROUP
DBA_SNAPSHOT_LOGS
DBA_SNAPSHOT_REFRESH_TIMES
DBA_SNAPSHOTS
14.1.3.7. SQL*Loader

These views provide information used by theSQL*Loader direct pathoption:

LOADER_CONSTRAINT_INFO
LOADER_FILE_TS
LOADER_PARAM_INFO
LOADER_PART_INFO
LOADER_TAB_INFO
LOADER_TRIGGER_INFO
14.1.3.8. Tablespace point-in-time recovery

These views provide information required for tablespacepoint-in-time recovery. See Chapter 4, for more information on these views.

STRADDLING_RS_OBJECTS
TS_PITR_CHECK
TS_PITR_OBJECTS_TO_BE_DROPPED
14.1.3.9. Trusted Oracle

This view provides information required by theTrusted Oracle product:

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Oracle从10g升级到11g详细步骤
Oracle Golden Gate 系列十一
Oracle数据库迁移:异构传输表空间TTS HP-UX迁移至Redhat Linux 7.7
ORACLE Nologging相关知识
ORA-12154 ORA-12500 TNS:could not resolve service name
Advise and Consent
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服