473,461 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with 7zip unzip using exec master..xp_cmdshell

9
Hi,

I am trying to implement custom log shipping but only have Standard Edition to am unable to use compressed backups..so have resorted to a customised version. As our transaction log files can reach several gb I need them zipped.

I have managed to zip a file using xp_cmdshell as follows:

Expand|Select|Wrap|Line Numbers
  1. exec master..xp_cmdshell 'C:\Progra~1\7-Zip\7z.exe a -t7z "D:\Microsoft SQL Server\MSSQL\Backup\archive_data.7z" "D:\Microsoft SQL Server\MSSQL\Backup\data.bak"'  
But I cannot get the syntax correct for unzipping the file.
I've tried using similar code to above by replacing the 'a' with an 'e' or 'x' but get the following error:

Cannot use absolute pathnames for this command.

I've tried different pathnames but all generate similar errors, or simply do not recognise the path at all.

Can any one point me in the right direction?

Thanks,

Jinx.
Apr 12 '10 #1
2 12633
tonk
1
I've done a quick test and the following seems to work for me...

exec master..xp_cmdshell 'C:\Progra~1\7-Zip\7z.exe e "D:\Microsoft SQL Server\MSSQL\Backup\archive_data.7z" -o"D:\Microsoft SQL Server\MSSQL\Backup\"'

The ‘e’ option tells 7Zip to do the extraction, the ‘–o’ option tells 7Zip where to put the extracted files, putting in an absolute path in seems to work for me, lemme know if you have any problems ^^
Apr 12 '10 #2
JinxT
9
Thanks Tonk, including the '-o' in the "" solved it for me!
Apr 12 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dmitry Pljonkin | last post by:
Hi! I have some troubles trying to start php script using exec() and leave it running in the background. Manual says: "If you start a program using this function and want to leave it running...
2
by: aaj | last post by:
Hi all I have a stored procedure that has the line EXEC master..xp_cmdshell 'dtsrun /Stestjob1 /N testdts /E' If I run the SP from an access front end as a trusted user or from a scheduled...
3
by: Me | last post by:
hi, I have this file I need to execute from an ASP client. since we have installed it on the SQL Database server machine, I thought I could run it like this: Set Cn =...
2
by: Not Me | last post by:
Hey, Coming back to a piece of work I did a while back, which used a stored procedure to populate a list box. The SP takes a single parameter, and I think this is the reasoning for using 'exec'...
7
by: ericgla | last post by:
I am creating a web app using asp.net 2.0 where all pages are based a single master page. On some of the aspx pages I need to add javascript to the head tag in order to use Google maps. I tried...
5
by: mike | last post by:
I created a VB.NET app that uses Outlook's COM object. I get an error when I run master..xp_cmdshell 'myprogram.exe' in SQL query analyzer. The error occurs on this line "oOutlook = New...
1
by: ksn2007 | last post by:
Hi All, I have to run a shell script from my php script and while shell script is running I have to do some other tasks in my php script.To run the shell script I am using ...
1
by: olddocks | last post by:
I want to upload a zip file and then extract/unzip it. I am accomplishing this with php exec command. I am calling unzip from php exec command within a php script and it is not extracting files. why?...
0
by: Chris Rebert | last post by:
On Fri, Nov 14, 2008 at 10:40 AM, Indian <write2abdul@gmail.comwrote: You don't need and shouldn't be using `exec` here. It appears as though you're just doing the following in a much more obtuse...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.