August 20, 2008 at 4:49 pm
Please come up with something; as we are, installing this on our clients Product Servers
August 21, 2008 at 3:10 pm
Please come up with something; as we are, installing this on our clients Product Servers
Not quite enough to go on here. In 2005 maintenance plans, you have to create a separate step to remove old backups. It is called a Maintenance Cleanup task.
Regards, Irish
August 28, 2008 at 7:22 pm
And make sure you specific the interval you want the clean up task to execute on....daily, weekly and also provide the correct extension of the file that the clean task is supposed to get rid of.
August 29, 2008 at 9:23 am
Same problem here and the old files are not being deleted ?
I apologize as I have created a duplicate thread
August 29, 2008 at 9:31 am
Same problem here and the old files are not being deleted ?
Are you saying that you have added a Cleanup Task and are still having issues?
I've noticed that there are a number of folks that upgraded from 2000 to 2005 and are surprised that their old maintenance plans don't work the same way. I don't know if this is your case, but thought I would mention that.
In any case, you need to look at the design and add the task to the maintenance plan, either before the database backup runs or after it succeeds. I recommend deleting the files after the backup completes if space allows.
Regards, Irish
August 29, 2008 at 9:34 am
This is a new sql 2005 install and I have indeed added the task to the maintenance plan and created that link but old files specified are still there as if it's not running
August 29, 2008 at 9:53 am
Right click on that part of the task and select the Edit option. In this screen you can select the location and file extension as well as how old the files need to be.
I viewed the T-SQL and my setup looks like this:
EXECUTE master.dbo.xp_delete_file 0,N'e:\server\backup',N'bak',N'2008-08-27T10:50:50'
In my case, I have seperate jobs for both Full and Transaction Log backups, each with their own Maintenance Cleanup task since the file extensions are different.
Regards, Irish
August 29, 2008 at 11:10 am
That's what I have also !
August 29, 2008 at 11:13 am
This is what I have for the maintenance cleanup of the transaction log backup plan
EXECUTE master.dbo.xp_delete_file 0,N''E:\backups\tkcsdb\logs'',N''.trn'',N''2008-08-27T13:00:01''
I see older files in the directory that are supposed to be gone 🙁
December 29, 2009 at 10:31 am
I was having the same problem of the Cleanup task removing the older backup files. I noticed in one of the replies they showed their TSQL statement, and that is where I found my mistake. I had listed the file extension as '.trn' or '.bak' in order for the cleanup task to work right remove the '.' once I removed that it worked flawlessly.
Thanks
December 29, 2009 at 7:21 pm
Sometimes it is the little things that mess us up.
Michael, were you able to determine how the period got there in the first place? Was this a simple code error? :crazy:
Regards, Irish
January 4, 2010 at 10:29 am
Yeah it was my mistake of including the period. It works that way in SQL 2000 but not in the later versions.
January 5, 2010 at 11:08 am
I will add that the original release (and one of the subsequent updates to it) of SP2 for SQL 2005 had some significant problems with maintenance plans/agent jobs. You need to get on a version above SP2.
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
January 21, 2010 at 12:13 am
Consider an example wherein i have to delete a backup file older than 2 days.I have a database named example whose backup is happening in D drive.The backup file name is example_db_date.bak.Today being 21st Jan 2010, i want to delete those example db backup files present on D drive which are older than 2 days.
I use xp_cmdshell feature.
Note: Before implementing the below code please ensure that xp_cmdshell feature is enabled in SQL Server 2005 Surface Area Configuration.
DECLARE @DeleteOldDiff varchar(500);
SET @DeleteOldDiff = 'xp_cmdshell ''del "D:\example_db_'+
convert(char(8), getdate()-2,112) +'*.BAK'+'"''' ;
exec (@DeleteOldDiff)
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply