首页 > 代码库 > Oracle当前会话(连接数)(进程)的查看和杀掉

Oracle当前会话(连接数)(进程)的查看和杀掉

1.查看Oracle当前会话(连接数)(进程)

SELECT SID,SERIAL#,PROCESS,LOGON_TIME,USERNAME,PROGRAM,status,‘‘‘‘||sid||‘,‘||serial#||‘‘‘‘

FROM V$SESSION
WHERE USERNAME = ‘OPXX‘        --用户名
AND PROGRAM = ‘aspnet_wp.exe‘     --连接程序
ORDER BY LOGON_TIME DESC

 

2.杀掉会话(连接数)(进程)

生成多条kill语句后执行。

select ‘alter system kill session ‘‘‘ || sid || ‘,‘ || serial# ||‘‘‘;‘

FROM V$SESSION
WHERE USERNAME = ‘OPXX‘
AND PROGRAM = ‘aspnet_wp.exe‘
ORDER BY LOGON_TIME DESC

Oracle当前会话(连接数)(进程)的查看和杀掉