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
set my current windows user to sql server agent(MSSQLSERVER) process and type password there. Restarted this service.
check properties of backup folder: on security tab I see that my windows user has Full control on this folder
The same error.