数据字典

数据字典

定义:用来描述用户对象的对象。

Oracle本质:
Oracle是一个用表(系统表)来维护表(用户表)的数据库系统,这里的系统表就是我们所说的数据字典

Oracle数据库定义的数据字典都遵循一定的命名规则,它内置了上千张表

命名规则:
前缀_数据库对象+s/es

常用的前缀:
user
all
dba
$

常用数据库对象
table,user,constraint,sequence,index,view...

常用数据字典:
user_users        存放用户的信息
user_tables        存放用户表的信息
user_constraints存放表中约束的信息
user_sequences    存放序列的信息
user_indexes    存放索引的信息
user_views        存放视图的信息
suer_cons_columns存放约束与列对应关系的信息

--查看当前用户下有哪些约束
select * from user_constraints ;

--查看当前用户下有哪些表格
select * from user_tables;

--查看emp表中所有的约束名和约束类型
select constraint_name,constraint_type from user_constraints where table_name='EMP';

注意:此表名一定要大写!

--查看当前用户(scott)下所有状态不可用的约束名字,以及该约束作用的表格名
select constraint_name,table_name
from user_constraints
where status = 'DISABLED';

原文地址:https://www.cnblogs.com/w-xibao/p/7816392.html