I'm no DBA... so sometimes the simplest thing may be hard. I'm currently using Oracle in one of my projects, and I been having trouble with pending sessions / transactions. So I had to discover how to kill them. I found
this link, which I reproduce partially here for the sake of preserving the information.
Identifying the locks:
SELECT
l.inst_id,
SUBSTR(l.oracle_username,1,8) ora_user,
SUBSTR(l.session_id,1,3) sid,
S.serial#,
SUBSTR(o.owner||'.'||o.OBJECT_NAME,1,40) object,
p.spid os_pid,
DECODE(l.locked_mode,
0,'NONE',
1,'NULL',
2,'ROW SHARE',
3,'ROW EXCLUSIVE',
4,'SHARE',
5,'SHARE ROW EXCLUSIVE',
6,'EXCLUSIVE',
NULL) lock_mode
FROM
sys.gv_$locked_object l,
dba_objects o,
sys.gv_$session s,
sys.gv_$process p
WHERE
l.OBJECT_ID = O.OBJECT_ID
AND l.inst_id = s.inst_id
AND l.session_id = s.sid
AND s.inst_id = p.inst_id
AND s.paddr = p.addr(+)
ORDER BY l.inst_id
Killing the session:
The SID and the SERIAL# fields can then be used to issue the kill command:
ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE