oracle 常用于表、索引的查询

查看某个用户下所有类型为视图的表名

select * from dba_tab_comments where owner='名字' and table_type='VIEW';

开启某用户下所有表的全列

select  'alter table ' || OWNER||'.'||TABLE_NAME || ' add supplemental log data (all,primary key,unique,foreign key) columns'  from dba_tables where owner='名字' ;


select  'info trandata  ' || OWNER||'.'||TABLE_NAME  from dba_tables where owner='名字' ;

查看xml表名

select * from all_xml_tables;

查看索引是否生效

select status from dba_indexes where index_name='PK_INPATITEM';

查看表的全部索引

select index_owner,index_name,column_name from dba_ind_columns where table_name=upper('表名') and table_owner='owner';

a用户下授权查询所有的表给b用户

select 'grant select on a.' || table_name || ' to b;' from user_tables;

查询表的大小

select segment_name, segment_type,owner,bytes/1024/1024 M from dba_segments where segment_type='TABLE' and segment_name = 'TABLE_NAME';

posted @ 2023-08-01 14:36  by1314  阅读(152)  评论(0编辑  收藏  举报
浏览器标题切换
浏览器标题切换end