Dela via


How to: Add a Secondary Database (Transact-SQL)

This topic explains how to add a secondary database to a log shipping configuration using SQL Server Transact-SQL.

To add a secondary database

  1. 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.

  2. On the secondary server, execute sp_add_jobschedule to set the schedule for the copy and restore jobs.

  3. On the secondary server, execute sp_add_log_shipping_secondary_database to add a secondary database.

  4. 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.

  5. On the secondary server, enable the copy and restore jobs.