# Microsoft SQL Database backup can result in old data being backed up!

**URL:** <https://forum.duplicati.com/t/microsoft-sql-database-backup-can-result-in-old-data-being-backed-up/6706>\
**Category:** Uncategorized\
**Created:** [March 31, 2019, 9:56pm UTC](https://forum.duplicati.com/t/microsoft-sql-database-backup-can-result-in-old-data-being-backed-up/6706 "2019-03-31T21:56:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xOJeLs0Nk](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/x/eb9ed0/32.png) [@xOJeLs0Nk](https://forum.duplicati.com/u/xOJeLs0Nk)\
**Post date:** [March 31, 2019, 9:56pm UTC](https://forum.duplicati.com/t/microsoft-sql-database-backup-can-result-in-old-data-being-backed-up/6706/1 "2019-03-31T21:56:09Z")

</div>

**Simple:**  
If you have both the “Microsoft SQL Databases” ticked and your backup set encompasses your SQL Data directory on the drive as well - you may not be backing up the latest database and could be in for a shock when you restore!

Version 2.0.4.5 (or higher?) you will see warning messages like “Failed while attempting to add unmodified file to database” referencing your database mdf and ldf files if you are affected by this. If you are on older versions they backup old data silently!

**Detailed:**  
See this article:

> **[Duplicati: Backup Microsoft SQL Server](https://thecomputerperson.wordpress.com/2019/03/31/duplicati-backup-microsoft-sql-server/)**
>
> tldr; In some instances you may not be backing up the most recent SQL data if you have just the data folder selected or have the data folder selected along with the “Microsoft SQL Databases&#…

Can anyone confirm or perform the same steps and verify?  
Can this be fixed at a duplicati code level?

---

<div class="post-metadata">

**Author:** ![saviodsouza](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/s/bcef8e/32.png) [@saviodsouza](https://forum.duplicati.com/u/saviodsouza)\
**Post date:** [April 1, 2019, 5:37pm UTC](https://forum.duplicati.com/t/microsoft-sql-database-backup-can-result-in-old-data-being-backed-up/6706/2 "2019-04-01T17:37:33Z")

</div>

To fix this u need to enable the option some thing like ignore file timestamp under advanced options

The timestamp of mssql databases change only when the database files are closed.  
Duplicati by default checks the timestamp and backs up only if the timestamp has changed.

This is not a bug

---

<div class="post-metadata">

**Author:** ![saviodsouza](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/s/bcef8e/32.png) [@saviodsouza](https://forum.duplicati.com/u/saviodsouza)\
**Post date:** [April 1, 2019, 5:42pm UTC](https://forum.duplicati.com/t/microsoft-sql-database-backup-can-result-in-old-data-being-backed-up/6706/3 "2019-04-01T17:42:13Z")

</div>

U should also add snapshot policy to required

---

<div class="post-metadata">

**Author:** ![xOJeLs0Nk](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/x/eb9ed0/32.png) [@xOJeLs0Nk](https://forum.duplicati.com/u/xOJeLs0Nk)\
**Post date:** [April 1, 2019, 6:05pm UTC](https://forum.duplicati.com/t/microsoft-sql-database-backup-can-result-in-old-data-being-backed-up/6706/4 "2019-04-01T18:05:19Z")

</div>

Interesting one - I didn’t think or know about the timestamp option, I will change that and see what happens and re-test if the stale backup files problem exists.  
The snapshot policy is already set to required.  
Thank you for your input.

---

<div class="post-metadata">

**Author:** ![Pectojin](https://forum.duplicati.com/user_avatar/forum.duplicati.com/pectojin/32/1231_2.png) [@Pectojin](https://forum.duplicati.com/u/Pectojin)\
**Post date:** [April 1, 2019, 6:32pm UTC](https://forum.duplicati.com/t/microsoft-sql-database-backup-can-result-in-old-data-being-backed-up/6706/5 "2019-04-01T18:32:17Z")

</div>

Just my two cents on database backup although it doesn’t directly address what you’re asking:

if you want to back up a database you must create a database dump and back that dump up.

Any other backup strategy is just gambling that Duplicati is lucky and doesn’t back up the database in a corrupted state.

If you do make dumps you’re also not risking the above issue as the timestamp will be correct for the time it was created regardless of when the database connection was closed.

---

<div class="post-metadata">

**Author:** ![xOJeLs0Nk](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/x/eb9ed0/32.png) [@xOJeLs0Nk](https://forum.duplicati.com/u/xOJeLs0Nk)\
**Post date:** [April 1, 2019, 6:48pm UTC](https://forum.duplicati.com/t/microsoft-sql-database-backup-can-result-in-old-data-being-backed-up/6706/6 "2019-04-01T18:48:48Z")

</div>

What is the “Microsoft SQL Databases” section at the top of the sources list for ? (Only appears if you have SQL server and working SQL VSS writer).
