regd maintenance plan

  • Hi,

    I have created a maintenance plan in such a way that it will take the backup of a database everyday and it will delete the file from the path which is older than 2 days...everthing works fine its been a month ..now it is not deleting the file which are older than 2 days on weekends but on weekdays it is deleting ..only on weekends my job fails due to free space problems as it is not deleting the older files ...Thanks in advance...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • Have u created your own maintaince plan??, if so can you post the script so we can have a look on that

  • EXECUTE master.dbo.xp_delete_file 0,N'G:\DB_Backup',N'bak',N'2008-12-15T15:14:42',1

    this is the delete tsql code ..please do let me know if any changes...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • Are you sure the job is running during the weekend? SQL itself is not aware of the weekday when running a job.

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • I am srry i came to know tht the other guy is deleting manually on weekdays ...so it is not at all deleting anyday ...srry abt that and it used to delete before but not anymore...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • Schedule this command in a job to delete all backups that are older then 2 days:

    DECLARE @Date DateTime

    SET @Date = GetDate() -2-- determine date of day before yesterday

    EXECUTE master.dbo.xp_delete_file 0, N'{path}', N'BAK', @Date

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply