I am having a problem on two different servers, both are running sql 2014. The maintenance plan does not delete the older backups. I have checked the permissions and the formatting and everything is correct. During troubleshooting I ran the xp_delete_file command to delete a single backup file. I got the error "Error executing xp_delete_file extended stored procedure: Specified file is not a SQL Server backup file." I ran a manual full backup and tried it again on that new backup file and received the same error.

I then copied a couple of the older transaction log files to a different server that was working correctly, ran the same script on them and the files were deleted.

Is there any way to force sql to recognize the backups that it makes as sql backups? The files are good, account used is sysadmin account, and file permissions are not the problem.

  • Are you specifying the proper parameters, per this question? Are you using an unusual backup extension? Are these native SQL backups, or are you backing up using 3rd-party software? – BradC Jan 25 '18 at 19:49
  • the paramaters are correct. Using bak and trn as the backup extensions and these are native sql backups created with sql server management studio. The problem is that sql doesn't recognize the backups as sql backups on these two servers. – Chris Jan 25 '18 at 19:53
  • Restore Headeronly on those same files completes successfully. – Chris Jan 25 '18 at 20:12
  • @Chris - can you update your question and post the command you used for xp_delete_file? – Scott Hodgin Jan 25 '18 at 20:13
  • 1
    This xp is undocumented, unsupported, and many people have reported issues with it deleting nothing, not enough, or too much. Have you considered just letting SQL Server do backups and deal with file cleanup separately (using Powershell, for example)? – Aaron Bertrand Jan 25 '18 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.