Friday, September 2, 2011

How to resolve error “msg 823, level 24, state 2, line 1”

One day I was trying to connect SQL server which located on a different computer by the following procedure –
(Connect to a SQL server >>>open the table file >>>and then execute) & suddenly I got an error message


““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““
Server: Msg 823, Level 24, State 2, Line 1
I/O error (bad page ID) detected during read at offset 0x00000411412000 in file 'E:\Program Files\Microsoft SQL Server\MSSQL\data\SQLfile.mdf'.
Connection Broken

””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””

 
After this error message I am not able to access my database.

 
After that I performed following actions:

 
1) I check DB  using "DBCC CHECKDB ('SQLfile', REPAIR_REBUILD)
It shows the following error message:


““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““ 

Server: Msg 8909, Level 16, State 1, Line 1
Table error: Object ID -1, index ID 65535, page ID (1:1347). The PageId in the page header = (65535:-1).
Server: Msg 8929, Level 16, State 1, Line 1
Object ID 2: Errors found in text ID 4391632896 owned by data record identified by RID = (1:426:25) id = 694397643 and indid = 7.
””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””

 
2) I copied .mdf and .ldf to another SQL server and attached it & try to run the query. Again it shows same error message.


I discussed this problem with one of my friend & he guided me to discuss this issue on some good SQL forums where we can easily communicate with SQL experts & also got proper solution. He suggest me three SQL forum sites MSDN forum, SQLteam, SQL Server Central. After a huge discussion on these three forums, I found that there is no single cause of this error & it is also not necessary that you got this error message in same situation like me, Here I am describing the cause that I found through "DBCC CHECKDB" command. I got following solutions by these three forums:


1) Your mdf file gets corrupt. You will need to extract all the data (all database files mdf & ldf) and reload it into a new SQL database. First, you need to correct the underlying cause of the corruption. When I got this error, I found it has been caused by a hardware problem. Your storage system is unreliable and needs to be fixed. - John


I tried same solution given by John, but still I got same error message, then I understand my mdf file get severely corrupted.


2) Do you have a backup to restore from? That is better to first recourse than extracting everything into a new database. It may also be better to allow repair to run and then backup your database. This will be more efficient than extracting to a new database. -Johnson


I don't follow the Johnson's solution because I did not have updated backup.


3) Your mdf file gets severely corrupted. To resolve this error try third party software. These software are very easy to use & recover your database in few steps.- Prett


In last I follow Prett's solution & I tried lots of SQL Recovery Software demos, most of the software doesn’t have demos accept two or three. In last I tried Stellar Phoenix SQL Recovery Software demo version, in preview it shows all files of corrupt database which are recoverable. After that I purchased full version to save repaired database. Finally I got all my data back with the help of Stellar Phoenix SQL Recovery Software.
 


After all experience, I will only suggest to all the users that before purchasing any recovery software first try its demo version after that purchase it.

No comments:

Post a Comment