2017計算機等考三級數據庫基礎:如何查看各個表空間占用磁盤情況

字號:

軟件環(huán)境:
     1、Windows NT4.0+ORACLE 8.0.4
     2、ORACLE安裝路徑為:C:\ORANT
     SQL語句:
     /* 中文環(huán)境 */
     col 表空間名 format a20;
     select
     b.file_id 文件ID號,
     b.tablespace_name 表空間名,
     b.bytes 字節(jié)數,
     (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;
     /* 英文環(huán)境 */
     col tablespace_name format a20;
     select
     b.file_id file_ID,
     b.tablespace_name tablespace_name,
     b.bytes Bytes,
     (b.bytes-sum(nvl(a.bytes,0))) used,
     sum(nvl(a.bytes,0)) free,
     sum(nvl(a.bytes,0))/(b.bytes)*100 Percent
     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;
     文件ID號 表空間名 字節(jié)數 已使用 剩余空間 剩余百分比
     --------- ------------------------------ --------- --------- --------- ----------
     1 SYSTEM 20971520 9971712 10999808 52.451172
     2 USER_DATA 3145728 432128 2713600 86.263021
     3 ROLLBACK_DATA 5242880 1640448 3602432 68.710938
     4 TEMPORARY_DATA 2097152 2048 2095104 99.902344