Recover a corrupted database/tables - sql-server

Our customer faces an issue with a corrupted database caused by a 3rd party software. Unfortunatelly they found out too late and no longer have a valid backup to return to. Fixing views etc. is easy but there are couple tables that are unaccessible and contain important data.
When trying to select data from corrupted tables I receive this error:
SQL Server detected a logical consistency-based I/O error: incorrect
pageid (expected 1:7733; actual 114:7667823). It occurred during a
read of page (1:7733) in database ID 5 at offset 0x00000003c6a000 in
file 'C:\Program Files\Microsoft SQL
Server\MSSQL10_50.SQL2008\MSSQL\DATA\aspe_bad1.MDF'. Additional
messages in the SQL Server error log or system event log may provide
more detail. This is a severe error condition that threatens database
integrity and must be corrected immediately. Complete a full database
consistency check (DBCC CHECKDB). This error can be caused by many
factors; for more information, see SQL Server Books Online.
Running DBCC CHECKDB gives this error
Check terminated. A failure was detected while collecting facts. Possibly tempdb out of space or a
system table is inconsistent. Check previous errors.
Running DBCC CHECKTABLE gives the same error as select does.
When running DBCC PAGE I get Metadata: ObjectId = 0, meaning:
If you see the ObjectId is 0, that means there was no metadata found.
This could be because:
The table that the page was part of has been deleted since the page corruption was logged
The system catalogs are corrupt in some way
The page is corrupt and so incorrect values were used to look up the metadata
Checking SQL Server Logs contains only 1 different error and that is:
SQL Server detected a logical consistency-based I/O error: unable to
decrypt page due to missing DEK. Itoccurred during a read of page
(1:7727) in database ID 5 at offset 0x00000003c5e000 in file
'C:\Program Files\Microsoft SQL
Server\MSSQL10_50.SQL2008\MSSQL\DATA\aspe_bad1.MDF'. Additional
messages in the SQL Server error log or system event log may provide
more detail. This is a severe error condition that threatens database
integrity and must be corrected immediately. Complete a full database
consistency check (DBCC CHECKDB). This error can be caused by many
factors; for more information, see SQL Server Books Online.
Honestly I'm at my wits end. Can anyone help me fix this issue? Is it even possible to repair to at least some extent?
Thanks,
Z

Related

SQL Server detected a logical consistency-based I/O error : logical error

Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error:
incorrect checksum (expected: 0xe9f5ce21;
actual: 0xe9f5cc21).
It occurred during a read of page (1:97249) in database
ID 7 at offset 0x0000002f7c2000 in file
'D:\SKYTECHNEW\Database\IMSDATA001SCN.mdf'.
Additional messages in the SQL Server error log or
system event log may provide more detail.
This is a severe error condition that threatens
database integrity and must be corrected immediately.
Complete a full database consistency check (DBCC CHECKDB).
This error can be caused by many factors;
for more information, see SQL Server Books Online.
This message means that your database has a corruption.
As it says you should perform a full database consistency check (DBCC CHECKDB), because there can be more than one corrupted pages.
Update your question with the results of DBCC CHECKDB, your further actions depends on type of pages that are corrupted.

The transient database snapshot for database XXXXX (database ID 8) has been marked suspect due to an IO operation failure

I am having OLA hallengren job for the DBCC checks
When the job runs as per the schedule iam getting below error
The transient database snapshot for database XXXXX (database ID 8) has been marked suspect due to an IO operation failure.
In the error log log i can see below errors
The operating system returned error 665(The requested operation could not be completed due to a file system limitation) to SQL Server during a write at offset 0x00002fc8f40000 in file 'L:\MSSQL10_50.PSPAC01\MSSQL\DATA\XXXXX.ndf:MSSQL_DBCC10'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
The operating system returned error 665(The requested operation could not be completed due to a file system limitation) to SQL Server during a write at offset 0x00006a63e28000 in file 'R:\MSSQL10_50.PSPAC01\MSSQL\DATA\XXXXX.ndf:MSSQL_DBCC10'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
NOTE: But when i manually run the same job it is running fine
I have checked the DEFRAGMENTAION for both the drives but output is stating that "no need to do the defragmentation"
How can this issue be fixed, below is the link for the image

MSSQL DB Browser not coming up

I have couple of database on SQL server which were working fine. Now I am no longer able to explore those. What can be the reason?
Also i am getting below error while trying to turn database on
"File activation failure. The physical file name "D:\Microsoft SQL Server\MSSQL10_50.MSSQLSER\DATA\DB_NAME_log.ldf" may be incorrect.
The log cannot be rebuilt because there were open transactions/users when the database was shutdown, no checkpoint occurred to the database, or the database was read-only. This error could occur if the transaction log file was manually deleted or lost due to a hardware or environment failure."

sql server incorrect checksum error on deployment

When I try to start the Sql Server (SqlExpress) service I got the following message:
I've looked at the log file (C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Log\ERRORLOG) and find out the following lines:
2010-03-09 06:12:35.51 spid7s Error: 824, Severity: 24, State: 2.
2010-03-09 06:12:35.51 spid7s SQL
Server detected a logical
consistency-based I/O error: incorrect
checksum (expected: 0x3ee24b20;
actual: 0x8d0681bd). It occurred
during a read of page (1:375) in
database ID 1 at offset
0x000000002ee000 in file 'C:\Program
Files\Microsoft SQL
Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\master.mdf'.
Additional messages in the SQL Server
error log or system event log may
provide more detail. This is a severe
error condition that threatens
database integrity and must be
corrected immediately. Complete a full
database consistency check (DBCC
CHECKDB). This error can be caused by
many factors; for more information,
see SQL Server Books Online.
2010-03-09 06:12:35.51 spid7s SQL
Trace was stopped due to server
shutdown. Trace ID = '1'. This is an
informational message only; no user
action is required.
How can I solve it?
Thank you!
Sounds like your master mdf file (master database) is corrupted.
Options include:
1. Restoring from backup
2. Detach existing databases (if possible), remove, and reinstall.
You might want to look a little deeper to see why this happened. It might be a failing drive on that machine. In which case, your number one priority is going to be to fix the hardware.
Try DBCC with proper parameters (CHECKFILEGROUP). If that does not help.... try identifying whether the error is in an index (then you can recreate that).
Otherwise.... get the backups. You HAVE backups, or?? ;) (good test for those - could have been a real database, not just the mater)
As this is master...
...detach all databases, get a new master generated (if anything ails reinstall server), reattach databases.
I know this is an old question, this blog post helped me tremendously. Help this will benefit others who run into the same issue down the road.
You should read the article for detailed step-by-step process. But this is the key command.
DBCC CheckTable ('corrupted_table', REPAIR_ALLOW_DATA_LOSS)

Sql server 2005 torn page,error 424

My Dell pc failed;it was blue screen.I fixed that problem by formatting and reinstalling OS and other software that i have been using.Then I recoved my db designed using sqlserver 2005 and other files using recovery tools ;Easy Recovery 6.0.
The problem is : When I try to attach the recovered file(lpdb.mdf),It can not attached.The operation fails with the following message :
TITLE: Microsoft SQL Server Management Studio
Attach database failed for Server 'SAPC'. (Microsoft.SqlServer.Smo)
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
SQL Server detected a logical consistency-based I/O error: torn page (expected signature: 0x55555555; actual signature: 0x4c093c91). It occurred during a read of page (0:0) in database ID 0 at offset 0000000000000000 in file 'F:\Recovered\lpdb_log.LDF'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online. (Microsoft SQL Server, Error: 824)
Is there any who can help me?
I thank you!
Dejene.
Edit
By gbn from other closed question:
Hi mrdanny,
I tried the way you suggested me. The problem is unresolved.
Error is reported : Message One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup.
Is there an alternative solution that i should try? I am going to redesign the database.Please save my time!
Have you a good backup?
Given it says page (0:0), then I refer you to point 1
Use emergency mode and hope for the best. Paul Randall wrote DBCC CHECKDB...
The torn page is in the log file, so rename the log file and use the sp_attch_single_file_db procedure to attach the mdf and generate a new transaction log file.

Resources