Add a Secondary Database to a Log Shipping Configuration (SQL Server)
Applies To: SQL Server 2016
This topic describes how to add a secondary database to an existing log shipping configuration in SQL Server 2016 by using SQL Server Management Studio or Transact-SQL.
In This Topic
Before you begin:
To add a log shipping secondary database, using:
The log-shipping stored procedures require membership in the sysadmin fixed server role.
Right-click the database you want to use as your primary database in the log shipping configuration, and then click Properties.
Under Select a page, click Transaction Log Shipping.
Under Secondary server instances and databases, click Add.
Click Connect and connect to the instance of SQL Server that you want to use as your secondary server.
In the Secondary database box, choose a database from the list or type the name of the database you want to create.
On the Initialize Secondary database tab, choose the option that you want to use to initialize the secondary database.
On the Copy Files tab, in the Destination folder for copied files box, type the path of the folder into which the transaction logs backups should be copied. This folder is often located on the secondary server.
Note the copy schedule listed in the Schedule box under Copy job. If you want to customize the schedule for your installation, click Schedule and then adjust the SQL Server Agent schedule as needed. This schedule should approximate the backup schedule.
On the Restore tab, under Database state when restoring backups, choose the No recovery mode or Standby mode option.
If you chose the Standby mode option, choose if you want to disconnect users from the secondary database while the restore operation is underway.
If you want to delay the restore process on the secondary server, choose a delay time under Delay restoring backups at least.
Choose an alert threshold under Alert if no restore occurs within.
Note the restore schedule listed in the Schedule box under Restore job. If you want to customize the schedule for your installation, click Schedule and then adjust the SQL Server Agent schedule as needed. This schedule should approximate the backup schedule.
Click OK on the Database Properties dialog box to begin the configuration process.
On the secondary server, execute sp_add_log_shipping_secondary_primary supplying the details of the primary server and database. This stored procedure returns the secondary ID and the copy and restore job IDs.
On the secondary server, execute sp_add_jobschedule to set the schedule for the copy and restore jobs.
On the secondary server, execute sp_add_log_shipping_secondary_database to add a secondary database.
On the primary server, execute sp_add_log_shipping_primary_secondary to add the required information about the new secondary database to the primary server.
On the secondary server, enable the copy and restore jobs. For more information, see Disable or Enable a Job.