sp_add_log_shipping_primary
Adds a new primary server to log_shipping_primaries table.
Syntax
sp_add_log_shipping_primary
{ [ @primary_server_name = ] 'primary_server_name' ,
{ [ @primary_database_name = ] 'primary_database_name' }
[ , [ @maintenance_plan_id = ] maintenance_plan_id ]
[ , [ @backup_threshold = ] backup_threshold ]
[ , [ @threshold_alert = ] threshold_alert ]
[ , [ @threshold_alert_enabled = ] threshold_alert_enabled ]
[ , [ @planned_outage_start_time = ] planned_outage_start_time ]
[ , [ @planned_outage_end_time = ] planned_outage_end_time ]
[ , [ @planned_outage_weekday_mask = ] planned_outage_weekday_mask ]
[ , [ @primary_id = ] primary_id OUTPUT ]
Arguments
[@primary_server_name =] 'primary_server_name'
Is the name of the primary server. primary_server_name is sysname, with no default.
[@primary_database_name =] 'primary_database_name'
Is the name of the database on the primary server. primary_database_name is sysname, with no default.
[@maintenance_plan_id =] maintenance_plan_id
Is the ID of the maintenance plan that backs up the transaction log. maintenance_plan_id is uniqueidentifier, with a default of NULL.
[@backup_threshold =] backup_threshold
Is the length of time, in minutes, after the last backup before a threshold_alert error is raised. backup_threshold is int, with a default of 60 minutes.
[@threshold_alert =] threshold_alert
Is the error raised when the backup threshold is exceeded. threshold_alert is int, with a default of 14,420.
[@threshold_alert_enabled =] threshold_alert_enabled
Specifies whether an alert will be raised when backup_threshold is exceeded. The value of one (1), the default, means that the alert will be raised. threshold_alert_enabled is bit.
[@planned_outage_start_time =] planned_outage_start_time
Is the time, in HHMMSS format, a planned outage starts. During a planned outage, alerts will not be raised if the backup threshold is exceeded. planned_outage_start_time is int, with a default of zero (0).
[@planned_outage_end_time =] planned_outage_end_time
Is the time, in HHMMSS format, a planned outage ends. planned_outage_end_time is int, with a default of zero (0).
[@planned_outage_weekday_mask =] planned_outage_weekday_mask
Is the day of the week that a planned outage occurs. planned_outage_weekday_mask is int, with a default of zero (0). It can be one or more of the following values.
Value | Day |
---|---|
1 | Sunday |
2 | Monday |
4 | Tuesday |
8 | Wednesday |
16 | Thursday |
32 | Friday |
64 | Saturday |
[@primary_id =] primary_id OUTPUT
Is the unique ID for the new primary server and database pair. primary_id is uniqueidentifier.
Return Code Values
0 (success) or 1 (failure)
Remarks
To specify that a primary server should be monitored, execute sp_add_log_shipping_primary on the monitor server.
Permissions
Only members of the sysadmin fixed server role can execute sp_add_log_shipping_primary.