After creating a snapshot job using sp_addpublication_snapshot how do I get
the job_id?
I want to be able to rename the job as well as change the owner through
script after it is created but sp_update_job requires the old name or job id
and sp_addpublication_snapshot doesn't return either.
Thanks
Select msdb.dbo.sysjobs.name from msdb.dbo.sysjobs INNER JOIN
pubisherserver.publisherdb.dbo.syspublications
ON (msdb.dbo.sysjobs.job_id =
pubisherserver.publisherdb.dbo.syspublications.sna pshot_jobid)
WHERE pubisherserver.publisherdb.dbo.syspublications.nam e = 'Your
publication Name'
-Nitin Rana
"Darren" wrote:
> After creating a snapshot job using sp_addpublication_snapshot how do I get
> the job_id?
> I want to be able to rename the job as well as change the owner through
> script after it is created but sp_update_job requires the old name or job id
> and sp_addpublication_snapshot doesn't return either.
> Thanks
>
>
|||I don't have a syspublications table. I've looked in the database being
published, the master and msdb databases.
"Nitin" <Nitin@.discussions.microsoft.com> wrote in message
news:E0FB2C01-6166-4122-8A93-B10DC968527D@.microsoft.com...[vbcol=seagreen]
> Select msdb.dbo.sysjobs.name from msdb.dbo.sysjobs INNER JOIN
> pubisherserver.publisherdb.dbo.syspublications
> ON (msdb.dbo.sysjobs.job_id =
> pubisherserver.publisherdb.dbo.syspublications.sna pshot_jobid)
> WHERE pubisherserver.publisherdb.dbo.syspublications.nam e = 'Your
> publication Name'
> -Nitin Rana
>
> "Darren" wrote:
get[vbcol=seagreen]
job id[vbcol=seagreen]
|||sysmergepublications
"Darren" <deo.is@.unknown.com> wrote in message
news:edlm8OhNFHA.3420@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> I don't have a syspublications table. I've looked in the database being
> published, the master and msdb databases.
>
> "Nitin" <Nitin@.discussions.microsoft.com> wrote in message
> news:E0FB2C01-6166-4122-8A93-B10DC968527D@.microsoft.com...
I[vbcol=seagreen]
> get
through
> job id
>
Showing posts with label snapshot. Show all posts
Showing posts with label snapshot. Show all posts
Friday, March 23, 2012
Sunday, February 26, 2012
Getting Info from Merge Agent Programmatically
Hi - I was wondering how one goes about getting infomation on agent
activity (merge and snapshot agent in my case). I would like to know when
the last synchronization took place, if it failed or not, any error
messages, etc.
How can I get this information without EM?
Thank you,
Maer
Thank you, Paul. This is exactly what I was looking for.
Do we have any control over what the name of the agent is?
Thank you - Maer
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:0ed301c4b1c8$0f7b9770$a601280a@.phx.gbl...
> Maer,
> this script will get you details of the last history for
> the merge agent called 'DH1791628-Northwind-
> NorthwindStaff-DH1791628-3'.
> It will have basic error info if an error occurs.
> If you want the detailed error info, you'll need to join
> to the MSrepl_errors table: MSmerge_history.error_id =
> MSrepl_errors.id. This table typically has several rows
> so you might want to use a cursor to add the text
> together.
> HTH,
> Paul Ibison (SQL Server MVP)
>
> declare @.agent_id int
> select @.agent_id = id from msmerge_agents where name
> = 'DH1791628-Northwind-NorthwindStaff-DH1791628-3'
> select top 1 case
> when rh.runstatus = 1 then 'Start'
> when rh.runstatus = 2 then 'Succeed'
> when rh.runstatus = 3 then 'In progress'
> when rh.runstatus = 4 then 'Idle'
> when rh.runstatus = 5 then 'Retry'
> when rh.runstatus = 6 then 'Fail'
> end as RunStatus,
> 'start_time' = convert(nvarchar(12), start_time, 112) +
> substring(convert(nvarchar(24), start_time, 121), 11, 13),
> comments
> from MSmerge_history rh
> order by timestamp desc
activity (merge and snapshot agent in my case). I would like to know when
the last synchronization took place, if it failed or not, any error
messages, etc.
How can I get this information without EM?
Thank you,
Maer
Thank you, Paul. This is exactly what I was looking for.
Do we have any control over what the name of the agent is?
Thank you - Maer
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:0ed301c4b1c8$0f7b9770$a601280a@.phx.gbl...
> Maer,
> this script will get you details of the last history for
> the merge agent called 'DH1791628-Northwind-
> NorthwindStaff-DH1791628-3'.
> It will have basic error info if an error occurs.
> If you want the detailed error info, you'll need to join
> to the MSrepl_errors table: MSmerge_history.error_id =
> MSrepl_errors.id. This table typically has several rows
> so you might want to use a cursor to add the text
> together.
> HTH,
> Paul Ibison (SQL Server MVP)
>
> declare @.agent_id int
> select @.agent_id = id from msmerge_agents where name
> = 'DH1791628-Northwind-NorthwindStaff-DH1791628-3'
> select top 1 case
> when rh.runstatus = 1 then 'Start'
> when rh.runstatus = 2 then 'Succeed'
> when rh.runstatus = 3 then 'In progress'
> when rh.runstatus = 4 then 'Idle'
> when rh.runstatus = 5 then 'Retry'
> when rh.runstatus = 6 then 'Fail'
> end as RunStatus,
> 'start_time' = convert(nvarchar(12), start_time, 112) +
> substring(convert(nvarchar(24), start_time, 121), 11, 13),
> comments
> from MSmerge_history rh
> order by timestamp desc
Labels:
agent,
agentactivity,
case,
database,
infomation,
merge,
microsoft,
mysql,
oracle,
programmatically,
server,
snapshot,
sql,
whenthe
Subscribe to:
Posts (Atom)