Last active
May 27, 2020 12:29
-
-
Save Laim/277f17c7fedd9860d8b71aace002a74c to your computer and use it in GitHub Desktop.
Restore SQL Server 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
-- Take the database offline before restoring | |
ALTER DATABASE [DatabaseName] | |
SET OFFLINE WITH ROLLBACK IMMEDIATE | |
-- Restore the database | |
RESTORE DATABASE DatabaseName FROM DISK = '\\FileServer\directory\servername\database\database_backup.bak' | |
-- Bring it back online, this should be automatic but just incase. | |
ALTER DATABASE [DatabaseName] | |
SET ONLINE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment