供参考:在Oracle中查看各个表、表空间占用空间的大小 查看当前用户每个表占用空间的大小: 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------------------------------------------------------------------------------ Blog: http://blog.csdn.net/tianlesoftware 网上资源: http://tianlesoftware.download.csdn.net 相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx Q Q 群:62697716
--2、查表A整张表的大小! select owner,table_name, NUM_ROWS, BLOCKS*AAA/1024/1024 "Size M", EMPTY_BLOCKS, LAST_ANALYZED from dba_tables where table_name='XXX'; --Here: AAA is the value of db_block_size ; --XXX is the table name you want to check --3、查用户名Test下,所有数据表等所占空间的大小 select owner,table_name, NUM_ROWS, BLOCKS*AAA/1024/1024 "Size M", EMPTY_BLOCKS, LAST_ANALYZED from dba_tables where owner='XXX'; --Here: AAA is the value of db_block_size ; --XXX is the user name you want to check ---4.查看表空间硬盘大小,要看所有的,自己加SUM吧 select b.file_id 文件ID号, b.tablespace_name 表空间名, b.bytes 字节数, (b.bytes-sum(nvl(a.bytes,0))) 已使用, sum(nvl(a.bytes,0)) 剩余空间, sum(nvl(a.bytes,0))/(b.bytes)*100 剩余百分比 from dba_free_space a,dba_data_files b where a.file_id=b.file_id group by b.tablespace_name,b.file_id,b.bytes order by b.file_id
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------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
Q Q 群:62697716
--2、查表A整张表的大小!
select owner,table_name,
NUM_ROWS,
BLOCKS*AAA/1024/1024 "Size M",
EMPTY_BLOCKS,
LAST_ANALYZED
from dba_tables
where table_name='XXX'; --Here: AAA is the value of db_block_size ;
--XXX is the table name you want to check
--3、查用户名Test下,所有数据表等所占空间的大小
select owner,table_name,
NUM_ROWS,
BLOCKS*AAA/1024/1024 "Size M",
EMPTY_BLOCKS,
LAST_ANALYZED
from dba_tables
where owner='XXX'; --Here: AAA is the value of db_block_size ;
--XXX is the user name you want to check
---4.查看表空间硬盘大小,要看所有的,自己加SUM吧
select
b.file_id 文件ID号,
b.tablespace_name 表空间名,
b.bytes 字节数,
(b.bytes-sum(nvl(a.bytes,0))) 已使用,
sum(nvl(a.bytes,0)) 剩余空间,
sum(nvl(a.bytes,0))/(b.bytes)*100 剩余百分比
from dba_free_space a,dba_data_files b
where a.file_id=b.file_id
group by b.tablespace_name,b.file_id,b.bytes
order by b.file_id