查看錶空間使用情況
su - oracle
sqlplus / as sysdba
#查看錶空間佔用情況
SELECT a.tablespace_name "表空間名",
a.bytes / 1024 / 1024 "表空間大小(M)",
(a.bytes - b.bytes) / 1024 / 1024 "已使用空間(M)",
b.bytes / 1024 / 1024 "空閒空間(M)",
round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "使用比"
FROM (SELECT tablespace_name, sum(bytes) bytes
FROM dba_data_files
GROUP BY tablespace_name) a,
(SELECT tablespace_name, sum(bytes) bytes, max(bytes) largest
FROM dba_free_space
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
ORDER BY ((a.bytes - b.bytes) / a.bytes) DESC;
#查看錶空間文件位置
select t1.name,t2.name from v$tablespace t1,v$datafile t2 where t1.ts# = t2.ts#;