Follow by Email

Monday, October 28, 2013

ORA-08103: object no longer exists

I got this exception while I was trying to run a procedure (written by somebody else in our company) which takes very long time to execute , I found that because of the below sequence of events I was getting this exception

Steps Which Produced This Problem
  1. Procedure was opening a cursor (selecting records) , keeping it open for sometime during which it had to do other operations
  2. After finihing those operations it was trying to execute a loop on the cursor (It created before) and was getting this problem.
Reason
     I found that during this time some of those records my cursor was refering to were deleted , and when the cursor tried to fetch those records in the loop there I was getting "ORA-08103: object no longer exists".

Solution
    The only solution I have in mind is to open the cursor and start  utilizing it immidiatly , i.e. don't keep it open waiting for someother operations to finish.This way I will be able to minimoze the probability of this problem to occur in future.

I was trying to fetch the records in a generic oracle table (which I inserted) , another possible reason could be that you have insert rights but don't have select rights on that table. This was not the case in my situation as I had all the rights on the table but I am sharing it here to give you another possible reason of this problem.

Please also have a look at below Stackover threads for detailed discussions on this problem

http://stackoverflow.com/questions/18747649/exception-ora-08103-object-no-longer-exists-on-using-setfetchsize-of-hirabenate

http://stackoverflow.com/questions/2696519/global-temporary-table-on-commit-delete-rows-functionality-discrepancy

No comments:

Post a Comment