How to Generated this type Guid key for backups [Resolved]

Posted by Jayakumars under Sql Server on 1/30/2017 | Points: 10 | Views : 284 | Status : [Member] [MVP] | Replies : 7
Hi

I saw this command for automatically backup in stackoverflow url. But i need
how to generated this guid value how will do this any one guide me

60CD93F9-CFC2-4A84-8B06-3AD8DEADBEEF

this is command

"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqllogship.exe" -Backup 60CD93F9-CFC2-4A84-8B06-3AD8DEADBEEF -server DummyServer

Mark as Answer if its helpful to you


Responses

Posted by: A2H on: 1/31/2017 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
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

Posted by: A2H on: 1/31/2017 [Member] [MVP] Silver | Points: 25

Up
0
Down
if you see the actual syntax of sqllogship.exe if states like below
sqllogship -server instance_name { -backup primary_id | -copy secondary_id | -restore secondary_id } [ –verboselevel level ] [ –logintimeout timeout_value ] [ -querytimeout timeout_value ]

So basically the GUID is primary_id for the primary database.User can obtain this ID by selecting it from the log_shipping_primary_databases system table or by using the sp_help_log_shipping_primary_database stored procedure.

Try running the below script on msdb database
SELECT * FROM log_shipping_primary_databases



Thanks,
A2H
My Blog

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 1/31/2017 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi

YOU answer not fixed my issue. But you set mark as answer

again i remain

syntax and sample all those things i search in google already


right now i need how to set this guid number whether database backup automattically . check below code
for backup

60CD93F9-CFC2-4A84-8B06-3AD8DEADBEEF

this is command

"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqllogship.exe" -Backup 60CD93F9-CFC2-4A84-8B06-3AD8DEADBEEF -server DummyServer

Mark as Answer if its helpful to you

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A2H on: 1/31/2017 [Member] [MVP] Silver | Points: 25

Up
0
Down
Please note that I haven't marked the response as answer.Unfortunately I am not sure who did that. May be moderators can help here.

Feel free to umark my response if it didnt answer your question.



Thanks,
A2H
My Blog

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 1/31/2017 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi
Dont mistaken me

Superb response from you. Exactly this i want .

wonderful , Very Good response.

Always your answer helpful

Mark as Answer if its helpful to you

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 2/1/2017 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi

in your Query created @backup_job_name = N'LSBackup_TestDB' but how to include here schedule timing also
how will do this?
can you updated your Query.

Mark as Answer if its helpful to you

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 2/1/2017 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi
A2H

your Query Created Successfully. But i canot set schedule timing in your Query then when i start the job then only
backup Query run.
I set schedule timing but not working.

Give me solution for this - Soon

Most urgent


Mark as Answer if its helpful to you

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response