I restored my last full backup from production database to reporting database server, but last restored database on my reporting server doesn't contain current tables, procedures, functions etc. What can cause this situation? How can I solve it?
Sql-server – Database Doesn’t Contain Current Data After Restoring Last Full Backup from Production
backupsql server
Related Question
- Sql-server – SQL Server restore differential after restoring full backup
- SQL Server – How to Find Percentage Data Change After Last Full Backup
- SQL Server – Backup/Restore During Database Migration While in Production
- SQL Server – Restoring Database Backup Resets Identity Column to 1
- Sql-server – DBCC Shrinkfile after full backup restoration but before differential restoration
- SQL Server – Restoring Development Database from Production Backup Triggered Production Restore
- Sql-server – Transaction log backup after full backup is too big
Best Answer
This is a common issue when you back up to the same file over and over again. Without
WITH INIT
, the new backup gets appended to the file, it doesn't overwrite it. So in this example:We can see from
RESTORE HEADERONLY
that there are two backups:Partial results:
Guess which one has
dbo.newtable
? Guess which one is used as the default when you just sayRESTORE ... FROM DISK ...;
?If you're going to continue using this method to back up your databases, you'll need to determine the
Position
to pass toRESTORE ... WITH FILE = <position>
so that you get the latest backup. A better practice IMHO is to always useBACKUP ... WITH INIT
and append timestamps to the file name. This makes it easier both to ensure you're using the latest backup and also to remove older backups.