23
Module 5 Understanding SQL Server 2008 R2 Recovery Models

Module 5 Understanding SQL Server 2008 R2 Recovery Models

Embed Size (px)

Citation preview

Module 5

Understanding SQL Server 2008 R2

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)

Log based Backups (Log , Tail Log)

• Safety levels should be determined How long can recovering take? (RTO)

How much data is it acceptable to lose? (RPO)

Is it 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 Not all users can perform backups

• Backup sets are written to media sets that comprise one or more backup devices

• Media sets can contain several backup sets

• Backup devices can be physical or logical Physical devices are tapes or disk files

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 considerations: Combination of backups needed for a database recovery

Archival requirements

Synchronization with database checks

Available secure storage location

Hardware required for restoring 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

• Demonstration 2A: Logs and Full Recovery

Overview of SQL Server Transaction Logs

Buffer Cache

Data pages are located in, or read into, the buffer cache and then modified

Data pages are located in, or read into, the buffer cache and then modified

22

Modification is recorded in transaction log on disk

Modification is recorded in transaction log on disk33

Checkpoint writes dirty pagesto database

Checkpoint writes dirty pagesto database

44

Data modification is sent by application

Data modification is sent by application11

Transaction logs provide a history of actions executed by a database management system to guarantee ACID propertiesTransaction logs provide a history of actions executed by a database management system to guarantee ACID properties

Transaction Log File Structure

• Sufficient information is logged to be able to: Roll back transactions if requested

Recover the database in case of failure

• 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

Simple • Does not permit or require log backups• 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 log space usage by using minimal

logging for many bulk operations

Capacity Planning for Transaction Logs

• Capacity needs are based on several factors Recovery model used for the database

Transaction log backup frequency in full and bulk logged recovery models

Number and size of transactions in the database

• Examine log behavior during pre-deployment testing

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

Full All data files and active part of the transaction 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

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

üü

üü

Sunday Monday Tuesday

Transaction Log Backup Strategies

A Database and Transaction Log Backup Strategy:

Involves at least full and transaction log backups

Enables point in time recovery

Database can be fully restored in the case of data file loss

üü

üü

üü

Sunday Monday

Differential Backup Strategies

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

üü

üü

üü

Monday Tuesday

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

Estimated time: 45 minutes

Virtual machine 623XB-MIA-SQL

User name AdventureWorks\Administrator

Password Pa$$w0rd

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. You need to plan how you will meet the requirements and then implement your strategy.

If you have 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 existing 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