2

We have avamar tool taking backups in my environment. The backup plan avamar does is only taking trans backups once a day. I am convincing them to take the trans backup more frequent. But in the meanwhile, I have to deal with large log sizes because of this infrequent trans backups. Hence to reduce the log sizes, I am taking a quick trans backup followed by a truncate log size. Now I want to know if doing that breaks the log chain for avamar and it forces it to take full back up instead. Remember, I am deleting the trans backup file immediately after I truncate the log sizes. Does the fact that I deleted the trans backup file breaks the log chain for Avamar? Any input is appreciated.

  • Yes, you're smashing the log chain to pieces and then burning down the rubble. Take a full backup ASAFP using WITH COPY_ONLY and store it on a protected network UNC path or similar. Thank your lucky stars that you haven't had to restore this database... yet. – SQL_Underworld Jan 31 '17 at 6:46
  • 1
    From the Avamar website: "Every Avamar backup is a full backup, which makes it easy for you to browse, point, and click for a single-step recovery." ...Are you sure you have all of your details correct? Based on what I just read at their website, and comparing that to what you're asking, makes me wonder if you have a full understanding of what the tool does. – SQL_Underworld Jan 31 '17 at 6:55
  • 1
    This document has a section on "Backups with Other tools" and the comment "Backups with multiple tools can break the backup chain for all of the tools, especially if the backups are truncating the database transaction log. ... Exclusive backups with the Avamar Plug-in for SQL Server are recommended to avoid breaks in the backup chain.". korea.emc.com/collateral/TechnicalDocument/docu53956.pdf – wBob Jan 31 '17 at 12:33
5

If the avamar tool uses its own tracking method to know what log backup files it can restore, then it will fail.

If it uses SQL internal tables to know what log backup it needs, that is good, but if the file has been deleted, then it will fail.

Either way it will fail since you are deleting the files...so don't :)

4

Reading your question makes me wonder if you've actually attempted to restore these databases as proof of your backup strategy (either by naming the databases something different on the current server or restoring them to another server). You say Avamar handles the whole backup and recovery and yet, you're doing things (deleting transaction log backups) behind its back. You also say that Avamar only takes transaction log backups once per day. By deleting the transaction log backup file, you just made it impossible to recover to any point after that (unless you are taking additional FULL or DIFF backups). When was the last time a FULL or DIFF backup was taken? Even if you weren't deleting the transaction log backups you're taking, it would take you a VERY long time to restore your latest FULL backup (assuming you still have it) and DIFF and ALL of the transaction logs to get you close to where you want to be in a recovery situation.

The absolute FIRST thing you need to do is identify your Recovery Point Objective (RPO) and Recovery Time Objective (RTO).

RPO basically is, how much data could we 'possibly' lose should a bad problem happen? 5 minutes, 1 hour, 1 day, NONE?

RTO basically is the maximum time allowed to get things back to 'normal' or at least functioning. You would need to take into consideration small problems (server went down) to big problems (the building just exploded).

Since you are basically throwing away the transaction log backups you're taking, you are obviously not interested in being able to restore to a given point in time. If that is the case, you should just change your recovery model to SIMPLE and then you won't need to worry about taking your transaction log backups. Just bear in mind that under SIMPLE recovery, you will only be able to recover back to the last FULL or FULL/DIFF.

Check out The 9 Letters That Get DBAs Fired.

RPO, RTO and CYA

Right now, all of your users believe your RPO and RTO is zero. They believe you’ve got everything under control, and that when disaster strikes, you’re going to instantly bring up another server with no data loss whatsoever.

  • Advice given to me very early in IT: Your last good backup was the last one you successfully restored. – Greg Feb 1 '17 at 23:36
2

I am taking a quick trans backup followed by a truncate log size.

I believe you want to say taking transaction log backup and shrinking ?, If not in full recovery model transaction log backup would truncate transaction logs subject to few restrictions. And please stop shrinking log file daily this is big performance killer. And shrinking transaction logs DO NOT break the log chain so you are safe.

Remember, I am deleting the trans backup file immediately after I truncate the log sizes.

Other blunder you are doing is deleting the files after backup, how are you going to recover database if disaster strikes. Please stop that as well. Please define proper RPO and RTO and make a backup retention policy after which you may delete the files which exceeds the retention date.

And NO taking log backup and deleting the files do not break log chain but you actually lost the ability to do point in time recovery as files which stored backup is deleted

Further to our conversation you asked whether taking manual backup would break the log chain and answer it yes. Even though you take and delete the files the changes are done to the LSN when you take manual backup.

  • I don't think you understood. There is a backup tool that handles the whole backup and recovery. it is called Avamar. I am just doing these to take care of large log sizes that i am facing. I want to know if what I am doing breaks the log chain. That's all – PolDBQ Jan 30 '17 at 13:24
  • Ok so you saying that if you take quick TSQL transaction log backup manually from your side then would it break the chain?. I think so, but you must confirm vendor I have not used Avmar tool – Shanky Jan 30 '17 at 13:30
  • Yes.. And then i delete the trans backup file. How about deleting the trans backup file i took manually? Does that still break the log chain? The storage location of my manual trans backup and avamar are different. – PolDBQ Jan 30 '17 at 13:34
  • 2
    This does not matter whether you keep it or delete it, once taken they have had made internal changes to LSN. So I suggest please don't run manual log backup, you are correct in proposing to increase the frequency of log backup using the tool – Shanky Jan 30 '17 at 13:40
2

Does the fact that I deleted the trans backup file breaks the log chain for Avamar?

This script will query msdb.dbo.backupset and create a set of restore commands. If you delete any of the transaction log files listed in the restore commands, then the backup chain is broken.

/* Generate the script for restoring a database and the transaction logs */

DECLARE @databaseName sysname 
DECLARE @backupStartDate datetime 
DECLARE @backup_set_id_start INT 
DECLARE @backup_set_id_end INT 

-- set database to be used 
SET @databaseName = 'YourDatabaseNameHere' 

SELECT @backup_set_id_start = MAX(backup_set_id) 
FROM msdb.dbo.backupset 
WHERE database_name = @databaseName AND type = 'D' 


IF @backup_set_id_end IS NULL SET @backup_set_id_end = 999999999 

-- Last Full and any Differentials
SELECT backup_set_id, 'RESTORE DATABASE ' + @databaseName + ' FROM DISK = ''' 
+ mf.physical_device_name + ''' WITH NORECOVERY' 
FROM msdb.dbo.backupset b
INNER JOIN msdb.dbo.backupmediafamily mf 
ON b.media_set_id = mf.media_set_id 
WHERE B.type IN ('D', 'I')
AND b.database_name = @databaseName 
AND b.backup_set_id >= @backup_set_id_start AND b.backup_set_id < @backup_set_id_end 
UNION 
-- Log Backups
SELECT backup_set_id, 'RESTORE LOG ' + @databaseName + ' FROM DISK = ''' 
+ mf.physical_device_name + ''' WITH NORECOVERY' 
FROM msdb.dbo.backupset b
INNER JOIN msdb.dbo.backupmediafamily mf 
ON b.media_set_id = mf.media_set_id 
WHERE b.database_name = @databaseName 
AND b.backup_set_id >= @backup_set_id_start AND b.backup_set_id < @backup_set_id_end 
AND b.type = 'L' 
UNION 
SELECT 999999999 AS backup_set_id, '--RESTORE DATABASE ' + @databaseName + ' WITH RECOVERY' 
ORDER BY backup_set_id

Replace 'YourDatabaseNameHere' with the name of your database.

For those databases that use the FULL recovery model it is suggested to take frequent LOG backups.

I generally use 5-15 minute increments for LOG backups depending on how busy the database is. Here is a TechNet Article on it: Working with Transaction Log Backups

2

(Update: My answer below only applies if Avamar uses SQL Server's backup mechanisms. SQL_Underworld's comment on your question led me to look a little at it, and it appears it may use a completely separate mechanism for differential backups [likely not log, and almost certainly not daily full].
So it's actually a possibility that Avamar will do it's job even if you set your database to Simple recovery model, which would solve your log growth issues. But you would need to confirm with Avamar that their software doesn't rely on a specific recovery model.
Or if you can't get confirmation on that, you can probably at least get confirmation as to whether or not it needs the log in order to take backups. If not, then you can take log backups as often as you need in order free log space for reuse. But Shanky is correct in that you should not normally shrink the file after log backup, as that will just make your system work harder than needed for regrowing the file.)

Original answer:

What you're doing is certainly breaking the log chain, meaning that if you have to restore, you will lose all data changes since the last log backup Avamar took before the first manual log backup you took after the last full/differential backup Avamar took. (Sorry, can't think of a clearer way to describe it accurately.)

As for whether or not Avamar will detect a broken log chain in its storage location and take a full backup, that's something only they can answer with certainty.

But assuming Avamar uses standard full and log backup methods, the following query (from Get last full backup and transaction log backup for each database) can tell you when the last full/differential backup was taken.

;with backup_cte as
(
    select
        database_name,
        backup_type =
            case type
                when 'D' then 'database'
                when 'L' then 'log'
                when 'I' then 'differential'
                else 'other'
            end,
        backup_finish_date,
        rownum = 
            row_number() over
            (
                partition by database_name, type 
                order by backup_finish_date desc
            )
    from msdb.dbo.backupset
)
select
    database_name,
    backup_type,
    backup_finish_date
from backup_cte
where rownum = 1
order by database_name;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.