Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Removing old bak

Author  Topic 

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2008-01-15 : 17:27:04
Started with maintenance cleanup task set up bak and directory did not delete the files.

Then found this http://blog.solidsoft.com/blogs/richards_infrastructure_blog/archive/2007/07/12/369.aspx

Copy script

use master
declare @dt datetime
select @dt=getdate()-2
EXECUTE master.dbo.xp_delete_file 0,N'D:\Backup\AcctDB\',N'BAK',@dt

Get message

Msg 22049, Level 16, State 1, Line 0
xp_delete_file() returned error 2, 'The system cannot find the file specified.'

Anyone else get problem with removing BAK files

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-15 : 23:09:52
Maintenance plan does delete old backup files for me, but it doesn't delete old plan log files.
Go to Top of Page

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2008-01-16 : 08:50:51
What version of SQL 2005.
The maintenance plan is using which account
I changed job to be DOMAIN\account that starts SQL and the backup location has this permission on it.

hmm
Go to Top of Page

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2008-01-16 : 09:33:19
Got it working for some reason if i use sa as the user to run job it worked if i used the sql login account failed.

Phew....
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-16 : 23:32:05
That's permission issue.
Go to Top of Page
   

- Advertisement -