I have a bunch of files: two backups and a list of transaction logs.
The backups are called:
- FB20241125_233033.bak
- FB20241126_233040.bak
(The filenames correspond with the date/time the backups have been taken.)
The transaction logs are called (commandline excerpt):
Prompt>dir *.trn
Directory of C:...\Transaction_Logs
25/11/2024 23:45 5.758.464 20241125224500.trn
26/11/2024 00:00 5.560.832 20241125230001.trn
26/11/2024 00:15 5.692.928 20241125231501.trn
...
26/11/2024 15:00 5.822.976 20241126140001.trn
26/11/2024 15:15 5.955.072 20241126141501.trn
26/11/2024 15:30 5.889.536 20241126143000.trn
27/11/2024 12:15 5.626.368 20241127111501.trn
(The same reason for filenames applies.)
Then I do a restore of this directory (take the two backup files and all the transaction log files), using the following properties:
This is the error message I get:
System.Data.SqlClient.SqlError: The log in this backup set begins at LSN 33845000000619000001, which is too recent to apply to the database. An earlier log backup that includes LSN 33816000000750400001 can be restored. (Microsoft.SqlServer.SmoExtended)
I thought by myself "But that's obvious: my latest backup was taken at 23h30m40s on 26/11/2024 while the latest transaction log dates from the day later, so let's not include that transaction log in the restore.", but this doesn't help.
Does anybody know what I can do in order to restore the latest possible backup, containing the latest possible transaction logs?
Edit1 : what about LSNs in "*.trn" files?
In the meantime, I've run the following SQL query for the mentioned *.trn files:
RESTORE HEADERONLY FROM DISK = 'C:\...\20241125224500.trn';
RESTORE HEADERONLY FROM DISK = 'C:\...\20241125230001.trn';
...
These are the first results:
FirstLSN LastLSN
---------------------- --------------------
33758000001254200001 33759000000515900001
33759000000515900001 33759000001579300001
33759000001579300001 33760000000835100001
33760000000835100001 33761000000090800001
33761000000090800001 33761000001176400001
33761000001176400001 33762000000412500001
33762000000412500001 33762000001492100001
33762000001492100001 33763000000648100001
33763000000648100001 33763000001722200001
As you see, there are quite come *.trn files, having 3375... and 3376... as first Log Sequence Number (LSN), so why is the error message saying that the log in this backup set begins at LSN 3384...?
Thanks in advance

