
Hello Jayakumar,
Sorry I misread your question, I thought you were trying to understand the syntax of sqllogship.exe command.
Coming to your question, to make the sqllogship.exe to work, you need to have an entry on "log_shipping_primary_databases" table in msdb database. To add the entry you can use the below script
DECLARE @LS_BackupJobId AS uniqueidentifier ;
DECLARE @LS_PrimaryId AS uniqueidentifier ;
EXEC master.dbo.sp_add_log_shipping_primary_database
@database = N'TestDB'
,@backup_directory = N'c:\lsbackup' -- Change this to your system physical path
,@backup_share = N'\\c\backup' -- Change this to your network share
,@backup_job_name = N'LSBackup_TestDB'
,@backup_retention_period = 1440
,@monitor_server = N'MYSERVERNAME' -- Change your db server name here
,@monitor_server_security_mode = 1
,@backup_threshold = 60
,@threshold_alert = 14420
,@threshold_alert_enabled = 0
,@history_retention_period = 1440
,@backup_job_id = @LS_BackupJobId OUTPUT
,@primary_id = @LS_PrimaryId OUTPUT
,@overwrite = 1
,@backup_compression = 0;
GO
Ensure that you chagned the paramter. Once after you add the values you can use below query to fetch the primary key id
SELECT * FROM log_shipping_primary_databases
From here you will get the primary key id. You just need to replace that in your command
PS: primary_id is autogenerated so you dont have any control on that. Hence the primary_id which will get assigned will be different from what you have in your sample code
Thanks,
A2H
My Blog
Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator