Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

xp_cmdshell failing in SQL Server 2000 SP4 Expand / Collapse
Author
Message
Posted Thursday, February 23, 2012 1:11 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, June 13, 2013 8:39 AM
Points: 2, Visits: 31
This problem is occurring on a server that just recently fell to me. The OS is Server2003 SP2. There are nightly backups going to a local drive. Sometime later in the day, Veritas NetBackup copies them off to tape. There are maintenance plans in place that delete the old backups. The problem is that things have grown to the point that there is not enough room for two backups out there. I've tried messing with maintenance plans trying to get the old backups deleted before generating the new ones, but I haven't had any luck. Since the old backups are still there when the new ones run, the backups fail due to inadequate disk space. I don't know how long this has been going on - it's longer than the job history.

I have tried to get around this by deleting the old backups before the maintenance plans kick off. To do this, I created a job to run 5 minutes before the maintenance plans start. That job contains a single step consisting of the following:

cmd /C DEL /S /Q /A-A "D:\SQLBackups\*.bak"

When I execute the job, it fails. The only message I can find anywhere is in the job history. There is nothing in the SQL Server Logs. There is nothing in the Event Viewer. There is nothing I can find anywhere. This is what appears in the job history:

The job failed. The Job was invoked by User <username>. The last step to run was step 1 (Delete Old Backups).

I have have pasted everything from the DEL on into a command prompt and it works fine. I have pasted the entire string into Start-->run and it works fine. But the job routinely fails.

This job is owned by the service account. It is the account that SQL Server and the agent are running under. It's a local admin on the box. It has the System Administrators role checked. It has db_owner on every database on the box. When I look at the properties on xp_cmdshell and click permissions, I see this account with EXEC checked. If this is a permissions issue, I sure can't find where it's being denied.

As nearly as I can tell, this account has God-like permissions on both the server and with SQL Server. I know the command string is good because I have run it using two other methods. Yet the job always fails and gives me nothing to go on but that nebulous "The job failed."

While my immediate question is how to make this work or where else to look for some actual error message or number, I'm also open to any other ideas for how to accomplish this task.
Post #1256927
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse