Infectus

Because I’m Worth Health

How does SQL Server decide which trn file to restore? [migrated]

I want to restore my database using the backup files in the backup folder.

The SQL Server is running on Windows.

When I want to restore I do right-click on the databases and choose “Restore”, then I pick “device”, the SQL Server Management Studio opens a popup window to choose the files to restore.

The folder of the backup contain one bak file and a lot of trn files.

I need to select them all in order to restore to complete (I can’t select just one bak or one trn file to restore).

After that I see the script that SQL generates and I can see that not all the .trn files are included in the script.

My question is how does SQL Server decide which trn file to use and which not?

Microsoft SQL Server 2016 (SP2-GDR) (KB4583460) - 13.0.5103.6 (X64)   
Enterprise Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 19043: ) (Hypervisor)