Menghitung ukuran database siak

Hehm sebenarnya berapa sih ukuran database SIAK anda. Ukuran database dapat dengan mudah dihitung dengan menjumlahkan ukuran semua tablespace yang digunakan. Tidak perlu bingung, gunakan script di bawah ini (jalankan di SQL*PLUS atau di TOAD (execute as script)).

Scriptnya adalah sebagai berikut:

clear breaks
clear computes
clear columns
set pagesize 50
set linesize 120
set heading on
column tablespace_name heading 'Tablespace' justify left format a20 truncated
column tb_size heading 'Size|(Mb) ' justify right format 9,999,999.99
column tb_free heading 'Free|(Mb) ' justify right format 9,999,999.99
column tb_used heading 'Used|(Mb) ' justify right format 9,999,999.99
column tb_usedpct heading 'Used % ' justify right format a8
column tb_freepct heading 'Free % ' justify right format a8
break on report
compute sum label 'Totals:' of tb_size tb_used tb_free on report
select a.tablespace_name, round (a.bytes_alloc / 1024 / 1024, 2) tb_size,
round (nvl (b.bytes_free, 0) / 1024 / 1024, 2) tb_free,
round ((a.bytes_alloc - nvl (b.bytes_free, 0)) / 1024 / 1024,
2) tb_used,
round ((nvl (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) tb_freepct,
100
- round ((nvl (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) tb_usedpct
from (select f.tablespace_name, sum (f.bytes) bytes_alloc
from dba_data_files f
group by tablespace_name) a,
(select f.tablespace_name, sum (f.bytes) bytes_free
from dba_free_space f
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name(+)
union all
select h.tablespace_name,
round (sum (h.bytes_free + h.bytes_used) / 1048576, 2) tb_size,
round ( sum ((h.bytes_free + h.bytes_used) - nvl (p.bytes_used, 0))
/ 1048576,
2
) tb_free,
round (sum (nvl (p.bytes_used, 0)) / 1048576, 2) tb_used,
round ( ( sum ((h.bytes_free + h.bytes_used) - nvl (p.bytes_used, 0))
/ sum (h.bytes_used + h.bytes_free)
)
* 100,
2
) tb_freepct,
100
- round ( ( sum ( (h.bytes_free + h.bytes_used)
- nvl (p.bytes_used, 0)
)
/ sum (h.bytes_used + h.bytes_free)
)
* 100,
2
) tb_usedpct
from sys.v_$temp_space_header h, sys.v_$temp_extent_pool p,
dba_temp_files f
where p.file_id(+) = h.file_id
and p.tablespace_name(+) = h.tablespace_name
and f.file_id = h.file_id
and f.tablespace_name = h.tablespace_name
group by h.tablespace_name, f.maxbytes


Copy dan paste-kan lalu jalankan. Berikut adalah screenshot dari hasil script berikut di server Wonogiri.



ukuran database siak depdagri



Hehm, terlihat khan kalau ukuran database saya hampir 15 GB namun ukuran sebenarnya hanyalah 6 GB karena ukuran sisanya adalah free space. Terlihat juga ada beberapa tablespace yang ukurannya tidak harus besar karena hanya digunakan sedikit, seperti SIAKIDX, SIAKFOTO, UNDOTBS2 serta TEMP. Tablespace-tablespace ini harus dioptimalisasi dengan mengurangi ukurannya. Bagaimana ya caranya? Ada yang tahu?

Categories: , ,

Leave a Reply