Sql-server – Restoring .trn files on a regular basis to a backed-up database

log-shippingsql servertransaction-log

We have been given a .bak file of a database from our vendor on a completely different network. They are placing their .trn files every 15 minutes on a sftp for us to pickup and write to the .bak file they sent us. This way we will have data up-to-date every 15 minutes or so.

What I have done is restored their backup WITH NORECOVERY. Then I restored all 800 .trn files WITH NORECOVERY, setting the last restore to WITH RECOVERY. Now that it is out of NO RECOVERY we can read from the DB.

Now that we are up-to-date, what is the process for restoring the new .trn files that they send us?

I apologize for the ignorance, I am new to the DBA game.

Best Answer

You should only issue WITH RECOVERY when it's the last backup to restore or when you are sure that is the point where you want to go. After that there's no way to restore any more backups.

Now you will need to restore everything again to keep the same log chain.

If you need to "open" the db without break the log chain, you must use WITH STANDBY = 'path/file'. This will open the DB in READ ONLY mode and when you need to restore more files, SQL Server will use the 'path/file' you create to allow the DB to continue restore the log chain.

You may take a look to this option here: https://docs.microsoft.com/en-us/sql/t-sql/statements/restore-statements-arguments-transact-sql?view=sql-server-2017