Reproduced from: http://blog.csdn.net/xixi_666/article/details/48179865
1. View the amount of space a table occupies:
SELECT bytes/1024/1024 | | ' MB ' Table_size, u.* from user_segments u WHERE u.segment_name= ' jk_test ';
2. View the actual size of a table space:
SELECT SUM (BYTES)/1024/1024 | | MB ' from user_segments U WHERE tablespace_name = ' DATA01 ';
3. View a table space corresponding to the data file:
SELECT * from Dba_data_files D WHERE d.tablespace_name = ' DATA01 ';
4. View table Space usage:
SELECT A.tablespace_name,
FileNum,
Total ' Total (MB) ',
F.free "Free (MB)",
To_char (ROUND (Free * 100/total, 2), ' 990.00 ') "free%",
To_char (ROUND (total-free) * 100/total, 2), ' 990.00 ') "used%",
ROUND (maxsizes, 2) "MAX (MB)"
From (SELECT Tablespace_name,
COUNT (file_id) FileNum,
SUM (BYTES/(1024 * 1024)) Total,
SUM (maxbytes)/1024/1024 maxsizes
From Dba_data_files
GROUP by Tablespace_name) A,
(SELECT tablespace_name, ROUND (SUM (BYTES/1024 * 1024)) free
From Dba_free_space
GROUP by Tablespace_name) F
WHERE A.tablespace_name = F.tablespace_name
5. View the actual use of the data file:
SELECT ceil (Max_block * block_size/1024)
From (SELECT MAX (block_id) Max_block
From Dba_extents
WHERE file_id in (SELECT file_id
From Dba_data_files D