Common SQL Server Backup Problems

17
Grant Fritchey | www.ScaryDBA.com www.ScaryDBA.com Common Backup Problems Grant Fritchey, Red Gate Software

description

There are a number of common backup problems that occur within SQL Server. This presentation goes over those problems, how they evidence themselves, and how you go about addressing the issues.

Transcript of Common SQL Server Backup Problems

Page 1: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

www.ScaryDBA.com

Common Backup

Problems

Grant Fritchey, Red Gate Software

Page 2: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Goals

Identify common backup issues

Prevent those issues from occurring

2

Page 3: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Agenda

SQL Server Backups

File Backups

Drive Space

Full Transaction Log

Network Backups

Differential Only

Broken Backup Chain

The Wrong Server

Backup Load

Backup Testing

3

Page 4: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

[email protected] www.scarydba.com

@gfritchey www.linkedin.com/in/scarydba

Grant FritcheyProduct Evangelist, Red Gate Software

Page 5: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

SQL Server Backups

Complete copy of the database» Not an export» Not a script» Not a file copy

Principal means of protecting the business data

Multiple Backup Types» Full» Differential» File/FileGroup» Log» Partial

5

Page 6: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

File Backups

Indications» File backup only» Expected restore from .MDF & .LDF files

Cause» SQL Server locks the files while they’re in use

Remedy» Run a real backup» Stop the server, copy the files, start the server

(and no, I’m not serious)

Emergency» Try using ATTACH, but don’t hold out hope

6

Page 7: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Drive Space

Indications» Errors on backup» Alerts on drive space» No backups available

Cause» Not monitoring drive space» Database size increased

Remedy» Monitor your drive space» Clean up backups» Monitor database size

Emergency» If the backup failed, no options

7

Page 8: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Full Transaction Log

Indications» Log files constantly growing» Transaction errors caused by full file

Cause» Log backups failed» Log backups never implemented

Remedy» Set up scheduled log backups» If FULL RECOVERY not needed, switch to SIMPLE

Emergency» Attach an additional log file

— Not always possible

8

Page 9: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Network Backups

Indications» Backups extremely slow» Timeout on backups» Resource contention on server

Cause» Backing up across network instead of through

dedicated fiber channel

Remedy» Backup to “local” drive» If needed backup locally then copy the file

Emergency» Do it anyway

9

Page 10: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Differential Only

Indications» Error, no files ready to roll forward

Cause» No FULL restore run» Full restore run, but database recovered

Remedy» Run a FULL restore» Use WITH NORECOVERY on restore» Make sure you have a FULL backup

Emergency» With no full backup, no options

10

Page 11: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Broken Backup Chain

Indications» Error: Database has not been restored to the correct

earlier state Cause

» Wrong Full backup» Extra Full backup taken

Remedy» Use correct Full backup» Use SNAPSHOT» Use COPY_ONLY

Emergency» If you have all the log backups, you can use those

instead

11

Page 12: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

The Wrong Server

Indications» Phone is ringing

Cause» Ran a restore on wrong server» Used WITH ROLLBACK IMMEDIATE

Remedy» Use different security for production» Color code production servers» Don’t use ROLLBACK IMMEDIATE

Emergency» Yes it is

12

Page 13: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Backup Load

Indications

» Excessive CPU or I/O contention

» Waits on backups

» Blocking

Cause

» Excessive load on server makes backups difficult

Remedy

» Backup from AlwaysOn

Emergency

» Do what you must

13

Page 14: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Backup Testing

“You’re only as good as your last restore” Kimberly Tripp (as far as I can determine)

DBCC» Against Production» Against a Backup

CHECKSUM» Added overhead

VERIFYONLY» Header only without checksum

RESTORE» Like nuking from orbit, the only way to be sure

14

Page 15: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Goals

Identify common backup issues

Prevent those issues from occurring

15

Page 16: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Resources

Scarydba.com/backup

Preventable Backup Errors: http://www.simple-talk.com/sql/database-administration/7-preventable-backup-errors/

Backup and Restore for the Accidental DBA: http://www.simple-talk.com/sql/database-administration/sql-server-backup-and-restore-for-the-accidental-dba/

SQL Server Backups: http://www.simple-talk.com/sql/backup-and-recovery/sql-server-2005-backups/

16

Page 17: Common SQL Server Backup Problems

Grant Fritchey | www.ScaryDBA.com

Questions?

17