Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save xanthalas/8123ddebeb6c9b0e81fb09abd7f3a95b to your computer and use it in GitHub Desktop.

Select an option

Save xanthalas/8123ddebeb6c9b0e81fb09abd7f3a95b to your computer and use it in GitHub Desktop.
/* Used this after McAfee decided my hard drive was "removable" and set it to read-only as per the company group policy */
/* Making it read-only made all the databases unavailable but once it was writeable again the code below fixed them */
ALTER DATABASE [my_database_name] SET SINGLE_USER WITH NO_WAIT
ALTER DATABASE [my_database_name] SET EMERGENCY
DBCC checkdb ([my_database_name], REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE [my_database_name] SET ONLINE
ALTER DATABASE [my_database_name] SET MULTI_USER WITH NO_WAIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment