Oracle中如何查询所有表及其所使用的表空间

如题所述

Oracle中查询所有表及其所使用的表空间可以使用SQL语句:

select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name;

在数据库管理员的日常工作中,应该经常查询表空间的利用率,按照数据库系统的具体情况估算表空间的增长量,当表空间的利用率超过90%时,要及时采取措施。

扩展资料

oracle一些其他表空间查询方法介绍:

1、查询oracle系统用户的默认表空间和临时表空间

select default_tablespace,temporary_tablespace from dba_users;

2、查询单张表的使用情况

select segment_name,bytes from dba_segments where segment_name = 'tablename' and owner = USER;

3、查询所有用户表使用大小的前三十名

select * from (select segment_name,bytes from dba_segments where owner = USER order by bytes desc ) where rownum <= 30;

4、查看表空间物理文件的名称及大小

SELECT tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 0) total_space 
FROM dba_data_files ORDER BY tablespace_name;

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-09-13

一条sql语句即可:

select table_name 表名 ,tablespace_name 所使用表空间 from user_tables;

结果截图:

第2个回答  2012-01-13
select owner,table_name,tablespace_name from dba_tables;本回答被提问者采纳
第3个回答  2012-01-13
SELECT SEGMENT_NAME,BTYES FROM DBA_SEGMENTS WHERE SEGMENT_NAME='表名'
第4个回答  2012-01-13
dba_tables,自己去查看,不过要有相应的权限