Search code examples
sqloracleprocedures

Not able to drop the procedure


I have created a function and procedure, the function is called in the procedure. According to the output of the function, in procedure I'm inserting data into some other table. Now that procedure is not executing nor getting dropped. If i try either of them in sql developer or cmd it is running and running with no response from db.

DROP PROCEDURE proc_insert_data;

Sql developer was just continuously running there for unlimited time. I checked in user_objects and all_objects: Object id is null and it is invalid.


Solution

  • Perhaps your procedure is locked by some session which is not yet finished. In your case, I guess, the commit operation was not done in some another session.

    You can check the blocking sessions by this:

    SELECT
       s.blocking_session, 
       b.username blocking_username,
       b.osuser blocking_osuser,
       s.sid, 
       s.serial#, 
       s.seconds_in_wait,
       s.username
    FROM
       v$session s,
       v$session b
    WHERE
       s.blocking_session = b.sid
    order by s.seconds_in_wait desc;
    

    Then, after you recognize the session you can easily kill it or ask your administrator to do that.