oracle 数据库字典指南:

oracle 数据库字典指南:

oracle的数据字典存储用来管理数据库中对像的所有信息。

除了某些特殊情况,oracle的数据字典对象的名称都以下面的3个前缀开头:USER、ALL或者DBA。

由system 访问的v$ 视图实际上指向的是V_$视图的同义词,v_$视图是原始的v$视图的视图,而原始的V$视图则建立在X$表的基础之上。

能在v$视图上的操作只有select,如果要授权其他用户访问v$视图,只能通过授权基础v_$视图权限。

不能授予用户直接访问v$视图:
SQL> grant select on v$session to scott;
grant select on v$session to scott
                *
ERROR at line 1:
ORA-02030: can only select from fixed tables/views

只能通过授权v_$视图:
SQL> grant select on v_$session to scott;

Grant succeeded.



user:视图中记录的是当前登录用户的所拥有的的对象信息;
ALL: 包含了user记录和其权限已经授予PUBLIC或者用户的对象信息;
DBA: 包含所以的数据库对象,而不论所有者是谁,对大多数数据库对象来说,以上user,all,dba视图都是可用的。

1. USER_CATALOG(CAT) 目录视图

USER_CATALOG 的公有(public权限)同义词CAT

USER_CATALOG 视图记录了当前用户所拥有的所有表、视图、同义词和序列信息,USER_CATALOG 也可以被共有同义词CAT引用。

select count(*) from sys.USER_CATALOG;
select count(*) from sys.dba_CATALOG;
select count(*) from sys.all_CATALOG;
select * from sys.CAT;  (注意同义词需要大写,但是视图不需要)

USER_CATALOG:当前用户所有的表、视图、同义词和序列信息(只有两列);
dba_CATALOG: 当前用户和PUBLIC用户和当前用户能够访问的所有的表、视图、同义词和序列信息;
all_CATALOG: 数据库中用户所有的表、视图、同义词和序列信息

TABLE_NAME:表、视图、同义词或者序列的名称
TABLE_TYPE:类型(SEQUENCE、table或者VIEW等)
OWER:所有者

2 user_objects(OBJ) 对象信息视图

user_catalog目录只显示表、视图、序列和同义词的信息,要检索关于所有对象的类型的信息,可以查询user_objects(OBJ)

user_objects 的公有(public权限)同义词OBJ

user_objects视图包含许多类型的对象,包括集群、数据库链接、目录、函数、索引、库、程序包、程序包体、java类、抽象数据库类型、资源计划、序列、同义词、表、触发器、物化视图、LOB和视图。

字段:
   OBJECT_NAME: 对象名称
   SUBOBJECT_NAME
   OBJECT_ID,
   DATA_OBJECT_ID,
   OBJECT_TYPE,
   CREATED: 对象的创建时间
   LAST_DDL_TIME:跟对象相关的(不一定是改变对象的结构,也可以是其他相关,如,如果此对象是                   表,则将该表的select权限赋给其他用户也会改变这个字段的值)最后ddl操作的                   执行时间
   TIMESTAMP: 对象自身结构发生改变的时间,比如删除字段、添加字段等
   STATUS: 
   TEMPORARY,
   GENERATED,
   SECONDARY,
   NAMESPACE,
   EDITION_NAME

USER_objects:当前用户所有的对象信息(只有两列);
dba_objects: 当前用户和PUBLIC用户和当前用户能够访问的所有的对象信息;
all_objects: 数据库中用户所有的对象信息

image-20210423150307247

Column Datatype Description 描述
OWNER VARCHAR2(128) Owner of the object 对象的所有者
OBJECT_NAME VARCHAR2(128) Name of the object 对象名称
SUBOBJECT_NAME VARCHAR2(128) Name of the subobject (for example, partition) 子对象的名称(例如,分区)
OBJECT_ID NUMBER Dictionary object number of the object 对象的字典对象编号
DATA_OBJECT_ID NUMBER Dictionary object number of the segment that contains the object. 包含对象的段的字典对象编号。
Note: OBJECT_ID and DATA_OBJECT_ID display data dictionary metadata. Do not confuse these numbers with the unique 16-byte object identifier (object ID) that Oracle Database assigns to row objects in object tables in the system. 注意:OBJECT_ID和DATA_OBJECT_ID显示数据字典元数据。请勿将这些数字与Oracle数据库分配给系统中对象表中行对象的唯一16字节对象标识符(对象ID)混淆。
OBJECT_TYPE VARCHAR2(23) Type of the object (such as TABLE, INDEX) 对象的类型(例如TABLE,INDEX)
CREATED DATE Timestamp for the creation of the object 创建对象的时间戳
LAST_DDL_TIME DATE Timestamp for the last modification of the object and dependent objects resulting from a DDL statement (including grants and revokes) DDL语句(包括授权和撤销销)产生的对象和从属对象的最后修改的时间戳
TIMESTAMP VARCHAR2(19) Timestamp for the specification of the object (character data) 对象规范的时间戳(字符数据) 对象自身结构发生改变的时间,比如删除字段、添加字段等
STATUS VARCHAR2(7) Status of the object: 对象的状态
VALID
INVALID
N/A
TEMPORARY VARCHAR2(1) Indicates whether the object is temporary (the current session can see only data that it placed in this object itself) (Y) or not (N) 指示对象是否为临时对象(当前会话只能看到其自身放置在该对象中的数据)(是)(否)
GENERATED VARCHAR2(1) Indicates whether the name of this object was system-generated (Y) or not (N) 指示此对象的名称是系统生成的(Y)还是不是(N)
SECONDARY VARCHAR2(1) Indicates whether this is a secondary object created by the ODCIIndexCreate method of the Oracle Data Cartridge (Y) or not (N) 指示这是不是由Oracle数据盒式磁带的ODCIIndexCreate方法创建的辅助对象(是)(否)
NAMESPACE NUMBER Namespace for the object 对象的命名空间
EDITION_NAME VARCHAR2(128) Name of the edition in which the object is actual 对象实际所在的版本的名称
SHARING VARCHAR2(13) Values: 数据链接-如果对象是数据链接的或指向根目录中对象的数据链接 数据链接-如果对象是数据链接的或指向根目录中对象的数据链接 无-如果以上都不适用
METADATA LINK - If the object is metadata-linked or a metadata link to an object in the root
DATA LINK - If the object is data-linked or a data link to an object in the root
NONE - If none of the above applies
EDITIONABLE VARCHAR2(1) Values: 可编辑的
Y - For objects marked EDITIONABLE Y-对于标记为EDITION可编辑的对象
N - For objects marked NONEDITIONABLE N-对于标记为NONEDITIONABLE的对象
NULL - For objects whose type is not editionable in the database NULL-对于其类型在数据库中不可编辑的对象
ORACLE_MAINTAINED VARCHAR2(1) Denotes whether the object was created, and is maintained, by Oracle-supplied scripts (such as catalog.sql or catproc.sql). An object for which this column has the value Y must not be changed in any way except by running an Oracle-supplied script. 表示对象是否由Oracle提供的脚本(例如catalog.sql或catproc.sql)创建和维护。除非通过运行Oracle提供的脚本,否则不得以任何方式更改此列的值为Y的对象。
APPLICATION VARCHAR2(1) Indicates whether the object is an Application common object (Y) or not (N) 指示对象是(Y)还是(N)不是应用程序通用对象
This column is available starting with Oracle Database 12c Release 2 (12.2.0.1). 此列从Oracle Database 12c第2版(12.2.0.1)开始可用。
DEFAULT_COLLATION VARCHAR2(100) Default collation for the object 对象的默认排序规则
This column is available starting with Oracle Database 12c Release 2 (12.2.0.1). 此列从Oracle Database 12c第2版(12.2.0.1)开始可用。
DUPLICATED VARCHAR2(1) Indicates whether this object is duplicated on this shard (Y) or not (N) 指示此对象是否在此分片上重复(是)(否)
This column is available starting with Oracle Database 12c Release 2 (12.2.0.1). 此列从Oracle Database 12c第2版(12.2.0.1)开始可用。
SHARDED VARCHAR2(1) Indicates whether this object is sharded (Y) or not (N) 指示是否对该对象进行分片(Y)(N)
This column is available starting with Oracle Database 12c Release 2 (12.2.0.1). 此列从Oracle Database 12c第2版(12.2.0.1)开始可用。
CREATED_APPID NUMBER ID of the Application that created the object 创建对象的应用程序的ID
This column is available starting with Oracle Database 12c Release 2 (12.2.0.1). 此列从Oracle Database 12c第2版(12.2.0.1)开始可用。
CREATED_VSNID NUMBER ID of the Application Version that created the object 创建对象的应用程序版本的ID
This column is available starting with Oracle Database 12c Release 2 (12.2.0.1). 此列从Oracle Database 12c第2版(12.2.0.1)开始可用。
MODIFIED_APPID NUMBER ID of the Application that last modified the object 上次修改对象的应用程序的ID
This column is available starting with Oracle Database 12c Release 2 (12.2.0.1). 此列从Oracle Database 12c第2版(12.2.0.1)开始可用。
MODIFIED_VSNID NUMBER ID of the Application Version that last modified the object 上次修改对象的应用程序版本的ID
This column is available starting with Oracle Database 12c Release 2 (12.2.0.1). 此列从Oracle Database 12c第2版(12.2.0.1)开始可用。

3 user_tables(TABS) 表信息视图

尽管所有的用户对象都显示在USER_TABLES视图中,但是这些对象的属性几乎没有显示出来,为了查看对象的更多信息,需要查看特定于此种对象的视图,对于表,相应的视图为USER_TABLES。

USER_TABLES的公有(public权限)同义词TABS。

(oracle的早期版本包含了一个名为TAB的视图(不区分大小写),该视图的功能类似于TABS同义词,目前任然支持该视图,但是TAB视图不包含TABS的所有列,可以在数据字典查询中使用TABS)

USER_TABLES 的列主要分为4类:标识列、与空间相关的列、与统计信息相关的列和其他列


ALL_TABLES
DBA_TABLES
USER_TABLES

外部表相关的视图:
user_external_tables  和 user_external_locations

或者相关表的注释:
select * from dba_col_comments  where table_name='USER_TABLES';
OWNER TABLE_NAME COLUMN_NAME COMMENTS 注释
SYS USER_TABLES TABLE_NAME Name of the table 表名
SYS USER_TABLES TABLESPACE_NAME Name of the tablespace containing the table 包含表的表空间的名称
SYS USER_TABLES CLUSTER_NAME Name of the cluster, if any, to which the table belongs 该表所属的集群的名称(如果有)
SYS USER_TABLES IOT_NAME Name of the index-only table, if any, to which the overflow or mapping table entry belongs 上溢或映射表条目所属的仅索引表的名称(如果有)
SYS USER_TABLES STATUS Status of the table will be UNUSABLE if a previous DROP TABLE operation failed,VALID otherwise 如果先前的DROP TABLE操作失败,则表的状态将为UNUSABLE,否则为VALID
SYS USER_TABLES PCT_FREE Minimum percentage of free space in a block 块中最小可用空间百分比
SYS USER_TABLES PCT_USED Minimum percentage of used space in a block 块中已用空间的最小百分比
SYS USER_TABLES INI_TRANS Initial number of transactions 初始交易数
SYS USER_TABLES MAX_TRANS Maximum number of transactions 最大交易数
SYS USER_TABLES INITIAL_EXTENT Size of the initial extent in bytes 初始范围的大小(以字节为单位)
SYS USER_TABLES NEXT_EXTENT Size of secondary extents in bytes 辅助扩展区的大小(以字节为单位)
SYS USER_TABLES MIN_EXTENTS Minimum number of extents allowed in the segment 段中允许的最小范围数
SYS USER_TABLES MAX_EXTENTS Maximum number of extents allowed in the segment 段中允许的最大扩展数
SYS USER_TABLES PCT_INCREASE Percentage increase in extent size 范围大小的百分比增加
SYS USER_TABLES FREELISTS Number of process freelists allocated in this segment 在此段中分配的进程空闲列表数
SYS USER_TABLES FREELIST_GROUPS Number of freelist groups allocated in this segment 在此段中分配的自由列表组数
SYS USER_TABLES LOGGING Logging attribute 记录属性
SYS USER_TABLES BACKED_UP Has table been backed up since last modification? 自上次修改以来是否已备份表?
SYS USER_TABLES NUM_ROWS The number of rows in the table 表中的行数
SYS USER_TABLES BLOCKS The number of used blocks in the table 表中已使用的块数
SYS USER_TABLES EMPTY_BLOCKS The number of empty (never used) blocks in the table 表中的空(从未使用)块数
SYS USER_TABLES AVG_SPACE The average available free space in the table 表中的平均可用空间
SYS USER_TABLES CHAIN_CNT The number of chained rows in the table 表中链接的行数
SYS USER_TABLES AVG_ROW_LEN The average row length, including row overhead 平均行长度,包括行开销
SYS USER_TABLES AVG_SPACE_FREELIST_BLOCKS The average freespace of all blocks on a freelist 空闲列表上所有块的平均空闲空间
SYS USER_TABLES NUM_FREELIST_BLOCKS The number of blocks on the freelist 自由列表中的块数
SYS USER_TABLES DEGREE The number of threads per instance for scanning the table 每个实例用于扫描表的线程数
SYS USER_TABLES INSTANCES The number of instances across which the table is to be scanned 要扫描表的实例数
SYS USER_TABLES CACHE Whether the table is to be cached in the buffer cache 是否将表缓存在缓冲区缓存中
SYS USER_TABLES TABLE_LOCK Whether table locking is enabled or disabled 表锁定是启用还是禁用
SYS USER_TABLES SAMPLE_SIZE The sample size used in analyzing this table 分析此表时使用的样本量
SYS USER_TABLES LAST_ANALYZED The date of the most recent time this table was analyzed 最近一次分析该表的日期
SYS USER_TABLES PARTITIONED Is this table partitioned? YES or NO 该表分区了吗?是还是不是
SYS USER_TABLES IOT_TYPE If index-only table, then IOT_TYPE is IOT or IOT_OVERFLOW or IOT_MAPPING else NULL 如果是仅索引表,则IOT_TYPE为IOT或IOT_OVERFLOW或IOT_MAPPING否则为NULL
SYS USER_TABLES TEMPORARY Can the current session only see data that it place in this object itself? 当前会话只能看到它放置在该对象本身中的数据吗?
SYS USER_TABLES SECONDARY Is this table object created as part of icreate for domain indexes? 是否将此表对象作为icreate的一部分创建为域索引?
SYS USER_TABLES NESTED Is the table a nested table? 该表是嵌套表吗?
SYS USER_TABLES BUFFER_POOL The default buffer pool to be used for table blocks 用于表块的默认缓冲池
SYS USER_TABLES FLASH_CACHE The default flash cache hint to be used for table blocks 用于表块的默认闪存缓存提示
SYS USER_TABLES CELL_FLASH_CACHE The default cell flash cache hint to be used for table blocks 用于表块的默认单元闪存缓存提示
SYS USER_TABLES ROW_MOVEMENT Whether partitioned row movement is enabled or disabled 分区行移动是启用还是禁用
SYS USER_TABLES GLOBAL_STATS Are the statistics calculated without merging underlying partitions? 是否在不合并基础分区的情况下计算统计信息?
SYS USER_TABLES USER_STATS Were the statistics entered directly by the user? 用户是否直接输入了统计信息?
SYS USER_TABLES DURATION If temporary table, then duration is sys$session or sys$transaction else NULL 如果是临时表,则持续时间为sys $ session或sys $ transaction,否则为NULL
SYS USER_TABLES SKIP_CORRUPT Whether skip corrupt blocks is enabled or disabled 启用或禁用跳过损坏的块
SYS USER_TABLES MONITORING Should we keep track of the amount of modification? 我们应该跟踪修改量吗?
SYS USER_TABLES CLUSTER_OWNER Owner of the cluster, if any, to which the table belongs 该表所属的集群的所有者(如果有)
SYS USER_TABLES DEPENDENCIES Should we keep track of row level dependencies? 我们应该跟踪行级别的依赖关系吗?
SYS USER_TABLES COMPRESSION Whether table compression is enabled or not 是否启用表压缩
SYS USER_TABLES COMPRESS_FOR Compress what kind of operations 压缩什么样的操作
SYS USER_TABLES DROPPED Whether table is dropped and is in Recycle Bin 表是否已删除以及是否在回收站中
SYS USER_TABLES READ_ONLY Whether table is read only or not 表是否是只读的
SYS USER_TABLES SEGMENT_CREATED Whether the table segment is created or not 是否创建表段
SYS USER_TABLES RESULT_CACHE The result cache mode annotation for the table 表的结果缓存模式注释

4 user_tab_columns(COLS) 用户表的列信息视图(可查看表上次分析(analyze)的时间)

user_tab_columns视图列出了特定于列的信息

user_tab_columns的公有同义词COLS。

user_tab_columns视图的列主要分为如下3类:
1.标识列,如table_name、column_name以及column_id
2.定义有关的列,如data_type、data_length、default_length
3.与统计信息相关的列,num_distinct、low_value/high_value、num_nulls

查看指定表的属性(主要表名需要大写)
select * from user_tab_columns where table_name='TESTA';

LAST_ANALYZED :表上一次做分析的时间


dba_tab_columns
all_tab_columns

5 user_views用户视图信息视图

user_views视图可以访问用户的视图基本信息,该视图包含10列,

VIEW_NAME Name of the view 视图名称
TEXT_LENGTH Length of the view text 视图文字的长度
TEXT View text 查看文字
TYPE_TEXT_LENGTH Length of the type clause of the object view 对象视图的type子句的长度
TYPE_TEXT Type clause of the object view 对象视图的Type子句
OID_TEXT_LENGTH Length of the WITH OBJECT OID clause of the object view 对象视图的WITH OBJECT OID子句的长度
OID_TEXT WITH OBJECT OID clause of the object view 对象视图的WITH OBJECT OID子句
VIEW_TYPE_OWNER Owner of the type of the view if the view is a object view 视图类型的所有者(如果视图是对象视图)
VIEW_TYPE Type of the view if the view is a object view 视图的类型(如果视图是对象视图)
SUPERVIEW_NAME Name of the superview, if view is a subview 超级视图的名称(如果视图是子视图)
EDITIONING_VIEW An indicator of whether the view is an Editioning View 该视图是否为编辑视图的指示器
READ_ONLY An indicator of whether the view is a Read Only View 该视图是否为只读视图的指示器

其中重要的是如下三列:

view_name :视图名称

text_length: 视图的查询长度,以字节为单位

text: 视图使用的查询

tex列的类型是long

6 user_synonyms(SYN)用户同义词信息视图

user_synonyms视图的公有同义词SYN。

user_synonyms视图列出了用户的全部同义词,包含如下列:

SYNONYM_NAME :同义词的名称
TABLE_OWNER  :同义词所指标的所有者
TABLE_NAME   :同义词所指的表名
DB_LINK      :同义词所使用的的数据库连接名

all_synonyms
dba_synonyms

当应用程序中调试程序或者解决用户访问的对象所遇到的问题时,user_synonyms非常有用,可用来查看对应的对象信息。

7 user_sequences(SEQ) 用户序列信息视图

user_sequences视图的公有同义词SEQ

列信息:

image-20210427115039942

all_sequences

dba_sequences

7 user_recyclebin和dba_recyclebin

user_recyclebin的公有同义词:RECYCLEBIN

dba_recyclebin (从回收站恢复表时,其约束和索引信息也会恢复,但是其名称会保持在回收站中的名称)

SELect * from RECYCLEBIN;

COLUMN_NAME COMMENTS 注释
OWNER Name of the original owner of the object 对象原始所有者的名称
OBJECT_NAME New name of the object 对象的新名称
ORIGINAL_NAME Original name of the object 对象的原始名称
OPERATION Operation carried out on the object 在对象上执行的操作
TYPE Type of the object 对象类型
TS_NAME Tablespace Name to which object belongs 对象所属的表空间名称
CREATETIME Timestamp for the creating of the object 创建对象的时间戳
DROPTIME Timestamp for the dropping of the object 放置对象的时间戳
DROPSCN SCN of the transaction which moved object to Recycle Bin 将对象移到回收站的交易的SCN
PARTITION_NAME Partition Name which was dropped 删除的分区名称
CAN_UNDROP User can undrop this object 用户可以删除该对象(用户是否可被恢复)
CAN_PURGE User can purge this object 用户可以清除该对象
RELATED Parent objects Obj# 父对象Obj#
BASE_OBJECT Base objects Obj# 基础对象Obj#(是否因为其相关的对象被删除而被删除)
PURGE_OBJECT Obj# for object which gets purged 对象对象被清除的对象
SPACE Number of blocks used by this object 该对象使用的块数

8 user_constraints 当前用户下的所有约束信息

user_constraints 列出了约束信息

包括约束的名称,约束的类型,约束最后一次修改时间等。

image-20210427145553358

all_constraints

dba_constraints

8 user_cons_columns 与约束相关列的视图

结合user_constraints视图和user_cons_columns我们就可以查看表上和约束相关的列有哪些。

image-20210427150652598

查询testa表上的约束和相关的列
select a.owner,a.COLUMN_NAME,A.TABLE_NAME,B.LAST_CHANGE,B.CONSTRAINT_NAME,B.STATUS from user_cons_columns a,user_constraints b where a.table_name='TESTA' AND a.CONSTRAINT_NAME=b.CONSTRAINT_NAME;

9 oracle常用视图

v$database 数据库信息
v$datafile 数据文件信息
v$controlfile 控制文件信息
v$logfile 重做日志信息
v$instance 数据库实例信息
v$log 日志组信息
v$loghist 日志历史信息
v$sga 数据库SGA信息
v$parameter 初始化参数信息
v$process 数据库服务器进程信息
v$bgprocess 数据库后台进程信息
v$controlfile_record_section 控制文件记载的各部分信息
v$thread 线程信息
v$datafile_header 数据文件头所记载的信息
v$archived_log 归档日志信息
v$archive_dest 归档日志的设置信息
v$logmnr_contents 归档日志分析的DML DDL结果信息
v$logmnr_dictionary 日志分析的字典文件信息
v$logmnr_logs 日志分析的日志列表信息
v$tablespace 表空间信息
v$tempfile 临时文件信息
v$filestat 数据文件的I/O统计信息
v$undostat Undo数据信息
v$rollname 在线回滚段信息
v$session 会话信息
v$transaction 事务信息
v$rollstat 回滚段统计信息
v$pwfile_users 特权用户信息
v$sqlarea 当前查询过的sql语句访问过的资源及相关的信息
v$sql 与v$sqlarea基本相同的相关信息
v$sysstat 数据库系统状态信息

ORACLE****主要的系统表和系统视图

1.****系统表

ORACLE****数据库的系统参数都存储在数据库中,可以通过SQLPLUS,以用户SYS进行查询。几个重要的表或者视图如下: **

v$controlfile****:控制文件的信息;** **
v$datafile****:数据文件的信息;** **
v$log****:日志文件的信息;** **
v$process****:处理器的信息;** **
v$session****:会话信息;** **
v$transaction****:事务信息;** **
v$resource****:资源信息;****
v$sga****:系统全局区的信息。** 

**上面的视图名中的‘****v$****’****,****只是视图名字中的字符。类似于上面的视图或表还有很多,位于:** **$ORACLE_HOME/RDBMS/ADMIN/CATALOG.SQL****文件中。** **这些视图或表可以在****SQLPLUS****中用****SELECT****语句进行查询。** **

2.数据字典视图

Sys用户下,view****视图中。

表和列

DBA_TABLESALL_TABLESUSER_TABLES****显示了有关数据库表的一般信息。 **

DBA_TAB_COLUMNSALL_TAB_COLUMNSUSER_TAB_COLUMNS****显示了每个数据库表的列的信息。** **
**

**user_tab_comments 表注释 user_col_comments 列注释
**

注意:DBA_OBJECTSALL_OBJECTSUSER_OBJECTS显示了模式对象的信息,包括表。 **

**

完整性约束

DBA_CONSTRAINTSALL_CONSTRAINTSUSER_CONSTRAINST****显示有关约束的一般信息。

DBA_CONS_COLUMNSALL_CONS_COLUMNSUSER_CONS_COLUMNS****显示有关列的相关约束的一般信息。 **

**

视图

DBA_VIEWSALL_VIEWSUSER_VIEWS****。

注意:DBA_OBJECTSALL_OBJECTSUSER_OBJECTS显示了模式对象的信息,包括视图。 **

**

序列

DBA_SEQUENCESALL_SEQUENCESUSER_SEQUENCES****。

注意:DBA_OBJECTSALL_OBJECTSUSER_OBJECTS显示了模式对象的信息,包括序列。 **

**

同义词

DBA_SYNONYMSALL_SYNONYMSUSER_SYNONYMS****。

注意:DBA_OBJECTSALL_OBJECTSUSER_OBJECTS显示了模式对象的信息,包括同义词。 **

**

索引

DBA_INDEXSALL_INDEXSUSER_INDEXSDBA_IND_COLUMNSALL_IND_COLUMNSUSER_IND_COLUMNS****。 **

**

用户

DBA_USERS****。 **

**

角色

DBA_ROLES****。 **

**

表空间定额

DBA_TS_QUOTAS****。 **

**

配置表

DBA_PROFILES****。 **

**

表空间

DBA_TABLESPACES****。 **

**

数据文件

DBA_DATA_FILES****。 **

**

DBA_SEGMENTSUSER_SEGMENT****。 **

**

回滚段

DBA_ROLLBACK_SEGSV$ROLLNAMEV$ROLLSTAT****。

补充====

dba_开头
dba_users 数据库用户信息
dba_segments 表段信息
dba_extents 数据区信息
dba_objects 数据库对象信息
dba_tablespaces 数据库表空间信息
dba_data_files 数据文件设置信息
dba_temp_files 临时数据文件信息
dba_rollback_segs 回滚段信息
dba_ts_quotas 用户表空间配额信息
dba_free_space 数据库空闲空间信息
dba_profiles 数据库用户资源限制信息
dba_sys_privs 用户的系统权限信息
dba_tab_privs 用户具有的对象权限信息
dba_col_privs 用户具有的列对象权限信息
dba_role_privs 用户具有的角色权限信息
dba_audit_trail 审计跟踪记录信息
dba_stmt_audit_opts 审计设置信息
dba_audit_object 对象审计结果信息
dba_audit_session 会话审计结果信息
dba_indexes 用户模式的索引信息

user_开头
user_objects 用户对象信息
user_source 数据库用户的所有资源对象信息
user_segments 用户的表段信息
user_tables 用户的表对象信息
user_tab_columns 用户的表列信息

关于这个还涉及到两个常用的例子如下:

1、oracle中查询某个字段属于哪个表

Sql代码
select table_name,owner from dba_tab_columns t where t.COLUMN_NAME like upper('%username%');

2、oracle中查询某个表的列数

Sql代码
select count(*) from user_tab_columns where table_name= upper('sys_operate');

注:这两个例子都用到了upper这个函数,是因为在这里表名得大写,否则查出的结果不是正确的

user_constraints 用户的对象约束信息
user_sys_privs 当前用户的系统权限信息
user_tab_privs 当前用户的对象权限信息
user_col_privs 当前用户的表列权限信息
user_role_privs 当前用户的角色权限信息
user_indexes 用户的索引信息
user_ind_columns 用户的索引对应的表列信息
user_cons_columns 用户的约束对应的表列信息
user_clusters 用户的所有簇信息
user_clu_columns 用户的簇所包含的内容信息
user_cluster_hash_expressions 散列簇的信息

v$开头
v$database 数据库信息
v$datafile 数据文件信息
v$controlfile 控制文件信息
v$logfile 重做日志信息
v$instance 数据库实例信息
v$log 日志组信息
v$loghist 日志历史信息
v$sga 数据库SGA信息
v$parameter 初始化参数信息
v$process 数据库服务器进程信息
v$bgprocess 数据库后台进程信息
v$controlfile_record_section 控制文件记载的各部分信息
v$thread 线程信息
v$datafile_header 数据文件头所记载的信息
v$archived_log 归档日志信息
v$archive_dest 归档日志的设置信息
v$logmnr_contents 归档日志分析的DML DDL结果信息
v$logmnr_dictionary 日志分析的字典文件信息
v$logmnr_logs 日志分析的日志列表信息
v$tablespace 表空间信息
v$tempfile 临时文件信息
v$filestat 数据文件的I/O统计信息
v$undostat Undo数据信息
v$rollname 在线回滚段信息
v$session 会话信息
v$transaction 事务信息
v$rollstat 回滚段统计信息
v$pwfile_users 特权用户信息
v$sqlarea 当前查询过的sql语句访问过的资源及相关的信息
v$sql 与v$sqlarea基本相同的相关信息
v$sysstat 数据库系统状态信息

all_开头
all_users 数据库所有用户的信息
all_objects 数据库所有的对象的信息
all_def_audit_opts 所有默认的审计设置信息
all_tables 所有的表对象信息
all_indexes 所有的数据库对象索引的信息

session_开头
session_roles 会话的角色信息
session_privs 会话的权限信息

index_开头
index_stats 索引的设置和存储信息

伪表
dual 系统伪列表信息

oracle最重要的9个动态性能视图
v$session + v$session_wait (在10g里功能被整合,凑合算1个吧.)
v$process
v$sql
v$sqltext
v$bh (更宁愿是x$bh)
v$lock
v$latch_children
v$sysstat
**v$system_event
**
按组分的几组重要的性能视图
1. System 的 over view
v$sysstat , v$system_event , v$parameter

2. 某个session 的当前情况
v$process , v$session , v$session_wait ,v$session_event , v$sesstat

3. SQL 的情况
v$sql , v$sqlarea , v$SQL_PLAN , V$SQL_PLAN_STATISTICS, v$sqltext_with_newlines

3. Latch / lock /ENQUEUE
v$latch , v$latch_children , v$latch_holder , v$lock ,V$ENQUEUE_STAT ,V$ENQUEUE_LOCK

4. IO 方面的
v$segstat , v$filestat , v$tempstat ,v$datafile , v$tempfile

5. shared pool / Library cache
v$Librarycache , v$rowcache , x$ksmsp

6. 几个advice也不错
v$db_cache_advice , v$PGA_TARGET_ADVICE, v$SHARED_POOL_ADVICE

posted @ 2023-06-21 15:45  数据库小白(专注)  阅读(47)  评论(0编辑  收藏  举报