1. 程式人生 > >oracle資料庫查看錶空間預設大小及使用情況總結

oracle資料庫查看錶空間預設大小及使用情況總結

oracle查詢資料庫的預設表空間情況操作步驟如下:

 

1. 查詢使用者對應的表空間,我們可以看到針對不同的資料庫使用者Oracle


select username, default_tablespace, temporary_tablespace from dba_users;

 

2. 查詢使用者的對應的資料檔案,以及資料檔案大小


select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
order by tablespace_name;


3. 使用者對應的表空間,以及表空間的大小


SELECT a.tablespace_name "表空間名",
total "表空間大小",
free "表空間剩餘大小",
(total - free) "表空間使用大小",
total / (1024 * 1024 * 1024) "表空間大小(G)",
free / (1024 * 1024 * 1024) "表空間剩餘大小(G)",
(total - free) / (1024 * 1024 * 1024) "表空間使用大小(G)",
round((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name ;