Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008 R2
Database Engine
Operations
Managing Databases
 Backup Compression
Community Content
In this section
Statistics Annotations (6)
Collapse All/Expand All Collapse All
Backup Compression (SQL Server)

This topic discusses the basics of backup compression, including the performance trade-off of compressing backups.

Backup compression was introduced in SQL Server 2008 Enterprise. Beginning in SQL Server 2008 R2, backup compression is supported by SQL Server 2008 R2 Standard and all higher editions. Every edition of SQL Server 2008 and later can restore a compressed backup.

The following restrictions apply to compressed backups:

  • Compressed and uncompressed backups cannot co-exist in a media set.

  • Previous versions of SQL Server cannot read compressed backups.

  • NTbackups cannot share a tape with compressed SQL Server backups.

Because a compressed backup is smaller than an uncompressed backup of the same data, compressing a backup typically requires less device I/O and therefore usually increases backup speed significantly.

By default, compression significantly increases CPU usage, and the additional CPU consumed by the compression process might adversely impact concurrent operations. Therefore, you might want to create low-priority compressed backups in a session whose CPU usage is limited by Resource Governor. For more information, see How to: Use Resource Governor to Limit CPU Usage by Backup Compression (Transact-SQL).

To obtain a good picture of your backup I/O performance, you can isolate the backup I/O to or from devices by evaluating the following sorts of performance counters:

  • Windows I/O performance counters, such as the physical-disk counters

  • The Device Throughput Bytes/sec counter of the SQLServer:Backup Device object

  • The Backup/Restore Throughput/sec counter of the SQLServer:Databases object

For information about Windows counters, see Windows help. For information about how to work with SQL Server counters, see Using SQL Server Objects.

At installation, backup compression is off by default. The default behavior for backup compression is defined by the backup compression default Optionserver-level configuration option. You can override the server-level default when creating a single backup or scheduling a series of routine backups.

To change the server-level default

To override the backup compression default

You can change the backup compression behavior for an individual backup, backup job, or log shipping configuration.

  • Transact-SQL 

    For a given backup, you can use either WITH NO_COMPRESSION or WITH COMPRESSION in a BACKUP statement.

    For a log shipping configuration, you can control the backup compression behavior of log backups by using sp_add_log_shipping_primary_database sp_change_log_shipping_primary_database (Transact-SQL).

  • SQL Server Management Studio 

    You can override the server backup compression default by specifying Compress backup or Do not compress backup in any of the following dialog boxes:

    • Back Up Database (Options Page)

      When backing up a database, you can control backup compression for an individual database, file, or log backup.

    • Maintenance Plan Wizard

      The Maintenance Plan Wizard enables you to control backup compression for each set full or differential database backups or log backups that you schedule.

    • SQL Server 2008 Integration Services (SSIS) Back Up Database task

      You can control the backup compression behavior when creating a package for backing up a single database or multiple databases.

    • Log Shipping Transaction Log Backup Settings

      You can control the backup compression behavior of log backups.

To calculate the compression ratio of a backup, use the values for the backup in the backup_size and compressed_backup_size columns of the backupset history table, as follows:

backup_size:compressed_backup_size

For example, a 3:1 compression ratio indicates that you are saving about 66% on disk space. To query on these columns, you can use the following Transact-SQL statement:

SELECT backup_size/compressed_backup_size FROM msdb..backupset;

The compression ratio of a compressed backup depends on the data that has been compressed. A variety of factors can impact the compression ratio obtained. Major factors include:

  • The type of data.

    Character data compresses more than other types of data.

  • The consistency of the data among rows on a page.

    Typically, if a page contains several rows in which a field contains the same value, significant compression might occur for that value. In contrast, for a database that contains random data or that contains only one large row per page, a compressed backup would be almost as large as an uncompressed backup.

  • Whether the data is encrypted.

    Encrypted data compresses significantly less than equivalent unencrypted data. If transparent data encryption is used to encrypt an entire database, compressing backups might not reduce their size by much, if at all.

  • Whether the database is compressed.

    If the database is compressed, compressing backups might not reduce their size by much, if at all.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
A Step by Step Guide to Configure Database Backup Compression Feature in SQL Server 2008 R2      Ashish Kumar Mehta ... Mikha   |   Edit   |   Show History
Hello Everyone,

If you would like to see a step by step guide on how to configure and use Database Backup Compression Feature In SQL Server 2008 R2 then please visit the following link:-

http://www.mytechmantra.com/LearnSQLServer/Backup_Compression_Feature_In_SQL_Server_2008_P1.html

Hope that Helps!

Thanks
Ashish Kumar Mehta
Tags What's this?: Add a tag
Flag as ContentBug
Compression Ratio      RodrigoRRG   |   Edit   |   Show History
The compression rate is corrects ? $0$0 $0 $0Looking at http://en.wikipedia.org/wiki/Data_compression_ratio the formula for calculate Compression Rate of Date is inverse of presented in above.$0 $0$0 $0 $0The correct is compressed_backup_size/backup_size.$0 $0$0 $0 $0Thus, we have the percent of saved!$0 $0In the example: 3/1 is 3, and 1/3 is 0.333, that is, ~33%..., and this means that ~66% savings!!!!$0 $0$0 $0 $0 $0To know how many % is saving, just subtract the ratio of 1. This give in decimal form. For get in non-decimal, multiply by 100.$0 $0 $0$0 $0 $0 $0Summary:$0 $0 $0$0 $0
SELECT 100*(1-(compressed_backup_size/backup_size)) as [% Saving] FROM msdb.dbo.backupset
$0
Tags What's this?: Add a tag
Flag as ContentBug
CLIENT FRANK A GUECHO /AMISTRATOR SOLE PROPRIEOTOR      Frank Guecho   |   Edit   |   Show History

NO COMENT

Tags What's this?: Add a tag
Flag as ContentBug
Behavior of compressed backups when appending backups to an existing media set      Ramu_K   |   Edit   |   Show History
When working with compressed backups, please check the following KB for additional information

2297053 Behavior of compressed backups when appending backups to an existing media set
http://support.microsoft.com/kb/2297053
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker