:::: MENU ::::

Posts Tagged / Restore

  • Jan 22 / 2018
  • 0
Generate restore script for last full backup of multiple databases
Backup and Restore, dbDigger, T-SQL Scripts

Generate restore script for last full backup of multiple databases

In a previous post i shared various commands and scripts used during databases migration process. Restore script there is not able to generate scripts for multiple databases in a single execution. Following script will generate restore script of multiple databases for their last full backup.

Following are the aspects to consider while using the script

  • Modify the select statement of cursor to get your required databases selected.
  • Modify the WITH parameters in script like REPLACE, KEEP_CDC, RECOVERY and STATS as per your requirement.
  • Any DB without FULL backup will not generate error but will be skipped in result.
  • Once result is retrieved you can review and change the file paths for files before starting the restore on destination server.
  • Setting the result to text will help to select all the scripts in one go.

Set SSMS result toText format

Following is the script to generate restore statements of multiple databases for their last full backups.

 

Consult us to explore the Databases. Contact us