oracle空間使用監控指令碼

wangzhensheng發表於2007-04-23

#!/bin/sh
# Linxs ck_tablespaces.sh
sqlplus
<set feed off
set lines 160
set pagesize 999

[@more@]

#!/bin/sh
# Linxs ck_tablespaces.sh
sqlplus
<set feed off
set lines 160
set pagesize 999
col tablespace_name format a10
col DBfile_name format a50
col b.file_id format a10
spool $4.txt
select b.file_id,b.FILE_NAME DBfile_name,b.tablespace_name,b.bytes,b.maxbytes maxbytes,( b.bytes-sum(nvl(a.bytes,0))) USED,sum(nvl(a.bytes,0)) SHENGYU,
sum(nvl(a.bytes,0))/(b.bytes)*100 SHENYUpre
from dba_free_space a,dba_data_files b
where a.file_id=b.file_id
group by b.tablespace_name,b.file_id,b.bytes,b.FILE_NAME,b.maxbytes
order by b.file_id;
spool off
exit
EOF

echo ""
date >>$4.txt

==========================================

#!/bin/sh
# Solaris ck_tablespaces.sh
sqlplus
<set feed off
set lines 130
set pagesize 999
col TS_name format a13
col TS_place format a48
spool $4.txt
select b.file_id ID,b.FILE_NAME TS_place,b.tablespace_name TS_name,b.bytes BYTES,b.maxbytes maxbytes,
(b.bytes-sum(nvl(a.bytes,0))) USED,sum(nvl(a.bytes,0)) surplus,
sum(nvl(a.bytes,0))/(b.bytes)*100 surplus_pre
from dba_free_space a,dba_data_files b
where a.file_id=b.file_id
group by b.tablespace_name,b.file_id,b.bytes,b.FILE_NAME,b.maxbytes
order by b.file_id;
spool off
exit
EOF

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8806316/viewspace-912059/,如需轉載,請註明出處,否則將追究法律責任。

相關文章