Forum Discussion
Vaultnexus
Mar 28, 2024Copper Contributor
Could I retrieve the value of the First LSN and the Last LSN?
Hello everyone, I'm new to databases and I'm having some minor problems with the SQL server. Let me explain: I'd like to automate a script written in Go that would facilitate the restoration ...
wiseDATAman
Apr 11, 2024Copper Contributor
Vaultnexus
To get the First/Last LSN, you use https://learn.microsoft.com/en-us/sql/t-sql/statements/restore-statements-headeronly-transact-sql?view=sql-server-ver16. You can alsohttps://github.com/trimble-oss/sql-log-shipping-service/blob/main/sql-log-shipping-service/SQL/GetRedoStartLSN.sqlYou would use this to work what log file is needed for an existing DB.
I https://github.com/trimble-oss/sql-log-shipping-service that can also be used as a database restore tool that might be worth a look. It's open source so you can see exactly how it works.