请问如何查指定表空间内存储的表大小?
请问我想在oracle 9i里查一个表空间内有那些用户表与表大小,这个SQL要怎么写?
昵称: superzhji 时间: 2010-07-13 14:56:00
查看当前用户每个表占用空间的大小:
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
查看每个表空间占用空间的大小:
Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name
本文来自: 中科软件园(www.4oa.com) 详细出处参考:http://www.4oa.com/Article/html/11/69/693/2005/31581.html
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
查看每个表空间占用空间的大小:
Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name
本文来自: 中科软件园(www.4oa.com) 详细出处参考:http://www.4oa.com/Article/html/11/69/693/2005/31581.html
昵称: renxiao2003 时间: 2010-07-13 15:04:00
有两种含义的表大小。一种是分配给一个表的物理空间数量,而不管空间是否被使用。可以这样查询获得字节数:
select segment_name, bytes
from user_segments
where segment_type = 'TABLE';
或者
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
另一种表实际使用的空间。这样查询:
analyze table emp compute statistics;
select num_rows * avg_row_len
from user_tables
where table_name = 'EMP';
查看每个表空间的大小
Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name
select segment_name, bytes
from user_segments
where segment_type = 'TABLE';
或者
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
另一种表实际使用的空间。这样查询:
analyze table emp compute statistics;
select num_rows * avg_row_len
from user_tables
where table_name = 'EMP';
查看每个表空间的大小
Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name
昵称: renxiao2003 时间: 2010-07-13 15:08:00
关键是看楼主想要查什么信息。其实这些信息在系统表里都有。主要是对系统表不熟悉。多GOOGLE。
昵称: renxiao2003 时间: 2010-07-13 15:09:00
回复 renxiao2003
我是想指的是,如zhzc这个表空间内存储了有那些表相应是那个用户,各表大小。
我是想指的是,如zhzc这个表空间内存储了有那些表相应是那个用户,各表大小。
昵称: superzhji 时间: 2010-07-13 15:28:00
select OWNER,TABLE_NAME from all_tables where TABLESPACE_NAME='ZHZC'; 查出表空间下的所有表
昵称: renxiao2003 时间: 2010-07-13 15:41:00
- select owner,segment_name,bytes/1204/1024 MB from DBA_SEGMENTS where TABLESPACE_NAME='ZHZC';
昵称: renxiao2003 时间: 2010-07-13 15:46:00
楼主可以考虑使用toad,其中有相关的界面可以直接查询的!
