ITPub博客

首页 > 数据库 > Oracle > oracle使用监控脚本_ck_tablespace.sh

oracle使用监控脚本_ck_tablespace.sh

原创 Oracle 作者:wangzhensheng 时间:2007-08-12 12:56:19 0 删除 编辑

#!/bin/sh
sqlplus $1/$2@$3 <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 $1/$2@$3 <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博客 ” ,链接:https://blog.itpub.net/8806316/viewspace-949574/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-01-02

  • 博文量
    137
  • 访问量
    260335