1.查詢用戶使用的表空間:
1 select username,default_tablespace,temporary_tablespace 2 from dba_users 3 where username = '用戶名稱';
2.查詢表空間使用情況:
1 SELECT a.tablespace_name TABLESPACE_NAME, 2 total / 1048576 TOTAL_M, 3 free / 1048576 FREE_M, 4 (total - free) / 1048576 USED_M, 5 ROUND((total - free) / total, 4) * 100 "USED%", 6 autoextensible autoextem 7 FROM (SELECT tablespace_name, SUM(bytes) free 8 FROM DBA_FREE_SPACE 9 GROUP BY tablespace_name) a, 10 (SELECT tablespace_name, 11 SUM(bytes) total, 12 max(autoextensible) autoextensible 13 FROM DBA_DATA_FILES 14 GROUP BY tablespace_name) b 15 WHERE a.tablespace_name = b.tablespace_name 16 order by 6, 5 desc
3.查看表空間對應的數據文件
1 select tablespace_name, file_id, file_name, 2 round(bytes/(1024*1024),0) total_space 3 from dba_data_files 4 order by tablespace_name;
2018-08-1613:25:52