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
 General SQL Server Forums
 New to SQL Server Administration
 trans log backup

Author  Topic 

ssprague
Starting Member

4 Posts

Posted - 2010-12-20 : 11:57:43
I am very new to the sql server world. I have sql server 2005. Through the maintenance wizard I have a maintenance plan that does a full backup everynight and transaction log backups are done every 2 hours. Also in the plan, I delete the transaction log backups if they are older than 24 hrs. However, the delete is not working. I was thinking that after a full back up that I would not need the transaction logs that were older than the full backup. Please let me know where my thinking has gone wrong. Thank you

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-20 : 12:52:30
What happens if you need to restore to a point in time prior to last night's full backup? You would need two nights ago's full backup plus the tlog chain before last night's backup.

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

Subscribe to my blog
Go to Top of Page

ssprague
Starting Member

4 Posts

Posted - 2010-12-20 : 15:10:02
I believe I have 1 full day of trans logs plus the current day being processed. The delete process is suppose to run at 2:30 a.m. and the trans logs start at 3:00 a.m. In a 3 day scenario, the 1st days logs would not be deleted until 2:30 a.m. on the 3rd day. My problem is the logs are not deleting. Any suggestions?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-20 : 15:14:49
Have you tried recreating the maintenance plan? The maintenance plans are buggy as evidenced by the many people who post problems about them.

If you get fed up with them, you should consider custom code instead. I don't use any maintenance plans. Here's my backup stored procedure: http://weblogs.sqlteam.com/tarad/archive/2009/12/29/Backup-SQL-Server-2005-and-2008-DatabasesAgain.aspx

It is deployed to hundreds of servers at my work and is also deployed to many servers around the world at other companies.

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

819 Posts

Posted - 2010-12-20 : 16:24:30
Verify that you have the right path and extension for the transaction log backups in the maintenance cleanup task. If you have .trn - then it will not work. That is probably the most common issue people have with this task.

Jeff
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-20 : 16:31:43
What's wrong with a trn extension?

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

Subscribe to my blog
Go to Top of Page

ssprague
Starting Member

4 Posts

Posted - 2010-12-20 : 16:35:58
I recreated the maintenance plan and did a test run. It seems to be working now. Will know for sure tonight when it runs. Not sure what I did differently but like you said, they are buggy. Thank you for your help!
Go to Top of Page

ssprague
Starting Member

4 Posts

Posted - 2010-12-20 : 16:37:17
I think jeffw might be referring to the . in front of the trn. Just trn seems to work.
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2010-12-22 : 21:16:11
Correct - .trn does not work in the maintenance cleanup task. This can easily be verified by generating the code that will be used for that task. It should be something like:

Execute master.dbo.xp_delete_file 0,'{path}','bak','{datetime}'

If you see this:

Execute master.dbo.xp_delete_file 0,'{path}','.bak','{datetime}'

It won't work - because the way the procedure has been written it ends up trying to remove files as: {path}\..bak - and since your backup files do not have two '.' in the name they are not found and are not deleted.

Jeff

Jeff

Go to Top of Page
   

- Advertisement -