Log shipping definition
Log shipping is a database replication technique that involves automatically backing up transaction logs from a primary database to a standby (secondary) one. Log shipping allows services to continue uninterrupted even when the primary unit fails. It can also greatly speed up disaster recovery efforts.
How log shipping works
Log shipping typically involves two databases — the primary and the secondary. The primary database is the main database, where the original data is held and user interactions initially occur. The secondary database is a copy of the primary database located on a separate server.
The primary database is backed up periodically, with all backups placed in a location that can be accessed by the secondary server. The latter uses automated processes to obtain the primary database’s transaction logs (records of all changes, including insertions, updates, and deletions) and restore them on the secondary database.
Advantages of log shipping
- Having a standby database means that the service won’t go down if the primary database fails for some reason.
- In the event of a disaster affecting the primary database, the secondary database can be used to recover data.
- The secondary database can also be made available for read-only access, allowing reporting or querying without affecting the primary database.
- By copying transaction logs to an offsite location, log shipping allows organizations to recover data even in cases of site-wide disasters.