Database Backup with zip/rar

  • Hi,

    currently i can able to automate database backup to specific location .

    Now i need to compress the .bak file with .zip/.rar format.

    Is there any Script available for this.

    Thanks,

    Srikanth

    Always Think Positive

  • What are you using for the compression? What application? Most have command-line options, and some have CLR integration capabilities.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Hi,

    In live server, database backup is automated as

    DB1_currentdate.bak

    DB2_currentdate.bak and so on.

    It occupies more space. Due to space issues, it is required.

    I can do it manually by winzip or any compression tool.

    What i required is this , it should be automated and once it is compressed, then need to delete main .bak file.

    Always Think Positive

  • If you're using WinZip, they have a command-line add-in that you can use to automate it. It has documentation on what commands to give it. It can do what you need. So can 7Zip and others.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Like Gus says, just use the command line. To set it up automatically, just use SQL Agent and have one step that does the backup and, assuming successful completion of that step, a second step that does the compression. It should work just fine that way.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Having just tried it , i noticed something that might be of interest.

    If SQL is already compressing the backup then using winzp or winrar doesnt do a great job compressing the file further.

    However if SQL is not already compressing the backup then winrar and winzip actull performs compression much better.

    Jayanth Kurup[/url]

  • Jayanth_Kurup (7/18/2011)


    Having just tried it , i noticed something that might be of interest.

    If SQL is already compressing the backup then using winzp or winrar doesnt do a great job compressing the file further.

    However if SQL is not already compressing the backup then winrar and winzip actull performs compression much better.

    True. Hadn't thought about that. If you're on 2008R2 Standard or better, you can compress already.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Jayanth_Kurup (7/18/2011)


    If SQL is already compressing the backup

    This feature is not available in SQL Server 2005

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Jayanth_Kurup (7/18/2011)


    Having just tried it , i noticed something that might be of interest.

    If SQL is already compressing the backup then using winzp or winrar doesnt do a great job compressing the file further.

    However if SQL is not already compressing the backup then winrar and winzip actull performs compression much better.

    "Double-compression" usually results in a slightly larger file, due to overhead, than compressing with one means only. Not always, but usually.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • I use the WinZip commandline tool and use the Windows Scheduler to kick it off.

    Like the others said, use only one compression tool. I zip a 90GB .bak file to a 10GB .zip file. Good tight compression.

    HOWEVER!!!!

    Always keep the last/latest .bak file uncompressed.

    Why?

    Because of Murphy's law. I don't know how big your .bak files are but when you get into the 10-50GB .bak files, it takes a looooong time to compress. Murphy's law states, when you need to get a .bak file it's going to be the latest version and IF your latest version is compressed, then it will take a looooooong time to decompress.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply