CHAPTER 27

image

Backup

By Jason Brimhall

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.

27-1. Backing Up a Database

Problem

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

Solution

Execute a BACKUP DATABASE statement ...

Get SQL Server T-SQL Recipes, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.