Tuesday, 25 December 2012

DROP function was hanging for ever, even if you try to recompile the objects it throws ORA-04021

ORA-04021 timeout occurred while waiting to lock object... Same is applicable if the package status is getting invalidated.

drop function AGCST.AG_ASG_CHG_MAIL_PROG;

The background behind it was, this function is used in workflow and the initiated workflow was still accesing the objects.

Get the SID Information which are accessing this object and kill the same:
select * from v$access where owner='AGCST';

select 'ALTER SYSTEM KILL SESSION '''||SID||','||SERIAL#||''';' from gv$session where INST_ID=2 and SID IN(select SID from gv$access
where object like '%AR%CASH%REC%' and type='TABLE'
and INST_ID=1);


Once you complete killing all the SIDs, it will allow you to drop the object.

No comments:

Post a Comment