Created
November 10, 2014 09:21
-
-
Save shaxxx/ba301af99c714d73a066 to your computer and use it in GitHub Desktop.
Auto repair suspected DB in MSSQL
This file contains hidden or 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
USE master | |
GO | |
ALTER DATABASE DatabaseName SET EMERGENCY | |
GO | |
USE DatabaseName | |
GO | |
DBCC CHECKDB WITH NO_INFOMSGS | |
GO | |
ALTER DATABASE DatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE | |
GO | |
DBCC CHECKDB (DatabaseName, REPAIR_ALLOW_DATA_LOSS) | |
GO | |
ALTER DATABASE DatabaseName SET MULTI_USER | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment