December 10, 2007 at 12:00 pm
Greetings:
When I script out my log shipping configuration from the GUI and subsequently drop the log shipping and try to recreate it with the created script, the backup and restore functions do not seem to be working; please see script below. Is there an additional step (or steps) that the SSMS GUI does not output when it creates the script for log shipping? I noticed in the GUI after I run the script that the destination folder for copied files is blank as well.
Example error from backup/restore job - Error: The path is not of a legal form.(mscorlib)
-- Execute the following statements at the Primary to configure Log Shipping
-- for the database [rdevsql2].[SymbolLookUp],
-- The script needs to be run at the Primary in the context of the [msdb] database.
-------------------------------------------------------------------------------------
-- Adding the Log Shipping configuration
-- ****** Begin: Script to be run at Primary: [rdevsql2] ******
DECLARE @LS_BackupJobId AS uniqueidentifier
DECLARE @LS_PrimaryId AS uniqueidentifier
DECLARE @SP_Add_RetCode As int
EXEC @SP_Add_RetCode = master.dbo.sp_add_log_shipping_primary_database
@database = N'SymbolLookUp'
,@backup_directory = N'm:\backups'
,@backup_share = N'\\rdevsql2\m$\backups'
,@backup_job_name = N'LSBackup_SymbolLookUp'
,@backup_retention_period = 60
,@monitor_server = N'RDEVSQL1'
,@monitor_server_security_mode = 1
,@backup_threshold = 60
,@threshold_alert_enabled = 1
,@history_retention_period = 60
,@backup_job_id = @LS_BackupJobId OUTPUT
,@primary_id = @LS_PrimaryId OUTPUT
,@overwrite = 1
,@ignoreremotemonitor = 1
IF (@@ERROR = 0 AND @SP_Add_RetCode = 0)
BEGIN
DECLARE @LS_BackUpScheduleUID As uniqueidentifier
DECLARE @LS_BackUpScheduleID AS int
EXEC msdb.dbo.sp_add_schedule
@schedule_name =N'LSBackupSchedule_rdevsql21'
,@enabled = 1
,@freq_type = 4
,@freq_interval = 1
,@freq_subday_type = 4
,@freq_subday_interval = 1
,@freq_recurrence_factor = 0
,@active_start_date = 20071207
,@active_end_date = 99991231
,@active_start_time = 0
,@active_end_time = 235900
,@schedule_uid = @LS_BackUpScheduleUID OUTPUT
,@schedule_id = @LS_BackUpScheduleID OUTPUT
EXEC msdb.dbo.sp_attach_schedule
@job_id = @LS_BackupJobId
,@schedule_id = @LS_BackUpScheduleID
EXEC msdb.dbo.sp_update_job
@job_id = @LS_BackupJobId
,@enabled = 1
END
EXEC master.dbo.sp_add_log_shipping_primary_secondary
@primary_database = N'SymbolLookUp'
,@secondary_server = N'RDEVSQL1'
,@secondary_database = N'SymbolLookUp'
,@overwrite = 1
-- ****** End: Script to be run at Primary: [rdevsql2] ******
-- ****** Begin: Script to be run at Monitor: [RDEVSQL1] ******
EXEC rdevsql1.msdb.dbo.sp_processlogshippingmonitorprimary
@mode = 1
,@primary_id = N'4d80db8c-e090-4dc0-8af6-d5f5802c4207'
,@primary_server = N'rdevsql2'
,@monitor_server = N'RDEVSQL1'
,@monitor_server_security_mode = 1
,@primary_database = N'SymbolLookUp'
,@backup_threshold = 60
,@threshold_alert = 14420
,@threshold_alert_enabled = 1
,@history_retention_period = 60
-- ****** End: Script to be run at Monitor: [RDEVSQL1] ******
-- Execute the following statements at the Secondary to configure Log Shipping
-- for the database [RDEVSQL1].[SymbolLookUp],
-- the script needs to be run at the Secondary in the context of the [msdb] database.
-------------------------------------------------------------------------------------
-- Adding the Log Shipping configuration
-- ****** Begin: Script to be run at Secondary: [RDEVSQL1] ******
DECLARE @LS_Secondary__CopyJobId AS uniqueidentifier
DECLARE @LS_Secondary__RestoreJobId AS uniqueidentifier
DECLARE @LS_Secondary__SecondaryId AS uniqueidentifier
DECLARE @LS_Add_RetCode As int
EXEC @LS_Add_RetCode = rdevsql1.master.dbo.sp_add_log_shipping_secondary_primary
@primary_server = N'rdevsql2'
,@primary_database = N'SymbolLookUp'
,@backup_source_directory = N'\\rdevsql2\m$\backups'
,@backup_destination_directory = N''
,@copy_job_name = N''
,@restore_job_name = N''
,@file_retention_period = 4320
,@monitor_server = N'RDEVSQL1'
,@monitor_server_security_mode = 1
,@overwrite = 1
,@copy_job_id = @LS_Secondary__CopyJobId OUTPUT
,@restore_job_id = @LS_Secondary__RestoreJobId OUTPUT
,@secondary_id = @LS_Secondary__SecondaryId OUTPUT
IF (@@ERROR = 0 AND @LS_Add_RetCode = 0)
BEGIN
DECLARE @LS_SecondaryCopyJobScheduleUID As uniqueidentifier
DECLARE @LS_SecondaryCopyJobScheduleID AS int
EXEC rdevsql1.msdb.dbo.sp_add_schedule
@schedule_name =N'DefaultCopyJobSchedule'
,@enabled = 1
,@freq_type = 4
,@freq_interval = 1
,@freq_subday_type = 4
,@freq_subday_interval = 15
,@freq_recurrence_factor = 0
,@active_start_date = 20071207
,@active_end_date = 99991231
,@active_start_time = 0
,@active_end_time = 235900
,@schedule_uid = @LS_SecondaryCopyJobScheduleUID OUTPUT
,@schedule_id = @LS_SecondaryCopyJobScheduleID OUTPUT
EXEC rdevsql1.msdb.dbo.sp_attach_schedule
@job_id = @LS_Secondary__CopyJobId
,@schedule_id = @LS_SecondaryCopyJobScheduleID
DECLARE @LS_SecondaryRestoreJobScheduleUID As uniqueidentifier
DECLARE @LS_SecondaryRestoreJobScheduleID AS int
EXEC rdevsql1.msdb.dbo.sp_add_schedule
@schedule_name =N'DefaultRestoreJobSchedule'
,@enabled = 1
,@freq_type = 4
,@freq_interval = 1
,@freq_subday_type = 4
,@freq_subday_interval = 15
,@freq_recurrence_factor = 0
,@active_start_date = 20071207
,@active_end_date = 99991231
,@active_start_time = 0
,@active_end_time = 235900
,@schedule_uid = @LS_SecondaryRestoreJobScheduleUID OUTPUT
,@schedule_id = @LS_SecondaryRestoreJobScheduleID OUTPUT
EXEC rdevsql1.msdb.dbo.sp_attach_schedule
@job_id = @LS_Secondary__RestoreJobId
,@schedule_id = @LS_SecondaryRestoreJobScheduleID
END
DECLARE @LS_Add_RetCode2 As int
IF (@@ERROR = 0 AND @LS_Add_RetCode = 0)
BEGIN
EXEC @LS_Add_RetCode2 = rdevsql1.master.dbo.sp_add_log_shipping_secondary_database
@secondary_database = N'SymbolLookUp'
,@primary_server = N'rdevsql2'
,@primary_database = N'SymbolLookUp'
,@restore_delay = 0
,@restore_mode = 0
,@disconnect_users = 0
,@restore_threshold = 45
,@threshold_alert_enabled = 1
,@history_retention_period = 60
,@overwrite = 1
END
IF (@@error = 0 AND @LS_Add_RetCode = 0)
BEGIN
EXEC rdevsql1.msdb.dbo.sp_update_job
@job_id = @LS_Secondary__CopyJobId
,@enabled = 1
EXEC rdevsql1.msdb.dbo.sp_update_job
@job_id = @LS_Secondary__RestoreJobId
,@enabled = 1
END
-- ****** End: Script to be run at Secondary: [RDEVSQL1] ******
help is much appreciated,
Derek
December 10, 2007 at 1:21 pm
Can you explain what isn't working in the backup and restore? This is a lot to look through and I don't see anything obvious. Does it not perform the log backups?
December 10, 2007 at 1:48 pm
that is correct, the backups do not occur.
December 10, 2007 at 2:04 pm
Let me correct that last statement, the LSRestore job fails, but the backup and copy jobs appear to run correctly.
December 10, 2007 at 4:27 pm
I think I have solved it, but would like additional verification if possible:
I included a backup/restore job prior to even running the create log shipping script, and I believe it is working. I will let everyone know what I find (just got it going)
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply