杀掉oracle在线用户

2015-07-05 0 595
杀掉oracle在线用户
#!/bin/sh

function _oracleplus(){
su - oracle -c "$oraclehome/bin/sqlplus /nolog" <<EOF
connect / as sysdba;
$1
exit
EOF
}

echo "start select $1 session!!!"
selectUS="select 'alter system kill session '''||sid||','||serial#||''';' from v\$session where username=''$1'';"
_oracleplus "$selectUS" |grep 'alter system' > onlinesession.dmp
echo "start kill $1 session!!!"
cat onlinesession.dmp | while read line;
do
_oracleplus "$line"
done
echo "end kill $1 session!!!"

遇见资源网 shell 杀掉oracle在线用户 http://www.ox520.com/17037.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务