Search

Monday, March 28, 2011

A severe error occurred on the current command. The results, if any, should be discarded.

Error Messages:
  • Msg 5242, Level 22, State 1, Line 2
  • An inconsistency was detected during an internal operation in database 'Data'(ID:13) on page (1:26292). Please contact technical support. Reference number 4.
  • Msg 3316, Level 21, State 2, Line 2
  • During undo of a logged operation in database 'Data', an error occurred at log record ID (68865:616:348). The row was not found. Restore the database from a full backup, or repair the database.
  • Msg 3314, Level 21, State 4, Line 2
  • The log for database 'Data' is not available. Check the event log for related error messages. Resolve any errors and restart the database.
  • Msg 3314, Level 21, State 5, Line 2
  • During undoing of a logged operation in database 'Data', an error occurred at log record ID (68847:438:1). Typically, the specific failure is logged previously as an error in the Windows Event Log service. Restore the database or file from a backup, or repair the database.
  • Msg 0, Level 20, State 0, Line 0
  • A severe error occurred on the current command. The results, if any, should be discarded.

    Solution:


    All the above mentioned error occurs due to Data corruption in database.

    To recover from this error you should run the following queries. Please use the following steps…

    1. Take a current backup of the Database (Strictly recommended)
    2. Go to Start > All Programs > Microsoft SQL Server 2005 > SQL Server Management Studio Express
    3. Click on New Query button.
    4. run the following Queries one by one

      • ALTER DATABASE your_database_name SET SINGLE_USER
      • Go
      • DBCC CHECKDB ('your_database_name', REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS, NO_INFOMSGS
      • Go
      • ALTER DATABASE your_database_name SET MULTI_USER
      • Go

    Notes: Make Sure All Connection with the Database is stopped at that time.

14 comments:

  1. I'm getting the "log for database 'Data' is not available" error (on a Database create via SMO) but I can't run these commands becasue I get the same error back.

    The SMO code I "inherited" was a written for SQL 05 Express and now is run against sql 08 R2 Express

    ReplyDelete
  2. What to do if the error message number four in your list happens in tempdb database (that is "Data" is tempdb)? When I try to execute code "ALTER DATABASE tempdb SET SINGLE_USER" I recieve the error message "Option 'SINGLE_USER' cannot be set in database 'tempdb'". Also I have 135 rows in the table "msdb.dbo.suspect_pages" and for all of them the "database_id" column is 2 (so it's a tempdb) and these rows do not go away after I restart server (in this case tempdb is recreated). Vladimir

    ReplyDelete
  3. Hi,

    I run your opinion (your query ) succesly.

    but my problem is not resolve ?

    ReplyDelete
  4. One such tool that you can use is http://www.sqlrecoverysoftware.net/blog/sql-error-3301.html

    Hopefully you will be able to resolve these errors and repair SQL Server database with it.

    ReplyDelete