The most dangerous command in SQL Server

There is one such command in SQL Server that if not used properly,

  1. May corrupt the database (if you don’t have a backup you are lost)
  2. May corrupt the system databases and the server (if you don’t have backup of system databases you are dead)
  3. May loss your job or entire career (if used in production)!

When using this command nothing will be recorded in transaction log! You cannot rollback the changes. The command is:


Using this command, one having sysadmin role can modify any page of any databases. I repeat, “Any page of any databases including system databases”! You can either modify the data or fill with junk bytes. Be away from this as far as you can and never think about executing this in production databases. Fortunately this is an undocumented command and used by SQL Server development teams internally for testing purposes.

Then what is the use of this command? If used this command properly you can create corrupted SQL Server databases for testing your disaster recovery policies and for demo purposes.

You can read more about this directly from Paul Randal, who is the developer of many of the DBCC commands ( Here is another blog that has some interesting demo scripts using WRITEPAGE (



Leave a comment

Filed under Internals

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s