ITPub博客

首页 > 数据库 > Oracle > oracle空间使用监控脚本

oracle空间使用监控脚本

原创 Oracle 作者:wangzhensheng 时间:2007-04-23 16:18:27 0 删除 编辑

#!/bin/sh
# Linxs ck_tablespaces.sh
sqlplus
$1/$2@$3 <set feed off
set lines 160
set pagesize 999

[@more@]

#!/bin/sh
# Linxs ck_tablespaces.sh
sqlplus
$1/$2@$3 <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
$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 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-912059/ ,如需转载,请注明出处,否则将追究法律责任。

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

注册时间:2013-01-02

  • 博文量
    137
  • 访问量
    260335