Home All Groups Group Topic Archive Search About

SQL Server 2005: log shipping

Author
20 Nov 2007 9:40 AM
adhodgson
Hi,

I am trying to set up simple log shipping from one SQL server to
another.  The other server is on a different network, and I believe I
am using "pass-through" authentication, where I have set up the
services to start under a database account, which has the same
username and password on both systems.

I have managed to set up the log shipping ok, and the jobs are created
on both servers, and the data is being initially copied to the
secondary server, however, I can't get the files to copy over to the
second server.  I have set up the shares, and have checked I can get
to the share on the primary server using the database account on the
secondary server, which works, but when I run the copy job, I am told
that it failed, and to look in the job history monitor, which I did,
but it doesn't appear to give me a specific error message.

I am specifying the share name as \\10.10.10.10\lship - the primary
server has an IP address of 10.10.10.10 with a share name of lship.
The database account has full rights to the share and full
permissions.

Any suggestions?
Thanks.
Andrew.

Author
20 Nov 2007 9:59 AM
Uri Dimant
Hi
What if you try
xcopy c:\folder\dbname.bak   \\remoteservername\c$\folder\ /c



<adhodg***@gmail.com> wrote in message
Show quote
news:90419555-6a11-40db-abc5-a0b7bb2370b2@f3g2000hsg.googlegroups.com...
> Hi,
>
> I am trying to set up simple log shipping from one SQL server to
> another.  The other server is on a different network, and I believe I
> am using "pass-through" authentication, where I have set up the
> services to start under a database account, which has the same
> username and password on both systems.
>
> I have managed to set up the log shipping ok, and the jobs are created
> on both servers, and the data is being initially copied to the
> secondary server, however, I can't get the files to copy over to the
> second server.  I have set up the shares, and have checked I can get
> to the share on the primary server using the database account on the
> secondary server, which works, but when I run the copy job, I am told
> that it failed, and to look in the job history monitor, which I did,
> but it doesn't appear to give me a specific error message.
>
> I am specifying the share name as \\10.10.10.10\lship - the primary
> server has an IP address of 10.10.10.10 with a share name of lship.
> The database account has full rights to the share and full
> permissions.
>
> Any suggestions?
> Thanks.
> Andrew.
Author
20 Nov 2007 10:32 AM
adhodgson
On Nov 20, 9:59 am, "Uri Dimant" <u***@iscar.co.il> wrote:
> Hi
> What if you try
> xcopy c:\folder\dbname.bak   \\remoteservername\c$\folder\ /c

Yes, I can move the files over that way and run the restore jobs.  I
just scripted the configuration, and noted that in the secondary
server, there didn't seem to be any destination to copy the files to.
I did choose the directory e:\lship, which is exists both on the
source and destination, I have posted the script underneath - maybe
someone could take a look and see if this is correct?

Thanks.
Andrew.
-- Execute the following statements at the Primary to configure Log
Shipping
-- for the database [primaryserver].[CARDS],
-- 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: [primaryserver] ******


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'CARDS'
        ,@backup_directory = N'e:\lship'
        ,@backup_share = N'\\ip.of.primary\lship'
        ,@backup_job_name = N'LSBackup_CARDS'
        ,@backup_retention_period = 4320
        ,@monitor_server = N'ip.of.monitor.instance'
        ,@monitor_server_security_mode = 0
        ,@monitor_server_login = N'**********'
        ,@monitor_server_password = N'**********'
        ,@backup_threshold = 60
        ,@threshold_alert_enabled = 1
        ,@history_retention_period = 5760
        ,@backup_job_id = @LS_BackupJobId OUTPUT
        ,@primary_id = @LS_PrimaryId OUTPUT
        ,@overwrite = 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_ip.of.primary1'
        ,@enabled = 1
        ,@freq_type = 4
        ,@freq_interval = 1
        ,@freq_subday_type = 4
        ,@freq_subday_interval = 1
        ,@freq_recurrence_factor = 0
        ,@active_start_date = 20071119
        ,@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'CARDS'
        ,@secondary_server = N'ip.of.lship.instance'
        ,@secondary_database = N'CARDS_REP'
        ,@overwrite = 1

-- ****** End: Script to be run at Primary: [primaryserver]  ******


-- Execute the following statements at the Secondary to configure Log
Shipping
-- for the database [ip.of.lship.instance].[CARDS_REP],
-- 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: [ip.of.lship.instance]
******


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 =
master.dbo.sp_add_log_shipping_secondary_primary
        @primary_server = N'primaryserver'
        ,@primary_database = N'CARDS'
        ,@backup_source_directory = N'\\ip.of.primary\lship'
        ,@backup_destination_directory = N''
        ,@copy_job_name = N''
        ,@restore_job_name = N''
        ,@file_retention_period = 4320
        ,@monitor_server = N'ip.of.monitor.instance'
        ,@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 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 = 20071120
        ,@active_end_date = 99991231
        ,@active_start_time = 0
        ,@active_end_time = 235900
        ,@schedule_uid = @LS_SecondaryCopyJobScheduleUID OUTPUT
        ,@schedule_id = @LS_SecondaryCopyJobScheduleID OUTPUT

EXEC 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 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 = 20071120
        ,@active_end_date = 99991231
        ,@active_start_time = 0
        ,@active_end_time = 235900
        ,@schedule_uid = @LS_SecondaryRestoreJobScheduleUID OUTPUT
        ,@schedule_id = @LS_SecondaryRestoreJobScheduleID OUTPUT

EXEC 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 =
master.dbo.sp_add_log_shipping_secondary_database
        @secondary_database = N'CARDS_REP'
        ,@primary_server = N'primaryserver'
        ,@primary_database = N'CARDS'
        ,@restore_delay = 0
        ,@restore_mode = 0
        ,@disconnect_users    = 0
        ,@restore_threshold = 45
        ,@threshold_alert_enabled = 1
        ,@history_retention_period    = 5760
        ,@overwrite = 1

END


IF (@@error = 0 AND @LS_Add_RetCode = 0)
BEGIN

EXEC msdb.dbo.sp_update_job
        @job_id = @LS_Secondary__CopyJobId
        ,@enabled = 1

EXEC msdb.dbo.sp_update_job
        @job_id = @LS_Secondary__RestoreJobId
        ,@enabled = 1

END


-- ****** End: Script to be run at Secondary: [ip.of.lship.instance]
******
Author
20 Nov 2007 10:41 AM
Uri Dimant
Hi
http://www.sql-server-performance.com/articles/clustering/log_shipping_70_p1.aspx




<adhodg***@gmail.com> wrote in message
Show quote
news:54db54b9-0b33-4de1-9173-0c87edd74d2b@a28g2000hsc.googlegroups.com...
> On Nov 20, 9:59 am, "Uri Dimant" <u***@iscar.co.il> wrote:
>> Hi
>> What if you try
>> xcopy c:\folder\dbname.bak   \\remoteservername\c$\folder\ /c
>
> Yes, I can move the files over that way and run the restore jobs.  I
> just scripted the configuration, and noted that in the secondary
> server, there didn't seem to be any destination to copy the files to.
> I did choose the directory e:\lship, which is exists both on the
> source and destination, I have posted the script underneath - maybe
> someone could take a look and see if this is correct?
>
> Thanks.
> Andrew.
> -- Execute the following statements at the Primary to configure Log
> Shipping
> -- for the database [primaryserver].[CARDS],
> -- 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: [primaryserver] ******
>
>
> 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'CARDS'
> ,@backup_directory = N'e:\lship'
> ,@backup_share = N'\\ip.of.primary\lship'
> ,@backup_job_name = N'LSBackup_CARDS'
> ,@backup_retention_period = 4320
> ,@monitor_server = N'ip.of.monitor.instance'
> ,@monitor_server_security_mode = 0
> ,@monitor_server_login = N'**********'
> ,@monitor_server_password = N'**********'
> ,@backup_threshold = 60
> ,@threshold_alert_enabled = 1
> ,@history_retention_period = 5760
> ,@backup_job_id = @LS_BackupJobId OUTPUT
> ,@primary_id = @LS_PrimaryId OUTPUT
> ,@overwrite = 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_ip.of.primary1'
> ,@enabled = 1
> ,@freq_type = 4
> ,@freq_interval = 1
> ,@freq_subday_type = 4
> ,@freq_subday_interval = 1
> ,@freq_recurrence_factor = 0
> ,@active_start_date = 20071119
> ,@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'CARDS'
> ,@secondary_server = N'ip.of.lship.instance'
> ,@secondary_database = N'CARDS_REP'
> ,@overwrite = 1
>
> -- ****** End: Script to be run at Primary: [primaryserver]  ******
>
>
> -- Execute the following statements at the Secondary to configure Log
> Shipping
> -- for the database [ip.of.lship.instance].[CARDS_REP],
> -- 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: [ip.of.lship.instance]
> ******
>
>
> 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 =
> master.dbo.sp_add_log_shipping_secondary_primary
> @primary_server = N'primaryserver'
> ,@primary_database = N'CARDS'
> ,@backup_source_directory = N'\\ip.of.primary\lship'
> ,@backup_destination_directory = N''
> ,@copy_job_name = N''
> ,@restore_job_name = N''
> ,@file_retention_period = 4320
> ,@monitor_server = N'ip.of.monitor.instance'
> ,@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 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 = 20071120
> ,@active_end_date = 99991231
> ,@active_start_time = 0
> ,@active_end_time = 235900
> ,@schedule_uid = @LS_SecondaryCopyJobScheduleUID OUTPUT
> ,@schedule_id = @LS_SecondaryCopyJobScheduleID OUTPUT
>
> EXEC 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 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 = 20071120
> ,@active_end_date = 99991231
> ,@active_start_time = 0
> ,@active_end_time = 235900
> ,@schedule_uid = @LS_SecondaryRestoreJobScheduleUID OUTPUT
> ,@schedule_id = @LS_SecondaryRestoreJobScheduleID OUTPUT
>
> EXEC 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 =
> master.dbo.sp_add_log_shipping_secondary_database
> @secondary_database = N'CARDS_REP'
> ,@primary_server = N'primaryserver'
> ,@primary_database = N'CARDS'
> ,@restore_delay = 0
> ,@restore_mode = 0
> ,@disconnect_users = 0
> ,@restore_threshold = 45
> ,@threshold_alert_enabled = 1
> ,@history_retention_period = 5760
> ,@overwrite = 1
>
> END
>
>
> IF (@@error = 0 AND @LS_Add_RetCode = 0)
> BEGIN
>
> EXEC msdb.dbo.sp_update_job
> @job_id = @LS_Secondary__CopyJobId
> ,@enabled = 1
>
> EXEC msdb.dbo.sp_update_job
> @job_id = @LS_Secondary__RestoreJobId
> ,@enabled = 1
>
> END
>
>
> -- ****** End: Script to be run at Secondary: [ip.of.lship.instance]
> ******

AddThis Social Bookmark Button