手机
当前位置:查字典教程网 >脚本专栏 >linuxshell >杀掉oracle在线用户脚本分享
杀掉oracle在线用户脚本分享
摘要:杀掉oracle在线用户,在oracle所在服务器上使用root用户执行该脚本参数说明$1为该oracle用户复制代码代码如下:#!/bin...

杀掉oracle在线用户,在oracle所在服务器上使用root用户执行该脚本

参数说明$1为该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!!!"

【杀掉oracle在线用户脚本分享】相关文章:

nginx多server日志分割脚本分享

win下调用putty执行命令脚本分享

Ubuntu服务器配置apache2.4的限速功能shell脚本分享

定时导出mysql本地数据替换远程数据库数据脚本分享

shell监控linux系统进程创建脚本分享

使用curl递归下载软件脚本分享

自动生成linux网卡配置脚本分享

图片批量压缩大小脚本分享

Ubuntu下定时提交代码到SVN服务器的Shell脚本分享

实现释放CentOS系统内存的Shell脚本分享

精品推荐
分类导航