首页 > Linux操作系统 > Linux操作系统 > 数据字典与动态性能视图
Although these views appear to be regular database tables, they are not. These views provide data on internal disk structures and memory structures. You can select from these views, but you can never update or alter them.
动态性能视图主要是Oracle数据的库自动收集并记录当前例程的活动信息。当数据库管理员启动某个例程时,数据库会自动建立动态性能视图;当停止某个例 程时,数据库又会自动删除这些动态性能视图。这表面看起来跟数据字典有异曲同工之妙,但是,两者信息的来源还是有很大差异的。官方的介绍:
One of the most important parts of an Oracle database is its data dictionary, which is a read-only set of tables that provides information about the database. A data dictionary contains:
The definitions of all schema objects in the database (tables, views, indexes, clusters, synonyms, sequences, procedures, functions, packages, triggers, and so on)
How much space has been allocated for, and is currently used by, the schema objects
Default values for columns
Integrity constraint information
The names of Oracle users
Privileges and roles each user has been granted
Auditing information, such as who has accessed or updated various schema objects
Other general database information
The data dictionary is structured in tables and views, just like other database data. All the data dictionary tables and views for a given database are stored in that database's SYSTEM tablespace.
Not only is the data dictionary central to every Oracle database, it is an important tool for all users, from end users to application designers and database administrators. Use SQL statements to access the data dictionary. Because the data dictionary is read only, you can issue only queries (SELECT statements) against it's tables and views.
数据字典是Oracle存放有关数据库信息的地方,其用途是用来描述数据的。比如一个表的创建者信息,创建时间信息,所属表空间信息,用户访问权限信息等。
数据库数据字典是一组表和视图结构。它们存放在SYSTEM表空间中,当用户在对数据库中的数据进行操作时遇到困难就可以访问数据字典来查看详细的信息。
用户可以用SQL语句访问数据库数据字典。
数据字典内容包括:
1,数据库中所有模式对象的信息,如表、视图、簇、及索引等。
2,分配多少空间,当前使用了多少空间等。
3,列的缺省值。
4,约束信息的完整性。
5,Oracle用户的名字。
6,用户及角色被授予的权限。
7,用户访问或使用的审计信息。
8,其它产生的数据库信息。
数据字典中的表是不能直接被访问的,但是可以访问数据字典中的视图。
静态数据字典中的视图分为三类,它们分别由三个前缀够成:user_*、 all_*、 dba_*。
user_*
该视图存储了关于当前用户所拥有的对象的信息。(即所有在该用户模式下的对象)
all_*
该试图存储了当前用户能够访问的对象的信息。(与user_*相比,all_* 并不需要拥有该对象,只需要具有访问该对象的权限即可)
dba_*
该视图存储了数据库中所有对象的信息。(前提是当前用户具有访问这些数据库的权限,一般来说必须具有管理员权限)
select * from dictionary;
--查询该用户拥有哪些表
--user_tables主要描述当前用户拥有的所有表的信息,
--主要包括表名、表空间名、簇名等。通过此视图可以清楚了解当前用户可以操作的表有哪些
desc user_tables;
select table_name from user_tables;
select * from user_tables;
--查询该用户拥有哪些索引
select index_name from user_indexes;
--查询该用户拥有哪些视图
select view_name from user_views;
--查询该用户拥有哪些数据库对象,对象包括表、视图、存储过程、触发器、包、索引、序列、JAVA文件等。
select object_name from user_objects;
--主要描述当前用户的信息,主要包括当前用户名、帐户id、帐户状态、表空间名、创建时间等。
select * from user_users;
--user_/all_区别:
all_列出来的信息是当前用户可以访问的对象而不是当前用户拥有的对象。
查询某一用户下的所有表、过程、函数等信息。
select owner , object_name ,object_type from all_objects
--对于dba_开头的需要管理员权限,
--查询表空间的信息(当前用户必须拥有DBA角色)。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23190213/viewspace-661548/ ,如需转载,请注明出处,否则将追究法律责任。