The following commands always causing for me a system assertion check failure:
use master
alter database MyDatabase set ACCELERATED_DATABASE_RECOVERY = ON;
use MyDatabase
begin tran
delete MyTable where id < 5000
rollback
use master
alter database MyDatabase set ACCELERATED_DATABASE_RECOVERY = OFF;
use MyDatabase
begin tran
delete MyTable where id < 5000
rollback
The following assertion check is displayed on error:
(4999 rows affected)
Location: sql\ntdbms\storeng\include\page.inl:1067
Expression: sid >= m_slotCnt || m_slots[-sid].GetOffset () ==0
SPID: 58
Process ID: 16204
Msg 3624, Level 20, State 1, Line 45
A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a Hotfix from Technical Support.
Msg 3314, Level 21, State 3, Line 45
During undoing of a logged operation in database 'testABCD121121212' (page (1:587) if any), an error occurred at log record ID (41:15752:352). Typically, the specific failure is logged previously as an error in the operating system error log. Restore the database or file from a backup, or repair the database.
Msg 3314, Level 21, State 5, Line 45
During undoing of a logged operation in database 'testABCD121121212' (page (0:0) if any), an error occurred at log record ID (41:4712:1). Typically, the specific failure is logged previously as an error in the operating system error log. Restore the database or file from a backup, or repair the database.
Msg 596, Level 21, State 1, Line 32
Cannot continue the execution because the session is in the kill state.
Msg 0, Level 20, State 0, Line 32
A severe error occurred on the current command. The results, if any, should be discarded.
It also depends on how many database records deleted. With fewer records, the error happens rarely but with 5000 or more its happens every time for me. It doesn't work if there any other command instead of the first delete command but the second delete command can be any command that changes rows.
After the error database turns into suspect mode and I unable to recover data from it. Is there any fix for this or any way to repair the database?
DBCC seems to be unable to repair it. It is likely to be caused by two identical FORWARDING_STUB records pointing to the same FORWARDED_STUB record in the database file.