Solved

Log backup and DB backup retention

  • 14 March 2024
  • 7 replies
  • 47 views

Userlevel 1
Badge +13

we have diffrenet policy for database and its logs , storage policy retention are diffrenet for log is 1 day and db its 14 days , however logs are not getting pruned and when running the forcast report the DB backup job needs the logs 

 

is it expected ?

icon

Best answer by Sunil 18 March 2024, 17:39

View original

7 replies

Userlevel 5
Badge +13

Hi @Ajal 

I see you tagged Oracle and MS SQL to your post, but I’d still like to ask if your question is specific to these databases or in general?

 

Let me try to answer anyway.

As long as the data backups are retained on the basic retention, we don’t prune the log backups as long as the data backups are retained (Regardless of the retention configured on the log storage policy). These are linked by log rule. This is required to be able to do Point-in-time recoveries of the DBs.

 

If the data job is full and is retained by extended retention, we keep the log backups which are linked to the data backup jobs. (These linked jobs are usually the log backups that run at the same time as the data backup). This is required to make sure the data backup recoverable and the DB is recovered to a consistent state.

 

Thanks,

Sunil-

Userlevel 1
Badge +13

@Sunil  i am referring to sql and oracle backup.

i have daily full backup running for db and hourly log backup, why all these hourly backup needed for db recovery

Userlevel 5
Badge +13

@Ajal 

All the log backups are needed for point-in-time recovery.

For example, you ran a database backup at 8 AM and running log backups hourly. If you need to recovery the database till 10:30 AM, you will need 8 AM database backup + 9 AM log backup + 10 AM log backup + 11 AM log backup to be able to roll forward to 10:30 AM.

 

Thanks,

Sunil

Userlevel 1
Badge +13

@Sunil  understood , what if i have scenario where i dont need point in time backup for old days ,

for example i only require point in time backup from last full backup which one day, rest all i only need a full backup 

 

in this scenario how i can i avoid retaining the logs for older backups 

Userlevel 5
Badge +13

Hi @Ajal 

In this case, you need to configure basic retention only for the period you need PIT restores for. And for the rest, retain by extended retention.

Please do keep in mind, when you configure extended retention only the full backups (and linked log backups) will be retained not the complete cycle.

Be cautious when changing the basic retention from a longer period to shorter period, as this action will impact not only future backups but already run backups also and can prune whichever job qualifies per new retention criteria.

 

Thanks,

Sunil-

Userlevel 1
Badge +13

@Sunil  thank you 

so as i understood 

this is the SP for db backup 

and below is for log

 

so you are saying i need to change the basic retention of DB policy to 1 to achieve it ?

Userlevel 5
Badge +13

Yes. Or use the below setting in Control Panel → Media Management Configuration → Data Aging

 

Prune All Database Agent Logs Only By Days Retention Rule → Set this to 1

 

Documentation links are here for Oracle and SQL.

Pruning All Log Backups by Days Retention Rule (commvault.com)

SQL Server Agent: Data Aging (commvault.com)
 

Thanks,

Sunil-

Reply