1、数据库出现hang处置过程:
sqlplus -prelim / as sysdba oradebug setmypid oradebug unlimit oradebug hanganalyze 3 oradebug dump systemstate 266 oradebug tracefile_name -- 此命令生成dump文件,根据命令提示的路径查看dump文件 oradebug close_trace;
2、数据库连不上时,可以使用以下命令杀会话:
ps -ef | grep sid | grep local=no | awk '{print $2}' | xargs kill -93、如果数据库可以连接,可以使用sql杀会话:
select a.inst_id,
a.username,
a.logon_time,
a.status,
'alter system kill session ''' || a.sid || ',' || a.serial# || ''',',
'kill -9 ' || b.spid
from gv$session a,
gv$process b,
dba_users u
where a.inst_id = 1
and a.paddr = b.addr
and a.status = 'inactive'
and a.username not in ('sys', 'system')
and a.username = u.username
and u.default_tablespace not in ('system', 'sysaux')
and a.type = 'user'
and to_char(a.logon_time, 'yyyy-mm-dd hh24:mi:ss') < to_char(sysdate - 2 / 24, 'yyyy-mm-dd hh24:mi:ss')
group by a.inst_id,
a.username,
a.logon_time,
a.status,
a.sid,
a.serial#,
b.spid,
a.type
order by username, logon_time desc;到此这篇关于oracle杀会话的实现步骤的文章就介绍到这了,更多相关oracle杀会话内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!
发表评论