This article is half-done without your Comment! *** Please share your thoughts via Comment ***
What is a Log Shipping?
It is a shipping of SQL Server transaction log from one server to another server. It is a one kind of high availability feature of SQL Server.
You can use log shipping to send transaction logs from one database (the primary database) to another (the secondary database) on a constant basis. Continually backing up the transaction logs from a primary database and then copying and restoring them to a secondary database keeps the secondary database nearly synchronized with the primary database.
Would you please explain the basic work of Log Shipping?
Log shipping allows you to automatically send transaction log backups from a primary database on a primary server instance to one or more secondary databases on separate secondary server instances. The transaction log backups are applied to each of the secondary databases individually. An optional third server instance, known as the monitor server, records the history and status of backup and restore operations and, optionally, raises alerts if these operations fail to occur as scheduled.
What are the main operations involved in Log Shipping?
- Log shipping consists of three operations:
- Back up the transaction log at the primary server instance.
- Copy the transaction log file to the secondary server instance.
- Restore the log backup on the secondary server instance.
Does Log Shipping support automatic failover?
A log shipping configuration does not automatically fail over from the primary server to the secondary server. If the primary database becomes unavailable, any of the secondary databases can be brought online manually.
Can we use a secondary database as Reporting purpose?
Yes: we can use a secondary database for reporting purpose.
What is a Primary server or database in Log Shipping?
The primary server in a log shipping configuration is the instance of the SQL Server Database Engine that is your production server. The primary database is the database on the primary server that you want to back up to another server. All administration of the log shipping configuration through SQL Server Management Studio is performed from the primary database.
Can I apply Simple Recovery Model to Parimary database of Log Shipping?
No:The primary database must use the full or bulk-logged recovery model; switching the database to simple recovery will cause log shipping to stop functioning.
What is a Secondary server or database in Log Shipping?
The secondary server in a log shipping configuration is the server where you want to keep a warm standby copy of your primary database. A secondary server can contain backup copies of databases from several different primary servers.
One single Secondary server could be used for multiple primary server.
The secondary database must be initialized by restoring a full backup of the primary database. The restore can be completed using either the NORECOVERY or STANDBY option.
What do you know about the Monitor Server of Log Shipping?
This is an optional server which tracks all of the details of log shipping.
- When the transaction log on the primary database was last backed up.
- When the secondary servers last copied and restored the backup files.
- Information about any backup failure alerts.
- Another important thing is,
- Once the monitor server has been configured, it cannot be changed without removing log shipping first.
What kind of different SQL Jobs involved in Log Shipping Operations?
Log shipping involves four jobs, which are handled by dedicated SQL Server Agent jobs. These jobs include the backup job, copy job, restore job, and alert job.
The basic work of these jobs is, How frequently log backups are taken, how frequently they are copied to each secondary server, and how frequently they are applied to the secondary database.
What is the main use of Backup Job?
When log shipping is enabled, the SQL Server Agent job category “Log Shipping Backup” is created on the primary server instance.
A backup job is created on the primary server instance for each primary database. It performs the backup operation, logs history to the local server and the monitor server, and deletes old backup files and history information. By default, this job will run every 15 minutes, but the interval is customizable.
What is the main use of Copy Job?
When log shipping is enabled, the SQL Server Agent job category “Log Shipping Copy” is created on the secondary server instance.
A copy job is created on each secondary server instance in a log shipping configuration. This job copies the backup files from the primary server to a configurable destination on the secondary server and logs history on the secondary server and the monitor server. The copy job schedule, which is customizable, should approximate the backup schedule.
What is the main task of Restore Job?
- The SQL Server job category “Log Shipping Restore” is created on the secondary server instance when log shipping is enabled.
- A restore job is created on the secondary server instance for each log shipping configuration. This job restores the copied backup files to the secondary databases. It logs history on the local server and the monitor server, and deletes old files and old history information.
- Scheduling these jobs with the same frequency keeps the secondary database as closely aligned with the primary database as possible to create a warm standby database.
What is the main use of Agent Job?
If a monitor server is used, an alert job is created on the monitor server instance. This alert job is shared by the primary and secondary databases of all log shipping configurations using this monitor server instance.
This job raises alerts (for which you must specify alert numbers) for primary and secondary databases when backup and restore operations have not completed successfully within specified thresholds.
Do you know what is the default time interval in Log Shipping?
It is 15 minutes.
What is the solution of the below error?
“Error: The restore operation cannot proceed because the secondary database ‘<Database Name>’ is not in NORECOVERY/STANDBY mode.(Microsoft.SqlServer.Management.LogShipping)”
Restore the secondary database with the full backup of the primary database with NORECOVERY and REPLACE option.