How to solve ORA-04021: timeout occurred while waiting to lock object

How to solve ORA-04021: timeout occurred while waiting to lock object

11 Marzo 2019 Oracle Database 0

Compile an object can give the following error

Quire the process to find the session that still running
select
a.object,
a.type,
b.sid,b.serial#,s.inst_id,
b.username,
b.osuser,
b.program,
s.status, s.sql_exec_start
from v$access  a, v$session b, gv$session s
where a.sid    = b.sid
and a.owner  = DECODE(UPPER(‘&1’), ‘ALL’, a.object, upper(‘&1’))
and a.object = DECODE(UPPER(‘&2’), ‘ALL’, a.object, upper(‘&2’))
and b.sid = s.sid
and b.serial# = s.serial#
AND s.status = ‘ACTIVE’
order by a.object , sql_exec_start nulls last ;

Find process sid  (psid) : ps –ef | grep psid

Looking for any sub process :

Kill session on db
SQL> ALTER SYSTEM KILL SESSION ‘sid,serial#’; If you working in a RAC environment, you can specified RAC node . The parameter is optionally specify the INST_ID and you can find it when querying the GV$SESSION view.  SQL> ALTER SYSTEM KILL SESSION ‘sid,serial#,INST_ID’; In addition to the syntax described above, you can add the IMMEDIATE clause.
ALTER SYSTEM KILL SESSION ‘498,32688’ IMMEDIATE ;
The process has not sub process then I can kill it .

 

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *