3471
社区成员
--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