How to release Oracle PLSQL data lock table

(1)See which table is locked
select b.owner,b.object_name,a.session_id,a.locked_mode from vKaTeX parse error: Expected ‘EOF’, got ‘#’ at position 115: …,b.sid,b.serial#̲,logon_time fro…locked_object a,v$session b where a.session_id = b.sid order by b.logon_time;
(3)Kill the corresponding process
Execute the command: alter system kill session ‘1025,41’; (pay attention to the problem of spaces in the middle)
Here is the main point

---Lock table query SQL

SELECT object_name, machine, s.sid, s.serial# ,o.owner

FROM gv$locked_object l, dba_objects o, gv$session s 

WHERE l.object_id = o.object_id 

AND l.session_id = s.sid; 

Use this query to look up the locked object, the locking table device, and the sid and serial

2
--Force process shutdown

alter system kill session '1434, 2425';

Here 1434 and 2425 are the sid and serial of the previous query, respectively

3
--When 'ORA-00030: User session ID does not exist' appears

--query process number

select distinct s.sid,s.serial#,p.spid as system process number

from v$locked_object l , dba_objects o , v$session s , v$process p

where l.object_id=o.object_id and l.session_id=s.sid and s.paddr=p.addr;

4
Log in to the database server using the Xshell tool and execute the following command.

kill -9 system process number

The system process number is the spid queried in the previous step

 

At this point, the table locking problem can be solved perfectly!


Read More: