Oracle 1Z031第五章数据字典的内容和使用

1Z031 第五章数据字典的内容和使用
本章学习目标
理解 data dictionary 的关键组件。
理解 data dictionary 的内容和使用方法
查询 data dictionary
一、 数据字典
数据字典是在数据库创建的时候, ORACLE SERVER 在数据文件中创建的附加对象结构。包括
数据字典表
动态性能表
数据字典是一系列只读的表和视图,记录、区分、和提供数据库相关信息。主要作用
记录数据库以及其对象
包括 2 种类型的对象
1、 基本表
存放数据库的描述信息
create database 的同时创建的
2、 数据字典视图
汇总基本表的信息
通过运行 catalog.sql 脚本创建
Base Tables: Underlying tables, which store information about the database. The base tables are the first objects created in any Oracle database. They are automatically created when the Oracle server runs the sql.bsq script at the time the database is created. Only the Oracle server should write to these tables. Users rarely access them directly, because most of the data is stored in a cryptic format. Never use DML commands to update the base tables directly, with the exception of the AUD$ table
Data Dictionary Views: Base table summaries, which provide for a more useful display of base table information. For example, in the data dictionary views, object names are used
instead of only object numbers. The data dictionary views are created using the catalog.sql script.
数据字典的内容包括
逻辑和物理的数据库结构
数据库对象定义和分配的空间
一致性的约束
用户
角色
权限
验证
 
 
如何使用数据字典、数据字典的作用
数据库使用它来查找以下信息:
   用户
   schema 对象
   存储结构
oracle 服务器当运行一个 DDL 语句的时候会修改相应的 database dictionary
用户和 DBA 可以把数据字典当作只读的数据库信息的参考                      
 
数据字典视图目录
数据字典有三类主要视图类别分别是
DBA :包括所有的 schema ,数据库中所有对象
ALL: 普通用户可以使用的,包括所有当前用户可以访问的对象
USER :在某个用户 schema 内的,当前用户所有的对象
访问只需要和普通的表、视图一样访问就可以了。
SELECT owner, object_name, object_type
FROM dba_objects;
 
二、 动态性能表
dynamic performance tables
记录当前数据库的活动,在数据库打开时连续地更新相关视图,信息从 memory control file 中采集。 DBA 使用动态视图查看、调整数据库。动态视图所有者是 sys, 对动态视图不容许使用 DML 语句。
The dynamic tables answer questions such as:
• Is the object online and available?
• Is the object open?
• What locks are being held?
• Is the session active?
查询数据字典和动态性能视图
数据字典和动态视图可以查询以下信息。
Querying the Data Dictionary
To get an overview of the data dictionary and dynamic performance views, the DICTIONARY view or its synonym DICT can be queried. For example:
SELECT * FROM dictionary;
Include the where clause to narrow your responses:
SELECT * FROM dictionary WHERE table_name like ‘sort%’
The V$FIXED_TABLE view can also be queried to get a listing of the views:
SELECT * FROM V$FIXED_TABLE;
To get a list of columns within a view, use the DESCRIBE keyword:
DESCRIBE V$INSTANCE;
To get an overview of the columns in the data dictionary and dynamic performance views,
the DICT_COLUMNS view can be queried.
To view the contents of the view use the SELECT command.
SELECT * from V$INSTANCE;
Data Dictionary Examples
General Overview
DICTIONARY, DICT_COLUMNS
Schema objects
DBA_TABLES, DBA_INDEXES, DBA_TAB_COLUMNS,
DBA_CONSTRAINTS
Space allocation
DBA_SEGMENTS, DBA_EXTENTS
Database structure
DBA_TABLESPACES, DBA_DATA_FILES
 
 
 
本章结束,数据字典和动态性能视图关键还是要多用才能熟练,多看 oracle reference 可以知道每个视图是干什么的。
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值