Skip to main content
1 of 3
John K. N.
  • 19k
  • 14
  • 57
  • 117

As has already been posted by David Browne - Microsoft, I would like to expand on the concept I was using in my answer form the comemnt.

If you have a database, you can use the WITH STANDBY... feature and have the database restore to a certain point-in-time (your last TLOG backup) and then have the database in Standby / Read-Only mode.

The steps you wold have to perform are:

USE [master] RESTORE DATABASE [AdminDB2] FROM DISK = N'C:\SQL\Backup\AdminDB2\FULL\AdminDB2_FULL_20210220_223019.bak' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 5, REPLACE RESTORE DATABASE [AdminDB2] FROM DISK = N'C:\SQL\Backup\AdminDB2\DIFF\AdminDB2_DIFF_20210222_223007.bak' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 5 RESTORE LOG [AdminDB2] FROM DISK = N'C:\SQL\Backup\AdminDB2\LOG\AdminDB2_LOG_20210222_231512.trn' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 5 RESTORE LOG [AdminDB2] FROM DISK = N'C:\SQL\Backup\AdminDB2\LOG\AdminDB2_LOG_20210223_001513.trn' WITH FILE = 1, STANDBY = N'C:\SQL\BACKUP\AdminDB2_RollbackUndo_2021-02-23_15-22-54.bak', NOUNLOAD, STATS = 5 

With the last transaction log restore you are telling the database to stay in standby mode (STANDBY = N'C:\SQL\BACKUP\AdminDB2_RollbackUndo_2021-02-23_15-22-54.bak') which allows you to apply additional TLOG backups to the database.

An additional restore of a TLOG backup is as simple as running the following command for the next TLOG Restore:

RESTORE LOG [AdminDB2] FROM DISK = N'C:\SQL\Backup\AdminDB2\LOG\AdminDB2_LOG_20210223_011512.trn' WITH FILE = 1, STANDBY = N'C:\SQL\BACKUP\AdminDB2_RollbackUndo_2021-02-23_15-22-54.bak', NOUNLOAD, STATS = 5 

As you can see from the time-stamps on the TLOG backup files I am constantly applying the newest hourly TLOG backup to the Standby / Read-only database AdminDB2.

... AdminDB2_LOG_20210223_001513.trn AdminDB2_LOG_20210223_011512.trn ... 

Reference: RESTORE Statements (Transact-SQL) (Microsoft | SQL Docs)

John K. N.
  • 19k
  • 14
  • 57
  • 117