Parallel log backups using Ola Hallengren log backup job - sql-server

We have several databases on the DB instance. All user DBs are in full recovery mode. The transaction log backup is done every 15 mins using Ola Hallengren backup scripts\jobs. Currently, we have one log backup job that backs up all db's sequentially. This works well for most of the time.
However, during our weekly DB maintenance routine, log backups on some of our databases take much longer to complete ( due to index routine generating high log activity). This is causing some of the other databases have their log backup taken delayed. We are okay with the log backup taking longer but would like the other DBs to be backed up without waiting. The DB's are part of AG, so, cannot switch the recovery model.
Found out that using Ola's scripts we can set multiple log backup jobs using DatabasesInParallel flag. Tested this internally but I think it is not addressing the scenario I mentioned above
Created two log backup jobs with each starting at 15 min mark.
9:00 - Both log backup job start ( Log 1 & Log 2) and each of them backup 10 DBs. Log 2 job finished at 9:10 but Log 1 job took about 40 mins due to Db 9 has high log activity to backup.
9:15 - Log 2 job ran but did not really backup any DB.
9:30 - Log 2 job ran but did not really backup any DB.
9:45 - Log 1 and Log 2 ran and backed up DBs as expected.
Can someone confirm if this is expected behavior when there are multiple log backup jobs.
My plan in having two log backup jobs was to have Log 2 job backup other DBs ( except DB 9) at 9:15 and 9:30 run.

Related

Why is my SQL Server Differential backup failing sometimes?

I'm having an issue that only happens sometimes where my SQL Server differential backup job fails with an error message similar to
Msg 3035, Sev 16, State 1, Line 1 : Cannot perform a differential backup for database "MyDatabaseName", because a current database backup does not exist. Perform a full database backup by reissuing BACKUP DATABASE, omitting the WITH DIFFERENTIAL option. [SQLSTATE 42000]
Msg 3013, Sev 16, State 1, Line 1 : BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000]
I'm currently using Ola Hallengren's SQL Server Mantenance Solution script for backup's, integrity check's and index maintenance. I've scheduled the backup job's as such:
Full Backup of system databases every day # 1:30 AM
Full Backup of all user databases every week on Monday, Wednesday & Friday # 2:30 AM
Differential Backup of all user databases every week on Sunday, Tuesday, Thursday & Saturday # 2:30 AM
Transaction Log backup or all user databases every 30 minutes
I've also set the cleanup time to 168 hours...which is 7 days.
I know that usually when this error message comes up, it is due to a full backup not being present, or possible the recovery mode on a database being changed. I have checked both of these and neither seems to be the case. I can confirm that my Friday full backup was successful, however my Saturday and Sunday Differentials failed. There have also been no changes to the recovery model, and no manual backup taken through SQL Server.
It's worth noting that this only happens sometimes. Sometimes the differential backups work without a problem and other times they fail.
This server is a VM, and we are using VMWare vSphere/vCenter 6.5. I've talked to my server admin and asked how his backup is running an he told me that we are using Quest AppAssure which leverage VMWare snapshot technology, and that he is backuping the drives every x number of minutes, so it is possible that the time of his backup changes and eventually overlaps with mine.
We looked back at the time that his backups ran on the weekend and they happened within a few minutes before mine started. I'm wondering if this is causing my backup issues? if so is there a way to prevent this, or do we simply need to plan the backups at different times that don't overlap?
Thanks
We had another call with Quest today and figured out a solution to the problem.
It would seem that when configuring the backup through Quest Rapid Recovery, you have the option to do Machine level backups or Volume level backup. When it's configured to do volume level backups you can choose for it to either do a block level backup which isn't SQL Server aware, or for it to do a backup that is SQL Server aware, which ends up using the volume shadow copy service and these backups show up as Full (Copy Only) backups in the SQL backup history...even though you can't restore them from SQL Server.
Rapid Recovery can only do backups on a schedule, plus has the option to Truncate Logs after the backup complete to avoid filling the log files, but can't do transaction log backups, so you loose the ability to do a more granular recovery down to the second like with the native SQL Timeline Recovery...Which is why we chose to use native SQL Server Backups.
So to fix the issue, you need to either do a machine level backup which has not SQL Server Awareness/integration. Or you can do a volume level backup, but disable the SQL Server Writer extension, and the truncate logs options to remove the integration.
We've run a bunch of tests, and from the point/time that this change was done, we only see SQL Server backups and no longer the Rapid Recovery backups in the SQL Server Backup history.
So now i am in talks with my server/backup admin see if we can do a machine level backup once a day, so that we can do a machine level restore in case of disaster, and also add a volume level backup of my Backup drive, so that he captures my backups more frequently during the day. I think once this is complete, we'll have the best of both backup solutions.
Ability to do machine level restores (Rapid Recovery)
Retention of SQL Server Backups (Rapid Recovery)
Flexible point in time recovery (SQL Server)
Just wanted to post a update to this issue
We scheduled a call with Quest yesterday, and they assured me that their backup is only taking volume snapshots and will have no impact on my SQL backups. They said that the reason that i was seeing these errors is likely do to Rapid Recovery(I guess AppAssure was renamed to Rapid Recovery) and my SQL backup jobs both trying to use the volume shadow copy service at the same time and so we simply needed to stagger the backup jobs. I end up finding out that this wasn't completely true because the Rapid Recovery backups were configured to truncate my SQL Logs. I also told the guy from rapid recovery that when i queried the msdb backupset table that i was seeing backup jobs listed that lined up with the times of the rapid recovery backup. Still he assured me that it would have zero impact on my backups.
I was still concerned that the Rapid Recovery backups might be impacting the chain of my backup files, so in our test environment i right clicked on one of our databases and clicked tasks > restore >database just to see the recovery history. I see a database backup listed as type Full (Copy Only) which coincides with the rapid recovery backup, then a number of my transaction log backups.
It would seem to me that Rapid Recovery is definitely impacting my SQL Backups.
One other thing to note that i just tried in out test environment. I did a few tests backups using Full's , Transaction Log, Differentials and Full (Copy Only) just to see how things showed up in the restore window in SQL Server Management Studio.
So i realized that in the default restore screen, it tries to recover to the nearest point in time using the least combination of various backup files. To go past the last full backup, I have to use the Timeline option.
I could see the Full backup as the first item, and then the transaction logs backups.
Once i do the Differential backup, i see the Full plus the differential, but no more transaction log backups.... which makes sense since it's trying to get the the closest time possible for the recovery.
Next if i do another Transaction Log backup, I see the Full, Differential and the Transaction Log back
One thing that surprised me however is if i do a Full (Copy Only) followed by a transaction log backup, that i see these two item in the list of files for the recovery, yet if i do a differential after a Full (Copy Only) that it show me the last Full (non copy only), plus the differential. I expected that the backups would always be based off of the last full, both for transaction log and differential backups. I thought that the Copy Only backups would be ignored in the backup chain.
Next I decided to use the timeline restore feature and select a point in time during my tests where the Rapid Recovery backup wasn't part of the listed backups, and do a verify backup. As expected it was successful. After this i tried a restore to another point in time where the Rapid Recovery Full (Copy Only) backup was listed and the verify failed on the Full (Copy Only) backup file from rapid recovery, since it doesn't exist on the sql server.
Any recommendations on how to fix this? The point of the Rapid Recovery backup is supposed to be to backup the machine, in case we ever loose the server and have to restore the entire server, plus for it to pick up my sql server backups to keep for retention, since i only keep 7 days worth of backup on the server itself.
You can check the error log file.
Your job may be the victim of deadlock transactions.
Backup file location may not have enough permission.
So, you should check all the possible error log files.

Differential Backup problems on SQL Server 2008 R2

I have a maintenance plan that takes full backups on wed and sunday at 12am and a differential backups on Mon. Tues, Thur , Fri and Sat'day. The Problem i came across was when ever a full backup happens on wed and sun the differential backup plan fails specifically for 2 databases 'abc1' and 'abc2' with an error
Executing the query "BACKUP DATABASE XXX TO DISK = failed with the following error:
Cannot perform a differential backup for database "abc1", because a current database backup does not exist. Perform a full database backup by reissuing BACKUP DATABASE, omitting the WITH DIFFERENTIAL option. BACKUP DATABASE is terminating abnormally.
Possible failure reasons:
Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established... The package execution fa... The step failed."
I had to perform a manual full backup for these two databases and had to run the differential backup job manually.
Example : When a full backup job runs on sunday at 12am, the differential fails for the two databases with the above error on monday 12am and i had to manually take full backup on monday for the 2 databases and run the differential job and it run fine on tuesday at 12am and on wed'day when the full backup job runs again, the differential fails again for 2 databases on thur 12am with the same error and i had to do the manual process again.
Try stopping the "SQL Server VSS Writer" service and change the start up mode to manual.
You might want to restart your computer.

How to stagger backups

I have Windows scheduler calling a program that does a full database backup every day at 3:00am.
I would also like to do a transaction log backup every ten minutes.
What is the best way to sync these?
I understand that transaction logs are independent of full back-ups, but is it a problem if the two different tasks both do a backup at 3:00am? i.e. the database is asked to produce a full back-up and a transaction log back-up at exactly the same time.
Perhaps I should have one task and query SQL Server to see if the last full backup was more than 24 hours ago. If not, then do a transaction log backup.
As long as you're running SQL 2005 or higher, you can run log backups at the same time as a full backup without issue. Glossing over a bit of detail, log backups are based on the last completed full backup at the time that the log backup started. The only time it really matters is when you'd need to do a recovery and even then, it's only ever "contentious" (i.e. "which full backup should I restore given that I want to restore to this point in time?") for log backups that are taken while a full backup is in progress.
If ever you need to do a point-in-time restore for such a time, you'd work backwards. That is, first find the log backup that contains said point in time. Then, to find the full backup that it's based on, look at the database backup lsn for that log backup in either msdb.dbo.backupset or by running restore headeronly on the log backup. From there, find the full backup that has that value as the checkpoint lsn. Now, you just need to restore that full backup (using the norecovery option) and every log backup based on it up to and including the log backup you identified in the first step (again, all using norecovery). Then run restore database [yourDB] with recovery to run crash recovery and you're back in business.

Log Shipping Transaction Log Backup Job runs continuously

As part of our DR solution, we have attempted to enable log shipping for a heavy transaction load database. While the configuration completes successfully, the first transaction log backup job to kick off after the completion of the log shipping configuration runs continuously and grows exponentially in size. On one occasion, that first transaction log backup job ran for 12 hours with a file size 3X greater than the 27 GB full backup file for the database. We killed that process. Recently, we tried a twist on the approach using a differential as explained below, but the transaction log backup job still ran with an ever growing file size.
This process was run during weekend low use hours
7:46 am – log shipping configuration kicks off
9:32 am – backup file is stored in network share folder. File size is 26.1 GB
9:30 pm – Log shipping configuration completes.
– I disable the log shipping backup, copy, and restore jobs
9:31 pm – I enter command to backup database with differential
9:33 pm – Differential completes with a file size of 768 MB.
– I re-enable the backup and copy jobs to get that process moving along after the differential
– I copy the differential file to the secondary location
9:45 pm – The first transaction log backup job kicks off
9:59 pm – After the Differential file is copied, I restore the database on Secondary using the differential
11:02 pm – The restore of the differential is still running
– The transaction log backup job that was created at 9:45 am is still running with a file size of 28 GB and still growing.
We ultimately killed this process due to space issues as the transaction log backup job never completed.
Has anyone experienced this scenario before? Is there anything we could change to improve the process time on the transaction log backup job? Given the heavy transaction load, I wonder if it would be best to implement an alternative DR solution for this particular database.
I know this may be old,but adding some pointers which will help you.
1.When database is set to Bulklogged recovery model,Tlog will contain copy of data files too,so your Tlogs size will be big
2.further you might want to check what is happening during backups and restores using below trace flags.
dbcc traceon(3004,3605,-1)
3.Same trace flag can be applied to restore as well
4.further if restore is taking some much time,this might be due to huge transactions which are rolledback.See below link for more details
http://www.sqlskills.com/blogs/paul/why-could-restoring-a-log-shipping-log-backup-be-slow/
5.You also can enable Instant file initilization to speedup restores as this will help in growing data files instantly
you also can check if there is network latency by using perfmon counters.

Transaction log has huge growth after backup

I am a programmer, with a side job as an involuntary DBA.
I have a maintenance plan that does a full backup and a 'check database integrity' every night. I backup transaction logs every 10 minutes. The transaction log backup size spikes after the database backup - exponentially bigger. I used to rebuild indexes and statistics every night - I thought that is what was causing the transaction log spike - but removing those steps didn't change anything.
Mirroring our backups on slow connections would be helped considerably if there wasn't this massive spike - so I am hoping it is something I am doing wrong. Can anyone suggest anything?
If you are only running the log backup from 6am to midnight, then the very first log backup at 6am is backing up all the database activity that has occurred in the 6 hours since the last log backup.
This is entirely normal, and probably has nothing to do with the fact that your database backup takes place at 4am.
Since you are on SQL2008, the warning in my other answer doesn't apply, and you should be fine with running the log backups 24 hours.
Is this SQL 2000?
In SQL 2000, you're not supposed to run the log backup while the full backup is executing, or "bad things can happen", like blocking, or hugely bloated log files.
See this ServerFault post for "The Word" from "The Man", Paul Randal, who used to be in charge of the SQL engine at Microsoft.
See this follow-up post for some ideas for skipping the log backup while the full backup is executing.
In SQL 2005 or later, this restriction no longer exists, and you shouldn't have trouble running log backups and full backups at the same time.
While your full backup is running, transaction backups will not run. So how long does your full backup take? The transaction log will not be truncated during this time by transaction log backups.

Resources