We are using LS for reporting purpose. LS backup runs on primary every 15 minutes. On Secondary nightly restore via LS restore job is done daily at 10 PM.
While the nightly restore job is running, additional log backups are being taken and delivered.
Will the restore job restore the logs through the last one present when the job started? Or, will it keep restoring as long as there's another log to restore.
Let's say our log backups are taken at XX:05, XX:20, XX:35, and XX:50. Our restore job usually runs to, say, 6:00 AM. At that point, does it represent our primary database as it was at 9:50 PM (the last log taken before the restore job started), or as it was at 5:50 AM (because after it restored the 5:50 log, it didn't find another, so it quit)?
Naturally, our users want to know for their queries; whether the data reflects 10PM or 6AM can make a big difference.
CurrentDateTime DateTime
on the primary server and use a SQL Server Agent job to run every minute and update that single row withsysdatetime()
. When your secondary logs have all been applied and the secondary server has been put instandby
mode, you should be able to select from that table and see the date/time. That will tell you what logs have been applied.