SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts 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: 629 | Views in the last 30 days: 2
Related Articles

Backup & Restoration Script

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


Restore script for Ola Hallengren backup

Create a restore script based on backup files in a directory


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