Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

675


Chapter 26: Log Shipping


26


FIGURE 26-9
Successful completion of Log Shipping Confi guration.

Configuring Log Shipping Using Transact-SQL
Like most other confi gurations, log shipping can also be confi gured using Transact-SQL.
The easiest way to confi gure log shipping using Transact-SQL is to confi gure it once using
SQL Server Management Studio and click Script Confi guration as explained earlier (refer to
Figure 26-8). The following system stored procedures need to be executed to confi gure log
shipping:

On the primary server, execute the following system stored procedures:

■ (^) master.dbo.sp_add_log_shipping_primary_database: Confi gures the pri-
mary database and creates the transaction log backup job
■ (^) msdb.dbo.sp_add_schedule: Creates the schedule for the backup job
■ (^) msdb.dbo.sp_attach_schedule: Links the backup job to the schedule
■ (^) msdb.dbo.sp_update_job: Enables the backup job
■ (^) master.dbo.sp_add_log_shipping_primary_secondary: Adds an entry for a
secondary database on the primary server
On the secondary server, execute the following system stored procedures:
■ (^) master.dbo.sp_add_log_shipping_secondary_primary: Confi gures the pri-
mary server information and creates the copy and restore jobs
■ (^) msdb.dbo.sp_add_schedule: Creates the schedule for the copy job
■ (^) msdb.dbo.sp_attach_schedule: Links the copy job to the schedule
■ (^) msdb.dbo.sp_add_schedule: Creates the schedule for the restore job
c26.indd 675c26.indd 675 7/31/2012 9:49:20 AM7/31/2012 9:49:20 AM
http://www.it-ebooks.info

Free download pdf