SQL Server: Compress SQL Server Backups using Native Windows Tool

SQL Server 2008 has backup compression built-in, but for SQL Server 2005 and below, you can compress backups using makecab from the command line or xp_cmdshell. Makecab even has a better compression ratio than gzip and does not require additional software to be installed on the server.

makecab D:\backups\dbname.bak D:\backups\dbname.cab

Chrissy is a Cloud and Datacenter Management & Data Platform MVP who has worked in IT for over 20 years. She is the creator of the popular SQL PowerShell module dbatools, and holds a number of certifications, including those relating to SQL Server, Linux, SharePoint and network security. You can follow her on Twitter at @cl.

Posted in SQL Server
One comment on “SQL Server: Compress SQL Server Backups using Native Windows Tool
  1. Rajneesh says:

    What if we do not know the file name as it's getting generated at run time?

    Like there is a variable which store file name so is the below syntax will work ?

    @file_name – raj.xls

    makecab @file_name D:backupsdbname.cab ?

Leave a Reply

Your email address will not be published. Required fields are marked *

*