CHAPTER 26

image

Backup

By David Dye

In this chapter, you’ll find recipes covering several methods of backing up a database using T-SQL. This chapter is in no way meant to be a comprehensive source for database backups but rather provides greater insight into the problems or limitations you may encounter. This chapter will outline the different types of backup methods using T-SQL as well as how to query the msdb database to find information about backup information.

26-1. Backing Up a Database

Problem

You want to do a full backup of the AdventureWorks2012 database to your C:\Apress\ folder using T-SQL.

Solution

Execute a BACKUP DATABASE statement. ...

Get SQL Server 2012 T-SQL Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.