HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Ola Hallengren solution, backups not cleaning up

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
solutionbackupshallengrencleaningolanot

Problem

I have about 30 SQL Server 2005-2014 instances, all of which use the excellent Ola Hallengran maintenance script to produce my full/diff/log backups. This has worked for me for years with no issues, until recently.

One of the servers has two instances. In the case of the default instance on that server, the cleanup of the .bak files does not occur.

I wouldn't assume this has anything to do with the script, but rather something else like perhaps the .bak files are locked when the cleanup occurs. I have changed the scheduling of the backups in case the backup window is clashing with another process, to no avail. None of the other instances have this issue, including the named instance on the same box.

I know for a fact this is not a permissions issue, as the instance's Agent runs under a domain account with full control of the backup target volume, which is a dedicated share on a physical server, RAID 5 (unfortunately). It has group policy permissions as follows:

  • bypass traverse checking



  • log on as batch job



I have checked all the event logs on the backup server and see nothing that would help me troubleshoot it.

Can anyone offer any advice as to how I might be able to troubleshoot this issue?

Thanks

Update:

  • Date/Time on Server is consistent with the DC and my workstation. The backup server also has perfect time sync so definitely not a time slippage issue.



  • The @cleanupTime is just as I'd left it (72 hours).



  • I had initially assumed tape backups of that volume might be the culprit, but have since checked and triple checked that the files are not being locked - our Veeam backup of that volume only happens once a week.



I can delete the files manually with no issues.

On your advice I have added -o to the end of the command to get visibility on how the commands look. The only thing I think might be potentially the cause is:


Date and time: 2015-10-20 11:29:58
Command: DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_delete_

Solution

This is a list of random things that come to mind, I can't guarantee any are the problem.

  • DateTime on Server has been knocked out



  • DateTime on the Backup store has been knocked out



  • Someone has changed the @CleanupTime on your agent job (potentially accidentally)



  • There is a backup of your backup location occurring while the cleanup is trying to run locking the files (have had this one myself)



Since you've said that this is a recent problem not a just happened I'm presuming you can still delete the files manually which would indicate they are not in permanent use.

It may be worth running the -o command at the end to write the output of the command to a file ( where it is '-b' chance to '-b -o C:\Logs\backuplog.txt') for example and consult that for if it is bringing back any problems

Context

StackExchange Database Administrators Q#118245, answer score: 3

Revisions (0)

No revisions yet.