Created
July 8, 2022 11:11
-
-
Save davidsheardown/82fb5d6dc095900084057a210e950771 to your computer and use it in GitHub Desktop.
How to recover MS-SQL suspect database
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
SELECT DATABASEPROPERTYEX (N'SQL-Examples', N'STATUS') AS N'Status'; | |
ALTER DATABASE [SQL-Examples] SET EMERGENCY; | |
GO | |
ALTER DATABASE [SQL-Examples] SET SINGLE_USER; | |
GO | |
DBCC CHECKDB (N'SQL-Examples', REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS, ALL_ERRORMSGS; | |
GO | |
-- Remember to set back to multi-user | |
ALTER DATABASE [SQL-Examples] SET MULTI_USER; | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment