Thứ Ba, 27 tháng 9, 2011

ORACLE - Determine locked session and kill it

When you execute a SQL statement and it is nung on but you don't know why. So you need to kill that session for server's performance.
  • Determine which session is locked
SELECT object_name, machine, os_user_name,sid,serial#,'alter system kill session ''' || sid || ',' || serial# || ''';'
FROM v$locked_object a, v$session b, user_objects c
WHERE a.object_id = c.object_id AND b.sid = a.session_id;


  • Kill that session
alter system kill session 'sid,serial#' immediate;

Không có nhận xét nào:

Đăng nhận xét