Last active
November 27, 2018 14:29
-
-
Save alexruzenhack/6904bf88ba63a2c5fa4d5aeba135c56f to your computer and use it in GitHub Desktop.
💉 Repair #sqlserver database into emergency mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- step 01 - Set the database into emergency mode | |
ALTER DATABASE yourDatabase SET EMERGENCY; | |
-- step 02 - Emegency mode repair | |
ALTER DATABASE yourDatabase SET SINGLE_USER | |
DBCC CHECKDB(yourDatabase, REPAIR_ALLOW_DATA_LOSS); | |
-- steop 03 - Unlock the database setting it into multiuser again | |
ALTER DATABASE yourDatabase SET MULTI_USER; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment