I'm working with SQL Server 2008Sp3.
I have a database that was restored from a full backup WITH NO RECOVERY and it then was restored with Transaction log backup files - also WITH NO RECOVERY.
At the moment the database is in Restoring status.
Let's say that couple of hours after the last transaction log restoration I want to continue restore the new 2 hourly transaction logs that were created, and then restore it WITH RECOVERY.
How can I query the status of the database, so I will know what was the last Transaction log backup that was restored on that database?
The reason I'm asking that is because I would like to automate this in a script -
I want to create a daily full restoration of a database on a separate server with all the available Transaction log backups WITH NO RECOVERY, and then upon request (when it's necessary), I'll be able to execute another script that will restore the new Transaction log backups that were created since the end of the daily script + restore it WITH RECOVERY.
My question is regarding the second separate script - finding the rest of the needed Transaction log backups.
Thanks in advance,