?
Solved

Compress and ship log files

Posted on 2011-09-26
9
Medium Priority
?
480 Views
Last Modified: 2012-05-12
Servers are running SQL 2008 STD. I need to compress the log files created by LSBACKUP job and ship them over WAN to backup (standby) server, then extract them for LSRESTORE to do it's thing.  Standard LSCOPY job won't do the job because some of the trn files end up 20GB in size.  However, they zip or rar down to around 100mb, which would transport much better!  I need an automated solution, or a looping batch. Send server needs to only copy new files, and recipent end needs to ignore files already extracted.  I hope to be able to set up regular log shipping, and then just disable the lscopy job.  

Have looked at Unison file transfer, which supports compress before copy, but it could delete the recipient copy before lsrestore job applies it.  Is there a command line for winrar?  Need some ideas and inspiration here.
0
Comment
Question by:billherde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 10

Expert Comment

by:Arman Khodabande
ID: 36707871
Hi
You can make a batch file with winrar command line options.
I attached the command line options. I know you can make something out of it. !
I'm busy these days . . .
rar-syntax.txt
0
 
LVL 3

Author Comment

by:billherde
ID: 36708178
I have the syntax for rar and unrar, what I am lacking is a part that will make a seperate file for each file found in the directory. It would be nice if they matched the filename being compressed, but that is not needed either.  I pretty much got the command line to compress and copy the file looking for archive bit and then reset archive bit on completion. Extraction and deleting the file at the destination works with if-then-else, but I don't know how to get a filelist into a table of variables and use it.
0
 
LVL 10

Accepted Solution

by:
Arman Khodabande earned 2000 total points
ID: 36710341
Put the following script in a batch file and it adds files to separate archives. Just change the paths in script to be what you need on your system.
setlocal
set sourcepath=c:\<path to folder to backup>
set destpath=c:\<path to folder to store backups>
set wrpath=C:\Program Files\WinRAR
if NOT EXIST %destpath% md %_destpath%
for %%I in (%sourcepath%\*.*) do "%wrpath%\winrar" A "%destpath%\%%~nI.rar" "%%I"

Open in new window


Do your files in source path get deleted everyday or they're accumulative?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Author Comment

by:billherde
ID: 36710493
They are deleted by the maintenance job after 72 hours.  Thank You! that is the part I needed.
0
 
LVL 3

Author Closing Comment

by:billherde
ID: 36710504
Also found a canned program called Watchdirectory that does the job, but is limited to Zip compression.
0
 
LVL 10

Expert Comment

by:Arman Khodabande
ID: 36710806
Good to hear that.
But zip files may get corrupted during shipping!
Plus that you can compress the files further with Winrar by choosing high compression levels. (This makes the transfer faster too because of small files)
Good luck
0
 
LVL 3

Author Comment

by:billherde
ID: 36710907
Agreed.  That is why I am looking to scripting this using rar and unrar.  Initial testing found a 15gb tlog file compressed to around 1gb with winzip, but squeezed down to 125mb with winrar. My WAN link to the backup server is limited to 10mbps and offsite backup is out there as well. Watchdirectory has some desirable history logging, and will run as a service, but seems a bit much for a one trick solution.
0
 
LVL 10

Expert Comment

by:Arman Khodabande
ID: 36711128
Right.
Do you use -m5 switch to maximize the compression ratio? Use best compression method (slightly more compressive, but slowest) to reach the maximum file compression and reduced size.
0
 
LVL 3

Author Comment

by:billherde
ID: 36711578
Yes.  Makes a big difference for the small set!  After all, size does matter!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question