oracle使用監控指令碼_ck_tablespace.sh

wangzhensheng發表於2007-08-12

#!/bin/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,
(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

[@more@]#!/bin/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,
(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-949574/,如需轉載,請註明出處,否則將追究法律責任。

相關文章