Monday 23 November 2015

Solution for Fatal error 3864 occurred in SQL server

While i was altering a SQL procedure i was getting Fatal error 3864. The details error message are:

Error:
Msg 21, Level 23, State 1, Procedure usp_getPublicArchiveslist, Line 17
Warning: Fatal error 3864 occurred at Nov 23 2015 12:04PM. Note the error and time, and contact your system administrator.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command.  The results, if any, should be discarded.


Causes:
I was trying to fix this problem, in order to search on web i found the error list where it was clearly mentioned that, Could not find an entry for index with ID %d on object with ID %d in database with ID %d. Possible schema corruption. Run DBCC CHECKDB.

Attempt:
1: I got hint from above line and i tried  DBCC CHECKDB, but unfourtunallty i was getting A severe error occurred on the current command.  The results, if any, should be discarded.

2: Hence i decided to drop the procedure and again create a new procedure. So i executed
drop proc command in SQL server editor. And i got again error:
Msg 3864, Level 23, State 1, Line 1
Could not find an entry for index with ID 2 on object with ID 41 in database with ID 55. Possible schema corruption. Run DBCC CHECKDB.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command.  The results, if any, should be discarded.

3: Finally i restored database with last backup that i had, that worked for me.