-
Notifications
You must be signed in to change notification settings - Fork 7
Prerequisites
This log shipping tool is built using .NET 8 and requires either the .NET Runtime 8.x.x or the .NET Desktop Runtime 8.x.x. Download here
- Databases on source instance must be in FULL or BULK LOGGED recovery mode.
The log shipping service can be used to recover databases in SIMPLE recovery mode with the InitializeSimple option.
Backups are not handled by this solution. It's recommended to use Ola Hallengren's DatabaseBackup procedure. The DatabasesInParallel parameter can be used if you have a large number of databases requiring more than one job.
- Backups configured on source instance. Either:
- Azure Blob (e.g.
https://<mystorageaccountname>.blob.core.windows.net/<mycontainername>/database_name/log
) - or UNC path (e.g.
\\server\share\database_name\log
)
- Azure Blob (e.g.
- Different folder structures are supported, but use the database name somewhere in the folder structure.
Backups are restored directly from the UNC path or URL so no file copy is used in this solution. Backups should be written a location that is separate from the source SQL instance.
You need a Windows account with appropriate permissions to do log restores. A group managed service account is a good option as it avoids the need to manage passwords.
You can use your own account initially for testing purposes but a dedicated service account is recommended. You can also run the application as a console application without installing it as a service
This tool supports backups to UNC path or Azure Blob. This section can be ignored if you are using UNC paths. This gist is useful to get started backing up to Azure blob.
On the target instance, you will also need a credential creating:
CREATE CREDENTIAL [https://<storageaccount>.blob.core.windows.net/<containername>]
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = '<token string starting with sv>';
This allows us to restore the backups stored in the blob container. We will also need the shared access token later for the SASToken config section. This allows the tool to enumerate the files in the blob container.
The target SQL instance version should be the same or newer than the source instance. It's not possible to log ship to an older version of SQL Server. It's possible to log ship to a newer version of SQL Server which is typically used as part of a migration strategy. If you are log shipping to a newer version:
- Standby option isn't supported. There will be no way to read from the database without recovering it (which will prevent any further log restores)
- If you need to fail over, you won't be able to restore logs back in the other direction to support a fail back. You would need to upgrade the source instance version first.
- Moving to a different SQL version in an unplanned disaster recovery scenario adds additional risk to the process.
If you are log shipping for disaster recovery purposes, consider using the same configuration options on both instances. There are also many other things to consider:
- Agent jobs
- Logins
- Application failover
- Testing & Documentation
- Load Capacity
- ...