Sie sind auf Seite 1von 24

Module 5

Understanding
SQL Server 2012
Recovery Models
Module Overview
• Backup Strategies

• Understanding SQL Server Transaction Logging

• Planning a SQL Server Backup Strategy


Lesson 1: Backup Strategies
• Discussion: Previous Experience with Backup Strategies

• Determining an Appropriate Backup Strategy

• Choosing Appropriate Backup Media

• Determining a Retention and Testing Policy for Backups


Discussion: Previous Experience with Backup Strategies
• What types of backup have you used?

• How often do you perform backups?

• Who is reponsible for planning and executing a backup


strategy?
• How often are your backups tested?

• Do you use 3rd party tools for backups?

• What type of backup media do you use?


Determining an Appropriate Backup Strategy
• Different backup types can be combined
• Data based Backups (Full, Differential, Copy, Filegroup, File)
• L
Log based
b d Backups
B k (Log
(L , Tail
T il Log)
L )

• Safety levels should be determined


• How long can recovering take? (RTO)
• How much data is it acceptable to lose? (RPO)
• Is it p
possible to recover the data from other sources?

• Backup strategy should be mapped to requirements


• Types and frequency of backups
• Backup media to use
• Retention period for backups and for media
• Backup testing policy
Choosing Appropriate Backup Media
• A single backup is called a backup set

• Backup sets are written to media sets that are comprised


of one or more backup devices
• Media sets can contain several backup sets

• Backup devices can be physical or logical


• Physical devices are disk files

• Not all users can p


perform backups
p
Determining a Retention and Testing Policy for Backups
• Planning for backup retention must be part of the strategy
• Should form part of the test plan to ensure accuracy

• Several
S l considerations:
id i
• Combination of backups needed for a database recovery
• Archival requirements
• Synchronization with database checks
• Available secure storage
g location
• Hardware required for restoring backups
• Completeness of backups
Lesson 2: Understanding SQL Server Transaction
Logging
• Overview of SQL Server Transaction Logs

• Transaction Log File Structure

• Working with Recovery Models

• Capacity Planning for Transaction Logs

• Working with Checkpoint Options

• Demonstration 2A: Logs and Full Recovery


Overview of SQL Server Transaction Logs
Transaction logs provide a history of actions executed by a database
management system to guarantee Atomicity and Durability properties

Data modification is
1 sent by application

Modification is recorded
3 in transaction log
g on disk
B ff
Buffer C
Cache
h

Data pages are located in,


2 or read into
into, the buffer cache
and then modified Later, checkpoint
4 writes dirty pages
to database
Transaction Log File Structure
• Sufficient information is logged to be able to:
• Roll back transactions if requested
• R
Recover th
the database
d t b in
i case off failure
f il

• Write Ahead Logging is used to create log entries


• Transaction logs are written in chronological order in a circular way
• Truncation policy for logs is based on the recovery model
Working with Recovery Models

Recovery Model Description


Si
Simple
l • Does
D not permit
i or require
i log
l backups
b k
• Automatically truncates log to keep space
requirements small
Full • Requires log backups for manageability
• Avoids data loss due to a damaged or missing
data file
• Permits recovery to a specified point in time
Bulk Logged • Requires log backups for manageability
• Can enhance the performance of bulk copy
operations
• Reduces
R d log
l space usage by
b using
i minimal
i i l
logging for many bulk operations
Capacity Planning for Transaction Logs
• Capacity needs are based on several factors
• Recovery model used for the database
• Transaction
T ti l
log b
backup
k frequency
f in
i full
f ll and
d bulk
b lk logged
l d
recovery models
• Number and size of transactions in the database

• Examine log behavior during pre-deployment testing


Working with CheckPoint Options
• Type of checkpoint operations
• Automatic
• I di
Indirect
t
• Manual
• Internal

• CHECKPOINT statement
• Allows setting
g target
g recovery
y duration
Demonstration 2A: Logs and Full Recovery
In this demonstration you will see how log truncation works
in full recovery model
Lesson 3: Planning a SQL Server Backup Strategy
• Overview of Microsoft SQL Server Backup Types

• Full Database Backup Strategies

• Transaction Log Backup Strategies

• Differential Backup Strategies

• Discussion: Meeting Business Recovery Requirements


Overview of Microsoft SQL Server Backup Types

Backup Types Description


F ll
Full All d
data fil
files and
d active
i part off the
h transaction
i
log
Differential The parts of the database that have changed
since the last full database backup
Partial The primary filegroup, every read/write
filegroup, and any specified read-only
filegroups
Transaction Log Any database changes recorded in the log files
Tail-log Backup Log backup taken of the tail of the log just
before a restore operation
File/File Group Specified files or filegroups
Copy Only The database or log (without affecting the
backup sequence)
Full Database Backup Strategies

Sunday Monday Tuesday

Full Database Backups:


• Backup all data and part of the log records
• Can be used to restore the whole database
• Permit recovery to backup times only
Transaction Log Backup Strategies

Sunday Monday

A Database and Transaction Log Backup Strategy:


• Involves at least full and transaction log backups
• Enables
bl point in time recovery
• Allows the database to be fully restored in the case of data
file loss
Differential Backup Strategies

Monday Tuesday

A Differential Backup Strategy:


• Involves performing full and differential database backups
• Includes differential backups with only changed data
• Is useful if only a subset of a database is modified more
frequently than the rest of the database
Discussion: Meeting Business Recovery Requirements
• How would you design a backup strategy for a database
supporting an online store?
Lab 5: Understanding SQL Server Recovery
Models
• Exercise 1: Plan a Backup Strategy

• Exercise 2: Configure Recovery Models

• Challenge Exercise 3: Review Recovery Models and


Strategy (Only if time permits)

Logon information
Virtual machine 10775A-MIA-SQL1

User name AdventureWorks\Administrator


Password Pa$$w0rd

Estimated time: 45 minutes


Lab Scenario
You need to implement a database recovery strategy. The
business unit from Proseworks, Inc. has provided you with
the availability needs for the databases on the new
Proseware SQL Server instance.
instance You need to plan how you
will meet the requirements and then implement your
strategy.
If you have time
time, there is another issue that your manager
would like you to work on. There is another instance of SQL
Server installed for supporting Customer Service operations.
There is concern that existingg databases on the
CustomerService server instance are configured
inappropriately and have invalid backup strategies, based
on their RPO and RTO requirements. In this exercise, you
need to review the database recovery models and backup
strategies for the databases on the CustomerService
instance and provide recommended changes.
Lab Review
• Can transaction log backups be performed if a database is
configured for simple recovery model?
• Can transaction log backups be performed if a database is
configured for bulk-logged recovery model?
Module Review and Takeaways
• Review Questions

• Best Practices

Das könnte Ihnen auch gefallen