Created
June 17, 2019 08:44
-
-
Save fnzv/b8e31b0eea9478195e573d3f7fbc068e to your computer and use it in GitHub Desktop.
Useful MSSQL Scripts
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 ' DROP DATABASE [' + NAME + ']' FROM sys.sysdatabases where name like 'PREFIX%' |
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
#Import-Module dbatools | |
# https://medium.com/@Luis_Palacios/restoring-multiple-database-in-sql-server-from-bak-files-751051798ab4 | |
$databaseDirectory = "D:\Backup\" | |
Restore-DbaDatabase -SqlInstance localhost -Path ("{0}{1}" -f $databaseDirectory, "DB_NAME_1.bak") | |
Restore-DbaDatabase -SqlInstance localhost -Path ("{0}{1}" -f $databaseDirectory, "DB_NAME_2.bak") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment