oracle數據庫查看錶空間

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 ;


http://blog.itpub.net/31526978/viewspace-2677556/
第一步:查看錶空間的使用情況:

select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;

第二步:查看錶空間的名字及文件所在位置:

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

第三步:增大所需表空間大小

alter database datafile '表空間位置'resize 新的尺寸。

例如:alter database datafile '/home/oracle/oracle11g/oradata/ora11g/users01.dbf' resize 2000m。

第四步:設置表空間自動擴展:

alter database datafile '\oracle\oradata\anita_2008.dbf'autoextend on next 100m maxsize 10000m
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章