16 votes
Accepted

Master database is corrupt, instance won't start - what are my options?

Here are a few avenues I would investigate. Don't do all of these (some of them are different techniques to accomplish the same purpose), but are worth considering: 1. Examine the SQL Error Log ...
BradC's user avatar
  • 9,954
14 votes

MySQL relay log corrupted, how do I fix it? Tried but failed

[Fixing MySQL replication after slaves' relay log was corrupted] MySQL replication on slave (version 5.XX) has stopped. Slave_IO_Running was marked as Yes, but Slave_SQL_Running as No. Simple stop/...
Mohamed Ayas's user avatar
13 votes

Corrupt a database page in a certain table then restore it

If you really want to do this, one way is to use a hex editor as Kendra Little explains, or perhaps you would prefer Brent Ozar's take on the same approach. An alternative is to use DBCC WRITEPAGE as ...
Paul White's user avatar
  • 83.7k
11 votes
Accepted

How to repair corruption for "Possible chain linkage problem."

When facing database corruption, you will need to determine the extent of the problem. Do you have one corrupt table/index, or many? You will probably want to run DBCC CHECKDB on the database. ...
RDFozz's user avatar
  • 11.6k
11 votes
Accepted

How do pages get updated checksum when switching page verification mode from torn page to checksum?

It won’t happen all at once. Each page will get changed independently when it is modified through some other action (e.g. insert or update). This was done precisely so that this change would not be a ...
Aaron Bertrand's user avatar
10 votes

What is the SQL server mechanism to ensure that the page being restored isn't corrupted?

It wont. If you have a corrupted page in a backup file and you restore it, SQL will restore it (and it won't raise any error). It's your job to run checkdb frequently and make sure you do not backup ...
Dominique Boucher's user avatar
10 votes
Accepted

What is the SQL server mechanism to ensure that the page being restored isn't corrupted?

It is the responsibility of the DBA to have an adequate maintenance plan in place and to ensure the integrity of the running database and the database backups. DBCC CHECKDB() is the tool to check for ...
John K. N.'s user avatar
  • 17.6k
9 votes
Accepted

Backup detects corruption, but CHECKDB does not

This answer is taken from an issue of the SQLskills.com newsletter written by Paul Randal, about "a database which would fail a backup with page checksum errors, but passed a DBCC CHECKDB". The ...
Randolph West's user avatar
8 votes

Corrupted InnoDB table, mysqlcheck and mysqldump crash server

For what it's worth, I've found that mysqlcheck -o can effectively repair corrupted InnoDB tables since it in fact does a "recreate + analyze". I had a corrupt table that was preventing mysql from ...
But those new buttons though..'s user avatar
8 votes
Accepted

Backup Compression Causing Corruption In SQL 2017 TDE Database

It looks like this issue is with databases that have had SHRINK operations run on them. In my case, I was taking a copy of one of our production databases on SQL Server 2014 (which is already ...
Eric Cobb's user avatar
  • 561
7 votes

Random Error 824 - All Environments

82x errors are rarely, if ever, a SQL Server issue as these are all error codes on something that doesn't make sense or has errored when returning to SQL Server code. For example, with 824 this can be ...
Sean Gallardy's user avatar
6 votes
Accepted

Reattaching MDF files recovered from RAID 5

Is there any way at all to restore these files? No. The long answer is like this: you first will have to fix the MDFs. Attempt to attach it with ATTACH_REBUILD_LOG as you encounter errors (like ...
Remus Rusanu's user avatar
  • 51.8k
6 votes

Export data using bcp to deal with corrupted data

First, here's my checklist on how to tackle corruption issues. It's a big deal - bigger than I can cover here - but based on the sounds of this, I don't think you've covered some of the basics (like ...
Brent Ozar's user avatar
  • 42.9k
6 votes

How I can corrupt a data base page and again restore the same

I love this question! To demo, I'm going to use a local copy of the Fitness database from the Stack Overflow data dump. First, make sure your database is in FULL recovery, and take a full and log ...
Erik Darling's user avatar
  • 40.6k
6 votes
Accepted

Database corruption on VM shutdown

As far as I know database corruption can happen if the machine restart in the middle of a transaction No. Database corruption is only caused by faults in the storage system or bugs. SQL Server will ...
David Browne - Microsoft's user avatar
5 votes
Accepted

How to run OPTIMIZE TABLE on a 3-node cluster?

If there is a need to run OPTIMIZE TABLE in PXC, you could achieve this by denying its recording into binary logs into one of three(3) ways: METHOD #1 SET sql_log_bin = 0; OPTIMIZE TABLE mydb....
RolandoMySQLDBA's user avatar
5 votes
Accepted

Is there a Maintenance Plan that checks my database for corruption?

Good question. The integrity check in the maintenance plan is enough since it will run a dbcc checkdb. From MSDN: integrity check The Check Database Integrity task encapsulates the DBCC CHECKDB ...
RayofCommand's user avatar
  • 1,353
5 votes

Table Corruption Error

Does the database open and you just can't view a single table, or are you unable to browse your database at all? Are other databases on the server affected, or just one? What's the current database ...
SqlRyan's user avatar
  • 1,228
5 votes
Accepted

Database corruption: QueryStore internal table

As noted in my comment above I had a similar corruption issue with a query store internal table. As you yourself have suggested I used ALTER DATABASE MyDatabase SET QUERY_STORE CLEAR; to attempt to ...
Matthew McGiffen's user avatar
5 votes
Accepted

Shrink data file corruption risks?

No, shrink is safe. Unless you hit some bug in SQL Server of course, but that can happen whatever you do. The shrinkage is done as a series of mini transactions and it is also safe to terminate the ...
Tibor Karaszi's user avatar
4 votes

Oracle: dbms_repair outputs zero errors about known corrupted object

What's left to attempt? You can just instruct the database to skip corrupt blocks on a table scan: begin dbms_repair.skip_corrupt_blocks( 'USER', 'TABLE_NAME', dbms_repair.table_object, ...
Balazs Papp's user avatar
  • 40.7k
4 votes

sp_MSforeachdb Continue on failure when running DBCC CHECKDB

I know this is an old post, but I'm adding this answer in case someone comes across it. The most likely cause is that the error is so severe (it has a severity of 20 or higher, most likely 22, 23 or ...
HandyD's user avatar
  • 9,932
4 votes
Accepted

How to repair database corruption from backup?

You don't repair it using the backup. You restore from a prior backup which is clean. I.e., the basics are, after detecting the corruption: Perform the last log backup if possible, make sure that no-...
Tibor Karaszi's user avatar
4 votes
Accepted

Random Error 824 - All Environments

Have you seen https://www.sqlservercentral.com/blogs/vmware-sql-server-823-824-alerts ? Not sure if you’re running on VMWare and which version, but there is a known issue with VMware vSphere 7.0 ...
Hans's user avatar
  • 56
3 votes

ANALYZE TABLE..VALIDATE STRUCTURE runs forever

UPDATE: What Worked... So after reading the link from @Raj and reading @ora-600's answer I tried to validate the database with the RMAN command backup check logical validate database;. While this ...
RBarryYoung's user avatar
  • 3,041
3 votes

How to check a database for a specific page

To get information about a particular page in SQL server, you'll need to use the undocumented DBCC PAGE command. Or if you are using SQL Server 2012 and higher, you can also query the sys....
Christoph Wegener's user avatar
3 votes

Is there a Maintenance Plan that checks my database for corruption?

@RayofCommand, has already given an appropriate answer, but will like to add more which is very helpful and easy to track for any corrupt databases using SQL Server Integrity Check from ola hallengren....
KASQLDBA's user avatar
  • 7,149
3 votes

SQL Server Backup transaction error

You appear to have corruption in your transaction log file. This needs to e resolved before you continue with you mirroring configuration. Where is the error log? Using SSMS the error log can be ...
James Anderson's user avatar
3 votes

Attempt to fetch logical page (5:65424) in database 2 failed

What you would hear from a lot of people is "the database is corrupt, you need to restore" without even recommending that you take some few mins to do some of the following; review your logs, find ...
daffyjeje's user avatar
  • 111
3 votes
Accepted

PostgreSQL 9.1 runs into inconsistent data, but pg_dump corrects the problem?

Might be index corruption - assuming you have an index on sal_id. If so, REINDEX TABLE salXXXX; (or just REINDEX INDEX index_name would do the same trick as your dump/restore cycle, which also ...
Erwin Brandstetter's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible