ORACLE DBA管理脚本
1:查询业务账号下所有的表及列注释
select 用户, 表, 表注释, 字段, 字段类型, 字段注释
from (
select distinct t1.owner 用户,
t1.table_name 表,
t2.comments 表注释,
t3.COLUMN_NAME 字段,
t3.DATA_TYPE 字段类型,
t4.comments 字段注释,
t3.COLUMN_ID
from user_tab_privs t1 --当前用户的对象权限信息
inner join user_tab_comments t2
on t1.table_name = t2.table_name
inner join user_tab_columns t3
on t1.TABLE_NAME = t3.TABLE_NAME
inner join user_col_comments t4
on t4.table_name = t1.table_name
and t4.column_name = t3.COLUMN_NAME
where t1.table_name not like '%==%'
order by 1, 2, t3.COLUMN_ID)