#!/bin/sh
indx=0
rbs=0
system=0
users=0
tmpfile=dbtabspace.tmp
hostna=`hostname`
dbname=$1
if [ $hostna = "shxu0008" ]
then
case $dbname in
tadudb)
su - oracle -c "sqlplus -S '"netgain/0okm9ijn@tadudb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
;;
calldb)
su - oracle -c "sqlplus -S '"netgain/0okm9ijn@calldb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
;;
esac
fi
if [ $hostna = "shxp0003" ]
then
su - cspdba -c "sqlplus -S '"netgain/0okm9ijn@calldb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
fi
if [ $hostna = "shxp0004" ]
then
su - cspdba -c "sqlplus -S '"netgain/0okm9ijn@calldb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
fi
if [ $hostna = "shxp0001" ]
then
case $dbname in
tadspdb)
su - tadspdba -c "sqlplus -S '"netgain/0okm9ijn@tadspdb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
;;
fmpdb)
su - fmpdba -c "sqlplus -S '"netgain/0okm9ijn@fmpdb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
;;
fapdb)
su - fapdba -c "sqlplus -S '"netgain/0okm9ijn@fapdb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
;;
esac
fi
if [ $hostna = "shxp0002" ]
then
case $dbname in
tadspdb)
su - tadspdba -c "sqlplus -S '"netgain/0okm9ijn@tadspdb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
;;
fmpdb)
su - fmpdba -c "sqlplus -S '"netgain/0okm9ijn@fmpdb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
;;
fapdb)
su - fapdba -c "sqlplus -S '"netgain/0okm9ijn@fapdb"'" > $tmpfile <<EOF
set feedback off
select t.name,100-trunc(f.free/s.total*100.0,2)
from (select tablespace_name name from dba_tablespaces) t,
(select tablespace_name name,sum(bytes) total from dba_data_files
group by tablespace_name) s,
(select tablespace_name name,sum(bytes) free from dba_free_space
group by tablespace_name) f
where t.name=s.name and t.name=f.name;
exit
EOF
;;
esac
fi
if [ $? -eq 0 ]
then
error_text=`grep "ORA-" $tmpfile`
if [ $? -ne 0 ]
then
indx=`cat $tmpfile | grep "INDX" | awk '{print $2}'`
rbs=`cat $tmpfile | grep "RBS" | awk '{print $2}'`
system=`cat $tmpfile | grep "SYSTEM" | awk '{print $2}'`
users=`cat $tmpfile | grep "USERS" | awk '{print $2}'`
temp=`cat $tmpfile | grep "TEMP" | awk '{print $2}'`
else
echo "error_text=$error_text"
fi
fi
echo "Table Space Utilization (INDEX)=${indx}"
echo "Table Space Utilization (RBS)=${rbs}"
echo "Table Space Utilization (SYS)=${system}"
echo "Table Space Utilization (USERS)=${users}"
echo "Table Space Utilization (TEMP)=${temp}"
echo "status_text=index:${indx}%, rbs:${rbs}%, system:${system}%, uses:${users}%, temp:${temp}%"
rm $tmpfile
exit 0
没有合适的资源?快使用搜索试试~ 我知道了~
oracle监测脚本集.tar.gz
需积分: 10 14 下载量 84 浏览量
2009-03-22
18:13:06
上传
评论
收藏 4KB GZ 举报
温馨提示
共33个文件
sh:33个
oracle监测脚本集.tar.gz oracle监测脚本集.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
oracle监测脚本集.tar.gz (33个子文件)
oracle
oracle_listener_aix.sh 833B
oracle_procmem_jtw.sh 1KB
oracle_usr_tabspace_aix.sh 847B
oracle_procmem.sh 408B
oracle_dbstate_sun.sh 1KB
oracle_dbstate_jtw.sh 2KB
oracle_usr_tabspace_sun.sh 915B
oracle_sys_tabspace_jpmg.sh 5KB
oracle_sys_tabspace_jtw.sh 2KB
oracle_dbstate_aix.sh 1KB
oracle_listener_sun.sh 768B
oracle_sys_tabspace_sun.sh 1KB
oracle_listener_hp.sh 763B
oracle_usr_tabspace_hp.sh 916B
oracle_usr_tabspace_linux.sh 904B
oracle_dbstate_jpmg.sh 4KB
oracle_dbstate_hp.sh 1KB
oracle_procmem_aix.sh 925B
oracle_dbstate_linux.sh 1KB
oracle_listener.sh 412B
oracle_procmem_linux.sh 1013B
oracle_process.sh 2KB
oracle_listener_linux.sh 774B
oracle_listener_jpmg.sh 1KB
oracle_usr_tabspace.sh 428B
oracle_procmem_sun.sh 992B
oracle_sys_tabspace_aix.sh 1KB
oracle_dbstate.sh 408B
oracle_sys_tabspace.sh 428B
oracle_procmem_jpmg.sh 3KB
oracle_sys_tabspace_hp.sh 1KB
oracle_sys_tabspace_linux.sh 1KB
oracle_procmem_hp.sh 992B
共 33 条
- 1
资源评论
辛鹤
- 粉丝: 272
- 资源: 978
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功