Do you know how to restore a bacpac file in SQL Server? You may wonder why you ever need to do it. Well, if you are working in Sitecore, then there are high chances at some point of time in your career, you may be asked to take backup of Sitecore databases in a higher environment and then restore them in lower environment. Recently, a friend of mine was trying to do the same. He was trying to use restore database option as in snapshot below but it did not work out as expected -
It turned out that Restore Database method is used for restoring .bak files but the backup files he had were bacpac files which have a slightly different restore process. So, I thought other fellow sitecorians may also face similar issue. Why not share it with the community as well.
Bacpac vs Bak file
Lets first understand what is the difference between bacpac and bak file. Why there are 2 different types if we are trying to achieve the same goal to restore database?
Bacpac is a dacpac file but with data included, bak is a database backup. One is used for defining how a new database is built, so if you were building it out with sql projects in a tool like visual studio or wanting to use DevOps patterns for CICD; you’ll want dacpac/bacpac.
If you’re doing a migration to a new server and you’re using tools like ssms then no need to muddy the water, keep the way you’ve always done it. Database backup and restore is perfectly fine and preferable in most cases. You can always onboard to dacpac/bacpac later if you want to use devops.
How to restore a bacpac file?
Once restore finishes, you are all set to update your Sitecore instance's connectionstring to point to restore databases and use it.
Comments
Post a Comment