Skip to content

Instantly share code, notes, and snippets.

@MarshalOfficial
Created October 21, 2015 12:50
Show Gist options
  • Select an option

  • Save MarshalOfficial/86375cc5d5decc968664 to your computer and use it in GitHub Desktop.

Select an option

Save MarshalOfficial/86375cc5d5decc968664 to your computer and use it in GitHub Desktop.
recover suspect database (warning:don't run all lines in one batch script)
EXEC sp_resetstatus 'test_dr';
ALTER DATABASE test_dr SET EMERGENCY
DBCC checkdb('test_dr')
ALTER DATABASE test_dr SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('test_dr', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE test_dr SET MULTI_USER
DBCC CheckDB ('test_dr')
ALTER DATABASE test_dr SET Online
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment