HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Corrupt a database page in a certain table then restore it

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
corruptrestoredatabasepagethencertaintable

Problem

I want to corrupt a page inside a certain table and restore it.

How do I do that on SQL Server?

Solution

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 Simon Lieu describes.

Erik Darling also shows you a way to use DBCC WRITEPAGE, generating dynamic commands with dm_db_database_page_allocations.

For the single-page restore, see the documentation or Brent Ozar again.

Context

StackExchange Database Administrators Q#292749, answer score: 13

Revisions (0)

No revisions yet.