How to get script of backup and restore of multiple databases

Scenarios

Created a new SQL Server  instance and would like to backup/restore all databases from an old SQL Server. The number of databases are approx 99+. Manually backup and restore each database with SSMS is a time-consuming activity. Let’s try to make backup scripts of all databases and also a restore script of multiple databases.

Get the script of backup and restore of multiple databases

Backup Script

Execute the below script on SQL Server. Change the backup folder location as per your requirement.

As a result, we will get a script. Now we need to execute the same on the same SQL Server to perform the backup process.

Restore Script

Now execute the below script on SQL Server, remember we have to use the backup folder location in the script.

Enjoy !! 🙂

Facebook Comments Box
Please like or share this post if you found it helpful, thank you.
Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Email this to someone
email
Print this page
Print

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *