SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Maintenance Cleanup Task did not do its job
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Hommer
Aged Yak Warrior

784 Posts

Posted - 08/13/2013 :  10:31:27  Show Profile  Reply with Quote
Hi,

Something is not right, because the scheduled job did not delete the older .bak files, even though the history did not indicate it errored out.

Here is it in sql view, and it got this error in query window
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '\'.

EXECUTE master.dbo.xp_delete_file 0,N''E:\Data'',N''.bak'',N''2013-07-30T00:25:10'',1

GO

I don't think it is folder permission, because other part of the plan runs full backup at the same drive.

Thanks!

tkizer
Almighty SQL Goddess

USA
36648 Posts

Posted - 08/13/2013 :  11:59:03  Show Profile  Visit tkizer's Homepage  Reply with Quote
Shouldn't it be single quotes around the parameters and not double quotes? I don't use maintenance plans, so I am not sure.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Hommer
Aged Yak Warrior

784 Posts

Posted - 08/13/2013 :  12:17:05  Show Profile  Reply with Quote
You are right. I saw another variation as follow:

EXECUTE master.dbo.xp_delete_file 0,N'E:\Data',N'.bak',N'2013-07-30T11:11:23',1

This is from within the Modify, edit window, View T-SQL.
This one run successfully from my local ssms querry session, BUT did not remove the files either.

The earlier version is copied from the history window.

I would like to hear your alternative way of clean up older files.

Thanks!

Edited by - Hommer on 08/13/2013 12:18:00
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
36648 Posts

Posted - 08/13/2013 :  12:35:24  Show Profile  Visit tkizer's Homepage  Reply with Quote
The alternative is to use custom scripts. My version is on my blog. It's embedded into isp_Backup. Ola Hallengren also has scripts. Due to being super busy at work, I've slacked off on my blog and have stopped supporting isp_Backup and isp_ALTER_INDEX for code changes.

You could try recreating that portion of the maintenance plan as I have seen that as a solution to the issue you are reporting.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jeffw8713
Aged Yak Warrior

USA
790 Posts

Posted - 08/13/2013 :  14:38:33  Show Profile  Reply with Quote
EXECUTE master.dbo.xp_delete_file 0,N'E:\Data',N'.bak',N'2013-07-30T11:11:23',1

should be

EXECUTE master.dbo.xp_delete_file 0,N'E:\Data',N'bak',N'2013-07-30T11:11:23',1

By including the . in the extension, the system is trying to delete files with an extension of '..bak' and is not finding any files.
Go to Top of Page

Hommer
Aged Yak Warrior

784 Posts

Posted - 08/13/2013 :  16:17:36  Show Profile  Reply with Quote
Great catch!
Thank you, Jeff!

quote:
Originally posted by jeffw8713

EXECUTE master.dbo.xp_delete_file 0,N'E:\Data',N'.bak',N'2013-07-30T11:11:23',1

should be

EXECUTE master.dbo.xp_delete_file 0,N'E:\Data',N'bak',N'2013-07-30T11:11:23',1

By including the . in the extension, the system is trying to delete files with an extension of '..bak' and is not finding any files.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000