要想查询oracle的系统表,必须具有DBA权限.
1.dba_all_tables:数据库中所有表的基本信息.
/*
table_name : 表名
num_rows : 表中记录数
last_analyzed : 表的最后变更时间
*/
select t.table_name , t.num_rows , t.last_analyzed
from dba_all_tables t
where t.owner = 'JWZH'
and t.table_name like 'ZA_ZAGL%'
order by t.num_rows desc
2.user_constraints:数据库中所有约束信息.
/*
owner : 代表约束的拥有者,也就是说你要查询的约束是哪个用户的.
constraint_type : 代表约束的类型
constraint_name : 代码约束的名称
*/
select *
from user_constraints t
where t.owner = 'JWZH'
and t.constraint_type = 'P'
and t.constraint_name = 'PK_TASKS';