Oracle 有的表查不到归属表空间

--查看一个用户下有哪些表属于哪个表空间
select * from all_tables where owner = '用户名大写';

问题:
有时一些表查不到属于哪个表空间,在 all_tables 中 tablespace_name 字段为空

原因:
dba_tables/all_tables 表中 tablespace_name 列,当某表为分区表,临时表或索引组织表的时候,该列值为空(官方文档解释)。
查看该表是否为分区表或临时表,可以通过 dba_tables 表中的 temporary ,partitioned 字段查看。

--查看用户下哪些表是分区表或临时表
select * from dba_tables where temporary='YES' or partitioned ='YES' and owner='用户名大写';
--查看一个表是否是分区表或临时表
select owner,table_name,temporary,partitioned from dba_tables where temporary='YES' or partitioned ='YES'and table_name ='表名大写';

查看是否为索引组织表的步骤:
select dbms_metadata.get_ddl('TABLE','COUNTRIES','HR') from dual;
如果该表的DDL语句中有 ORGANIZATION INDEX 关键字,说明该表为索引组织表。

posted @ 2021-01-29 16:27  莫让年华付水流  阅读(963)  评论(0编辑  收藏  举报