I am running a query window under my own account and the following command:

DECLARE @ReturnCode int 
EXECUTE @ReturnCode = [master].dbo.xp_delete_file 0, N'\\backup\sql', 'bak', '2015-11-24T23:30:02' 
IF @ReturnCode <> 0 
 RAISERROR('Error deleting files.', 16, 1)

On one server this functions correctly but on another it hangs for a very long time and does not delete the files.

Is there anything in particular that could stop how this extended proc runs?

Just an update. I have found that this proc is in the XPStar.dll and have copied that over from a working environment however its still not working. I am wondering if I need to re-register it? Although not sure if you can with system extended procs?

  • 1
    Did you check that the service accounts are the same or have the same permissions on \\backup? (Also, have you considered managing your old backup files outside of SQL Server? Powershell, maybe? xp_delete_file is undocumented and unsupported, so use at your own risk.) – Aaron Bertrand Dec 4 '15 at 14:41
  • Amazingly after I copied over the file and rebooted it all started working! – Tom Dec 4 '15 at 17:03
  • 1
    ...until next time it stops working. – Aaron Bertrand Dec 4 '15 at 18:23
  • thats the spirit ;) – Tom Dec 5 '15 at 20:14

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.