Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My Team Foundation Server creates backups. I want to clear backups that are older than 5 days. Create Maintenanace Cleanup Task in Maintenance Plans of Management of Sql Server 2012. Point there folder, file extension bak, checkbox 'Delete files based on the age of the file at task run time' is checked. Saved task.

When I execute it, got error: Execution failed. See the maintenance plan and SQL Server Agent job history logs for details.

In Sql Server Agent job history: Message

Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility Version 11.0.2100.60 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 7:31:58 Progress: 2013-02-05 07:31:58.66 Source: {7F5A7CED-005D-4A73-B4D0-B09CF3B45934} Executing query "DECLARE @Guid UNIQUEIDENTIFIER EXECUTE msdb..sp...".: 100% complete End Progress Error: 2013-02-05 07:31:58.71 Code: 0xC002F210
Source: Maintenance Cleanup Task Execute SQL Task Description: Executing the query "EXECUTE master.dbo.xp_delete_file 0,N'C:\Users\ypa..." failed with the following error: "xp_delete_file() returned error 2, 'Can not find the file specified'". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. End Error Warning: 2013-02-05 07:31:58.71 Code: 0x80019002 Source: Subplan_2
Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. End Warning DTExec: The package execution returned DTSER_FAILURE (1). Started: 7:31:58 Finished: 7:31:58 Elapsed: 0.687 seconds. The package execution failed. The step failed.

Can not find the file specified? Rechecked backup path. It's valid.

According to @Md advice

  1. set my current windows user to sql server agent(MSSQLSERVER) process and type password there. Restarted this service.

  2. check properties of backup folder: on security tab I see that my windows user has Full control on this folder

The same error.

share|improve this question

1 Answer 1

You're probably not running the SQL Server Agent as a user that has permission to that directory. Check services.msc and see what user the agent is running as. Then, either change it to a user that can modify the directory in question, or add the current user to the ACL on the folder where your backups are.

share|improve this answer
    
done. but fail. Details above. –  efr Feb 6 '13 at 4:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.