Download 6231B_06

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Global serializability wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Microsoft Access wikipedia , lookup

Commitment ordering wikipedia , lookup

IMDb wikipedia , lookup

SQL wikipedia , lookup

Oracle Database wikipedia , lookup

Functional Database Model wikipedia , lookup

PL/SQL wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Serializability wikipedia , lookup

Database wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Relational model wikipedia , lookup

Ingres (database) wikipedia , lookup

Concurrency control wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

ContactPoint wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Transcript
Module 6
Backup of SQL Server
2008 R2 Databases
Module Overview
• Backing up Databases and Transaction Logs
• Managing Database Backups
• Working with Backup Options
Lesson 1: Backing up Databases and Transaction Logs
• Performing a Full Database Backup
• Working with Backup Sets
• Using Backup Compression
• Performing Differential Backups
• Performing Transaction Log Backups
• Demonstration 1A: Backing up Databases
Performing a Full Database Backup
• Backup entire database
• Backup active portion of log
file
BACKUP DATABASE
AdventureWorks2008R2
TO DISK =
'L:\SQLBackups\AW.bak'
WITH INIT;
Working with Backup Sets
• A Backup Set represents one backup of any type
• Backup Sets are written to Media Sets

Consists of one or more tape or disk Backup Devices

Backups are striped over the devices

Tape and disk devices cannot be mixed
• Backup devices and Media Sets are created the first time
they are used
• Every backup device has a header with meta data of the
backup sets
• Media Sets can be mirrored in Enterprise and Datacenter
edition
Using Backup Compression
Backup Compression:

Introduced in SQL Server 2008

Compresses backup size on device

Reduces I/O requirements, increases CPU usage

Faster backups but importantly, also faster restores
Restrictions:

Cannot co-exist on media with uncompressed backups

Cannot co-exist on tapes containing NT Backups
Performing Differential Backups
• Backup the extents changed
since the last full database
backup
• Store active part of the
transaction log to be able to
recover the database
• Independent of other
differential backups
Note: You cannot create a
differential database
backup if no full backup
has ever been created
BACKUP DATABASE AdventureWorks2008R2
TO DISK = 'L:\SQLBackups\AW_Diff.bak'
WITH DIFFERENTIAL, INIT;
Performing Transaction Log Backups
• Backup the transaction log
only
• Backs up log from the last
successfully executed log
backup to the current end of
the log
• Truncates inactive log records
unless options specified
Note: Database must be
in full or bulk-logged
recovery model
BACKUP LOG AdventureWorks2008R2
TO DISK = 'L:\SQLBackups\AW_Log.bak'
WITH NOINIT;
Demonstration 1A: Backing up Databases
In this demonstration you will see:
• How to backup a database
• How to use backup compression
Lesson 2: Managing Database Backups
• Options for Ensuring Backup Integrity
• Viewing Backup Information
• Demonstration 2A: Viewing Backup History
Options for Ensuring Backup Integrity
Mirrored Media Sets
• A backup set can be mirrored to up to 4 media sets
• Mirrors require the same number of backup devices
• Support in Enterprise and Datacenter Editions only
CHECKSUM backup option
• Available for all backup types
• Generates a checksum over the backup stream
• Can be used to verify the backup
Backup verification
• RESTORE VERIFYONLY can be used for backup verification
• Useful when combined with the CHECKSUM option
Viewing Backup Information
• SQL Server 2008 R2 tracks all backup activity in a set of
tables in the msdb database

History can be accessed through T-SQL or SSMS
• Information can be retrieved from backup media

RESTORE LABELONLY returns information about the backup
media on a specified backup device

RESTORE HEADERONLY returns all the backup header
information for all backup sets on a particular backup device

RESTORE FILELISTONLY returns a list of data and log files
contained in a backup set
Demonstration 2A: Viewing Backup History
• In this demonstration you will see:

How to view backup history using SSMS

How to query the backup history tables using T-SQL

How to use the RESTORE HEADERONLY command to retrieve
backup set information
Lesson 3: Working with Backup Options
• Backup Considerations
• Copy-only Backups
• Tail-log Backups
• Demonstration 3A: Tail-log Backup
Backup Considerations
• Backups are performed online

Do not prevent user access

Might slow down other operations due to I/O load
• Database must be online for normal backup operations

Transaction log backups are still possible on a damaged database

Log file must be intact
• Integration with operating system options

SQL Writer service provides backup functionality through the Volume
Shadow Copy Service (VSS) framework

VDI interface enables ISVs to integrate backup and restore
functionality into their products (commonly used for 3rd party backup
tools)
Copy-only Backups
• Backup the database without
changing the restore order
• Copy-only transaction log
backups do not truncate the
log
• Copy-only full database
backups do not affect the
differential base
Note: Use COPY_ONLY for
out of sequence backups
BACKUP DATABASE AdventureWorks2008R2
TO DISK = 'L:\SQLBackups\AW_Copy.bak'
WITH COPY_ONLY, INIT;
Tail-log Backups
• Used to capture the tail of the log before starting a restore
sequence

Performs a regular log backup
• Options:

NORECOVERY when restore operations will follow (database
set to RECOVERING state)

CONTINUE_AFTER_ERROR when data files are missing or
damaged but log files are intact

Performs a regular log backup
Demonstration 3A: Tail-log Backup
• In this demonstration, you will see how to backup the tail
of the log of a damaged database
Lab 6: Backup of SQL Server Databases
• Exercise 1: Investigate backup compression
• Exercise 2: Transaction log backup
• Exercise 3: Differential backup
• Exercise 4: Copy only backup
• Challenge Exercise 5: Partial backup (Only if time permits)
Logon information
Virtual machine
623XB-MIA-SQL
User name
AdventureWorks\Administrator
Password
Pa$$w0rd
Estimated time: 45 minutes
Lab Scenario
You have reviewed and updated the recovery models. As
the database administrator, you need to implement a
database backup strategy. You have been provided with
details of the required backup strategy for a number of
databases on a SQL Server instance. You need to complete
the required backups.
Lab Review
• What must be performed before you can create a
differential backup of a database?
• How does a copy only backup differ from a full database
backup?
Module Review and Takeaways
• Review Questions
• Best Practices