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)

Automatically Restoring from Production

By Ryan,

Came across a great script from Ken Kaufman on copying backups using xp_cmdshell.  Thought I'd contribute a script I wrote that builds on that to restore the latest production backup to a testing or development server. 

In this case I routinely create all my production backups to a network share and then use that source to restore the database in on my beta server.  this way I ensure all the data as well as the schema are exact mirrors.  Last step I do is to update permissions between the two copies.

If anyone has any comments or suggestions please let me know.  Scripting it this way proved to be a blessing since it was just about impossible to keep the changes to schema objects in sync on my development server, and manually determining which backup to restore was always a manual process.

Total article views: 620 | Views in the last 30 days: 1
Related Articles

Backup & Restoration Script

This script provides very useful information about database backup and restoration.


SQL Server Backup & Restore startergies

SQL Server Backup & Restore startergies


Powershell SQL Server Backup/Restore

I posted a script on Poshcode for doing backups and restores of SQL Server databases using SMO. The ...


Script to restore red gate backups automatically from a folder.

Restore of red gate backup files using a SQL Script


Restore database from a device containing multiple backups

Script to restore the LATEST full and differential backups from a SQL Server 2008 R2 backup device.


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

Already a member? Jump in:

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