Restoring multiple database in SQL Server from .bak files

  1. Install dependencies such as (git, Dotnet SDK , visual studio code, Nodejs , etc)
  2. Replace template configuration files with your local development settings(connection string etc.)
  3. Restore packages
  4. Run Database migrations and Seeding (we would normally use code first)
  5. Run the app and explore!
  1. You could generate T-SQL scripts that includes the database schema and some starting data and make each developer run the scripts while they are getting set up, if you add something like DbUp you end up with something very similar to migrations but a little harder to maintain.
  2. And the infamous .bak files being passed around from one place to another restoring those things, SQL server version incompatibility problems, “ops that was not the right .bak file”. Yep that’s what I remember from my good old days doing .Net enterprise development and such was my case not so long ago when while getting setting up in a new project I received a link pointing to 2.2Gb of .bak files that I needed to restore on my local SQL Server Instance.
Just a “Install-Module -Name dbatools”
That Restore-DbaDatabase looks promising
The two database before the red rectangle didn’t exist before running the script
All the database in the blue rectangle were created by the scripts
  1. SQL Server Instance Name
  2. Credentials if you want to use SQL login
  3. Directory where your .bak files are
  1. .Bak files must always have the same name by project otherwise you would have to update the script before running it :(
  2. When running Restore-DbaDatabase the path must accesible by your local Sql Server Service account otherwise you will run into errors




Passionate Christian, Husband and Software Developer. More about me at:

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to deal with emotional burnout. On the example of Crodo.

Mastering the AV1 SVC chains

Senior meets junior lessons learned

Why product development is difficult

Boyer-Moore Majority Voting Algorithm Intuition

The Jenkins — Part 5

Docker Tuto part7 M1에서 실행

Lists in python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Luis Palacios

Luis Palacios

Passionate Christian, Husband and Software Developer. More about me at:

More from Medium

Setting Up A Local SQL Server Developer Instance

Filter/Map/Reduce JSON data in PowerShell

Code Completion in Vs Code for JSON Objects in PowerShell

Azure DevOps — Create CI/CD pipelines — Hands On

Azure: should I use Single Tenant or Multi Tenant?

SQL Server Static Data Masking