Skip to content

Instantly share code, notes, and snippets.

@jamesnguyen101
Created March 18, 2019 19:49
Show Gist options
  • Save jamesnguyen101/54e89240cb6df2ad27b3e67f66a4cb2d to your computer and use it in GitHub Desktop.
Save jamesnguyen101/54e89240cb6df2ad27b3e67f66a4cb2d to your computer and use it in GitHub Desktop.
Remove Oracle table row lock, example on SEC_USER
## script 1
-- step 1
select
c.owner,
c.object_name,
c.object_type,
b.sid,
b.serial#,
b.status,
b.osuser,
b.machine
from
v$locked_object a ,
v$session b,
dba_objects c
where
b.sid = a.session_id
and
a.object_id = c.object_id;
-- step 2
alter system kill session 'SID,SERIALl#';
eg: alter system kill session '45,237,259';
### script 2
-- step 1
select
session_id
from
dba_dml_locks
where
name = 'SEC_USER';
-- step 2
select
sid,
serial#
from
v$session
where
sid in (
select
session_id
from
dba_dml_locks
where
name = 'SEC_USER');
-- step 3
alter system kill session 'SID,SERIALl#';
eg
alter system kill session '45,57666';
alter system kill session '237,32787';
alter system kill session '259,37170';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment