Are the Native SQL Server Backup Utilities Holding You Back?
-
Upload
sqldbapros -
Category
Technology
-
view
495 -
download
0
description
Transcript of Are the Native SQL Server Backup Utilities Holding You Back?
Are the Native SQL Server Backup Utilities Holding You Back?
Jason Hall Manager, Database Systems Consulting
2 Confidential Dell Software
Agenda • Introductions
– Speaker
– Topic
• Native Backup/Restore Limitations and Considerations – Full vs. Diff Backups
– Backup Job Management
– Backup Reporting
– Backup Reliability
– Always On Availability Groups
– Restoring Only What You Need
– Backup Security
• Q&A Taken Throughout via GoToMeeting
3 Confidential Dell Software
Who Are These Guys?
• Jason Hall: Manager, Database Systems Consulting
• David Gugick: Senior Product Manager, Backup and Recovery Solutions
• Started w/ LiteSpeed in 2004
• Helped customers architect backup and recovery solutions
• Frequent speakers at SSUG’s and Conferences
• Always available – @jasonfhall or [email protected]
– @davidgugick or [email protected]
4 Confidential Dell Software
What Are We Going to Talk About?
• Microsoft has always provided a very capable B&R solution
• Comes with limitations
• Several facts that must be considered when implementing
• Explore what those limitations and considerations are while offering suggestions on how to work around
• Lots of demo’s!!!
5 Confidential Dell Software
Native Backup Limitations
6 Confidential Dell Software
Full vs. Differential Backups
7 Confidential Dell Software
Full vs. Differential Backups
• Deduplication?
• Seems like a no brainer right?
• Differential backup challenges – Reliance on full backup
– Effectiveness is dependent on amount of data change
– Backup retention gets much more complex
8 Confidential Dell Software
Reliance on Full Backup
• A differential backup without its associated full is useless
• Scenarios that can affect the full backup – File is mistakenly deleted
– File is moved to an unknown or inaccessible location
– File moved to tape and shipped offsite
– A new full backup (w/out COPY_ONLY) is taken
– File has become corrupted or unrecoverable
9 Confidential Dell Software
Amount of Data Change
• Differential backups only make sense when a small % of data has changed
• Situations where data can change: – Unusual application activity
– Unscheduled data loads/purges
– Database Maintenance (Index Rebuilds)
• Lots of change means large Differential backups – You don’t save time, space, and…
– It can double (or worse) your recovery time
10 Confidential Dell Software
File Retention
• Ensure that you are not deleting Full’s that are required for Diff/Log restores
• Full on Sunday, Diff’s Mon – Sat, Don’t delete older than 3 days
• If 2nd Full Backup fails, make sure previous full is not deleted. – F
– D
– D
– D
– F (failed) – D
– D (still good, just points back to first full)
11 Confidential Dell Software
Tips & Tricks
• If you are going to incorporate Differential backups…
• For out of cycle Full backups, use COPY_ONLY – Or ensure that new full is a part of retention policy
– BACKUP DATABASE AdventureWorks TO DISK=…. WITH COPY_ONLY
• Perform data loads/purges before scheduled Full – Or perform out of cycle full after complete
• For large index maintenance operations, perform before scheduled Full – Or perform out of cycle full after complete
• If verifying or testing restores, test going back to full
• Make sure retention policies are set to not delete full backups until new successful full
12 Confidential Dell Software
Backup Job Management
13 Confidential Dell Software
Backup Job Management
• Many ways to run scheduled database backups – SQL Server Agent Jobs
– SQL Server Maintenance Plans
– Custom Scripted TSQL Jobs
– Windows Scheduled Tasks – Typically only used for SQL Express
– Centralized 3rd Party Scheduler
– Enterprise Backup System – IBM Tivoli TSM
– Symantec NetBackup
– Dell NetVault Backup
14 Confidential Dell Software
SQL Server Agent Jobs
• Need to be managed on a per server basis – Can be very challenging in large environments
• SQL Server Maintenance Plans cannot be easily transferred between servers – SSIS Packages w/ hard coded connection strings
– Manually create them on each server
• TSQL Scripts can provide portability – Might need to run differently per version of SQL Server
– Need a solution to copy/deploy
– May be complex depending on amount of custom logic required
15 Confidential Dell Software
Example Script DECLARE db_cursor CURSOR FOR SELECT name FROM master.dbo.sysdatabases WHERE name NOT IN ('master','model','msdb','tempdb') -- exclude these databases OPEN db_cursor FETCH NEXT FROM db_cursor INTO @name WHILE @@FETCH_STATUS = 0 BEGIN SET @fileName = @path + @name + '_' + @fileDate + '.BAK' SET @backupstr = 'BACKUP DATABASE ' + @name + ' TO DISK = ' + char(39) + @fileName + char(39) EXECUTE (@backupstr) FETCH NEXT FROM db_cursor INTO @name END CLOSE db_cursor DEALLOCATE db_cursor
16 Confidential Dell Software
Ways to Deploy
• SSMS has Group Execute – Add the script as a job to one SQL Server
– Export Job as a TSQL Script
– Group Execute against all, or a sub group of servers
17 Confidential Global Marketing
Demo
18 Confidential Dell Software
Backup Job Management Considerations
• Different backup directories for different servers
• Spreading or staggering backup schedules
• Notification
• Different database types
19 Confidential Dell Software
Backup Reporting
20 Confidential Dell Software
Backup Reporting
• SQL Server stores backup statistics in a set of local MSDB tables.
• SSMS has a very inflexible report available – Easier and more powerful to query yourself
• Backup failures are logged locally to: – SQL Agent Job Step Logs
– SQL Server Error Logs
– Windows Event Logs
21 Confidential Dell Software
Backup Reporting Challenges
• Backup statistics are only stored locally on the instance being backed up
• If you have 100 servers and you want to report on all of your backups, have to run 100 reports
• SSMS Group Execute can help here
• Or you can build a reporting architecture to aggregate this data
22 Confidential Dell Software
Example Backup Report Query
• Query msdb.dbo.backup… tables adding filtering and sorting
23 Confidential Dell Software
Demo
24 Confidential Dell Software
Backup Reliability
25 Confidential Dell Software
Backup Reliability
• Native SQL Server backups and restores can be very “fragile”
• Any IO related issue whether network or local will cause a failure – Only choices are:
– Do we take a backup that conflicts w/ production workload?
– Or, do we go the day without a backup and keep our fingers crossed?
26 Confidential Dell Software
Backup Reliability Tips
• When backing up over the network: – Make sure the network is reliable
– Stagger backups that share the same network to avoid saturation
– Look into possibly routing backups over a dedicated network infrastructure
• If you cannot backup over the network: – Make sure you have plenty of local disk allocated
– Backup to a disk other than where your data/log files are
– Copy the backup across the network – Consider using a more robust option than COPY
– ROBOCOPY
– Provides fault tolerance and multi threading
27 Confidential Dell Software
AlwaysOn Availability Groups
28 Confidential Dell Software
AlwaysOn Availability Groups
• Against Secondary Replica’s – Only Full (COPY_ONLY) and Log backups are supported
– No differential backups or standard full’s are allowed.
• Backup preference should be set to enforce policy or avoid license violation
• Backup preference can be enforced through a MP – Not through BACKUP DATABASE
– Not through Backup Wizard
• Check sys.fn_hadr_backup_is_preferred_replica
29 Confidential Dell Software
Demo
30 Confidential Dell Software
Restoring Only What You Need
31 Confidential Dell Software
All Or Nothing Restore
• Restore types mirror backup types – Full
– Diff (Full + Diff)
– Log (Full + Log(s))
– Filegroup (Full + Log)
• What if you only need a subset of data (i.e. Table, Stored Proc, Record, etc...)?
32 Confidential Dell Software
Recovery Tips
• Restore to separate server and grab what you need – Requires time and space
• Proactive Solutions – AlwaysOn?
– No
– Log Shipping Load Delay
– Database Snapshots
33 Confidential Dell Software
Demo
34 Confidential Dell Software
Backup Security
35 Confidential Dell Software
Backup Security
• Native SQL Server backups are created in plaintext
• Can be read by any hexeditor (even notepad)
• Used to be able to password protect backups (no longer available in 2012)
• Compression can make it harder to read, but still possible
• TDE Encrypts whole database (including backup) – Has many implications
• Consider if and how backup data should be secured/encrypted
36 Confidential Dell Software
Demo
37 Confidential Dell Software
How Can Third Party Solutions Help
• Backup Templates and Enterprise Reporting
• Object Level Recovery
• Up to AES 256 Encryption
38 Confidential Dell Software
Summary
• Hopefully we’ve given a lot of food for thought!!
• How can we (Dell Software) help? – NetVault LiteSpeed for SQL Server
– http://www.quest.com/webcast/litespeed-for-sql-server-demonstration819145.aspx
39 Confidential Dell Software
Q&A
Thank You!!!