查看表空間使用情況
目前成都創(chuàng)新互聯(lián)已為成百上千的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬空間、網(wǎng)站托管維護(hù)、企業(yè)網(wǎng)站設(shè)計(jì)、霍山網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。
SELECT a.tablespace_name,
ROUND (a.total_size) "total_size(MB)",
ROUND (a.total_size) - ROUND (b.free_size, 3) "used_size(MB)",
ROUND (b.free_size, 3) "free_size(MB)",
ROUND (b.free_size / total_size * 100, 2) || '%' free_rate
FROM ( SELECT tablespace_name, SUM (bytes) / 1024 / 1024 total_size
FROM dba_data_files
GROUP BY tablespace_name) a,
( SELECT tablespace_name, SUM (bytes) / 1024 / 1024 free_size
FROM dba_free_space
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name(+);
TABLESPACE_NAME total_size(MB) used_size(MB) free_size(MB) FREE_RATE
------------------------------ -------------- ------------- ------------- -----------------------------------------
SYSAUX 900 835.687 64.313 7.15%
UNDOTBS1 24576 53.875 24522.125 99.78%
USERS 5 1.312 3.688 73.75%
SYSTEM 4170 4160.687 9.313 .22%
USER_DATA 150 105.062 44.938 29.96%
計(jì)算所需undo表空間的大小:
1.計(jì)算業(yè)務(wù)高峰期每秒產(chǎn)生undo數(shù)據(jù)塊的個(gè)數(shù)
SQL> select max(undoblks / ((end_time - begin_time)*24*3600)) from v$undostat;
MAX(UNDOBLKS/((END_TIME-BEGIN_
------------------------------
11.305
2.得到undo數(shù)據(jù)塊在undo表空間中可以保留的最長(zhǎng)時(shí)間
SQL> show parameter undo_retention;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_retention integer 86400
3.得到數(shù)據(jù)塊大小
SQL> show parameter db_blo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_block_buffers integer 0
db_block_checking string FALSE
db_block_checksum string TYPICAL
db_block_size integer 8192
4.將以上三者的數(shù)據(jù)相乘就是所需undo表空間的大小數(shù)
SQL> select (11.305*86400*8192)/1024/1024/1024 undoTablespace_GB from dual;
UNDOTABLESPACE_GB
-----------------
7.4520263671875
發(fā)現(xiàn)undo表空間不夠的時(shí)候,趕緊增加undo表空間的大小,執(zhí)行語(yǔ)句如下:
alter tablespace undotbs1 add datafile '/u01/database/instance_name/undotbs02.dbf' size 100M autoextend on next 128M maxsize 24G;
alter tablespace undotbs1 add datafile '/u01/database/instance_name/undotbs03.dbf' size 100M autoextend on next 128M maxsize 24G;
alter tablespace undotbs1 add datafile '/u01/database/instance_name/undotbs04.dbf' size 100M autoextend on next 128M maxsize 24G;
---------------------
本文為轉(zhuǎn)載文章