Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved in your SSC briefcase from the favorites tab.
Download now (direct download link)

build_restore_script

By fhanlon,

This script originally created by Greg Larsen has been modified by me. This procedure is used to create the restore commands needed to restore a database using the lates full and any transaction or differential backups. The parameter @dbname was added to just create the restore statements for a particular database. Leaving off this parameter will create the restore commands for all databases. I use 3rd part compression software (SQL Backup) to the restore statement created will depend on the backup name. In this case I assumed if the extension for the backup filename is sqb then the backup is compressed and a SQL Backup restore command is created; otherwise a native SQL Server restore statement is generated. If you use Litespeed of some other 3rd party backup software this statement must be modified slightly. Otherwise normal SQL restore statements are generated. The results can be cut and pasted into another window for execution. I store this proc in a DBA databases that I attach to each server. Hope it helps

Total article views: 1184 | Views in the last 30 days: 9
 
Related Articles
FORUM

database backup and restore in sql server 2005

database backup and restore using java

FORUM

Restore from Backup with Replicated Database

Restore from Backup with Replicated Database

FORUM

Restore with no backup

Database dropped, no backup. Need to restore

SCRIPT

Restore database with all necessary files

It creates the script for restoring your database with all the backups (full, differential and trans...

SCRIPT

Restore Latest Backup with Powershell

Restores the latest backup of a database to a destination server of your choice, and creates a new b...

Tags
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones