O'Reilly logo

Microsoft® SQL Server 2012 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul T. Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Database Copies for Backup and Restore

You’ve already seen how to create database copies using the CREATE DATABASE AS COPY OF command. You can also use database copying as a simple backup and restore methodology. To do this you first create a T-SQL backup script that works against your SQL databases. Next you incorporate this script into a scheduled job that executes using your local installation of SQL Agent. One example might resemble the following scenario.

Every evening your backup script creates a fresh copy of your production database, naming it with a suffix indicating the current day, month, and year (e.g., MyDatabase_03_10_2013). After accumulating the desired maximum number of copies, your script drops the oldest copy before creating ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required