I am having a problem for which I have done numerous online searches but have not yet found an answer. I hope someone can help with it.
SQLServer 2008r2 on Microsoft Windows 2008r2
There is a stored procedure which runs nightly. I did not write the stored procedure and I do not have the right to change it.
Here is what the stored procedure does:
* dbcc of two databases
* uses xp_cmdshell to run a zipping program to zip a directory
* puts the contents of that directory into one of the databases
* Backs the database up
This stored procedure fails about half the time on ONE server. During my troubleshooting , I discovered that it is failing on the part where it runs the zipping program.
Here is what I've noticed:
* If I open a query window and type exec xp_cmdshell 'Dir c:\' and run it, the results will sometimes be a list of everything in the C:\ directory. When I get those results and then run the stored procedure, it works.
* Other times, when I run exec xp_cmdshell 'Dir c:\' the results are NULL. When that happens, if I run the stored procedure, it fails.
What I need to know is, what can cause xp_cmdshell to sometimes work and sometimes not. It will often change from working to not working while I am still in the same query window session in Management Studio.
1) I don't think it's permissions, or it would never work. It works and then it just suddenly stops working.
2) Please don't suggest I use some other method to zip the directory because, as I mentioned, this Stored Procedure runs successfully at a lot of our sites and I am required to support it but not to change it.
I have seen this issue appear in about 10 - 15 different sites. Most people either say "it's permissions" or "Don't use xp_cmdshell for that". Neither of those help me, nor did they help the people asking the questions. Only once did I see someone find his answer and it was anti-virus, but the antivirus software has been completely removed from this system and it's still happening.
I thank you for any help you can provide.
SQLServer 2008r2 on Microsoft Windows 2008r2
There is a stored procedure which runs nightly. I did not write the stored procedure and I do not have the right to change it.
Here is what the stored procedure does:
* dbcc of two databases
* uses xp_cmdshell to run a zipping program to zip a directory
* puts the contents of that directory into one of the databases
* Backs the database up
This stored procedure fails about half the time on ONE server. During my troubleshooting , I discovered that it is failing on the part where it runs the zipping program.
Here is what I've noticed:
* If I open a query window and type exec xp_cmdshell 'Dir c:\' and run it, the results will sometimes be a list of everything in the C:\ directory. When I get those results and then run the stored procedure, it works.
* Other times, when I run exec xp_cmdshell 'Dir c:\' the results are NULL. When that happens, if I run the stored procedure, it fails.
What I need to know is, what can cause xp_cmdshell to sometimes work and sometimes not. It will often change from working to not working while I am still in the same query window session in Management Studio.
1) I don't think it's permissions, or it would never work. It works and then it just suddenly stops working.
2) Please don't suggest I use some other method to zip the directory because, as I mentioned, this Stored Procedure runs successfully at a lot of our sites and I am required to support it but not to change it.
I have seen this issue appear in about 10 - 15 different sites. Most people either say "it's permissions" or "Don't use xp_cmdshell for that". Neither of those help me, nor did they help the people asking the questions. Only once did I see someone find his answer and it was anti-virus, but the antivirus software has been completely removed from this system and it's still happening.
I thank you for any help you can provide.
Comment