Solved

cannot execute WinRAR inside DTS package

Posted on 2007-11-15
9
1,580 Views
Last Modified: 2013-12-01
sql server 2000
i have a simple DTS package that extracts millions of records from a table to a csv file (simple transform data task). the next step in the DTS is an "execute process" task where i want to run WinRAR to compress that csv file.

win32 process: C:\Program Files\WinRAR\WinRAR.exe
parameters: A E:\OUTPUT\TEST\History_Archive.csv

however it fails with the message:
!  E:\OUTPUT\TEST\History_Archive.csv: The archive is either in unknown format or damaged

there is nothing wrong with the csv file as i can compress it manually using WinRAR from Windows explorer on the server.
i need to get the DTS working as i want to schedule it monthly.

thanks
0
Comment
Question by:frankytee
9 Comments
 
LVL 8

Expert Comment

by:k_rasuri
Comment Utility
zip them instead of rar and see if it works
0
 
LVL 19

Author Comment

by:frankytee
Comment Utility
if it was up to me i would but management has ordered that we move to WinRAR because of its greater compression so i dont have that choice. Its an MIS db so we get heaps of large extracts etc so thats why we moved to winRAR.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
>>however it fails with the message:<<
When you run it manually or as a scheduled job?
0
 
LVL 19

Author Comment

by:frankytee
Comment Utility
when i run the dts manually. haven't scheduled it yet as its not finalised (nor working) and the dba doesn't want dodgy adhoc jobs floating around. Also winzip has been uninstalled so it has to be WinRAR. i've just been told that i should create a batch file that runs the winRAR and then execute that batch file directly but since i've posted this i'll rather just execute the WinRAR (if thats possible) as i dont understand why DST would give options to execute external exe but then not work! i think i'll have to investigate the parameter strings.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 19

Accepted Solution

by:
Barthax earned 400 total points
Comment Utility
With the A command, WinRAR requires three parameters: "A", the RAR file to create and the file to add to the RAR file.

WinRAR A <rarfile> <file(s) to add>
0
 
LVL 19

Expert Comment

by:Barthax
Comment Utility
WinRAR thinks you have given it a RAR file to add stuff to - hence the notice that it doesn't recognise the format.
0
 
LVL 42

Assisted Solution

by:EugeneZ
EugeneZ earned 100 total points
Comment Utility
make sure that WinRAR.exe is installed on sql server box
use UNC path to file (\\servername\share)


use MS-DOS RAR  utility (located in winrar installation folder (prog files..)
you can call it with xp_cmdshell

  RAR Syntax

    RAR <command>  [ -<switches> ]  <archive>  [ <@listfiles...> ]
        [ <files...> ]  [ <path_to_extract\> ]
0
 
LVL 19

Author Closing Comment

by:frankytee
Comment Utility
i ended up using a batch file to do this as i needed to record the process time etc.
but as i stated i wanted to know how to do this directly executing a win process in DTS so after some experimenting the solution posted by Barthax was the closest solution but i used different parameter switches like below (because it was used by one of my former colleagues in an earlier DTS that i found):
u -ibck -ep "full path and file name of rar file" "full path and name of file to archive"
i read the RAR help file and it did not show "-ibck" as a valid switch. but it worked anyway. does anyone know what it stands for?
i found that i had to put the full path of the file to be archived and not just the file name as otherwise RAR did not recognize it. Also how would the list of files be seperated? comma?

thanks
0
 
LVL 19

Expert Comment

by:Barthax
Comment Utility
The -ibck command forces WinRAR to run in the background (should sit in the system tray) which prevents it from taking as much CPU as it can get.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now