Find out job owner

  • Dear all,

    I am trying to find out if there is a way of finding out if a particular login in different servers owns a job instead of loging into the individual server and finding out please?

    Thank you in advance!

  • You could run a query like this:

    SELECT dbo.SQLAGENT_SUSER_SNAME(owner_sid)

    , SUSER_SNAME(owner_sid) as OwnerName

    , name as JobName

    FROM dbo.sysjobs

    with a where clause on the owner name that you are interested in. If you need to run it against multiple servers you could create a Central Management Server and then add the servers to a group and run the query against those servers.



    Microsoft Certified Master - SQL Server 2008
    Follow me on twitter: @keith_tate

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • You have to be logged in to the server that you want to query. Another option is to use login to 1 server and use linked servers or openrowset function to query the other servers. You'll have to use a query that looks more or less like the one bellow

    select name as JobName

    from msdb.dbo.sysjobs

    where suser_sname(owner_sid) = 'Write Login name here'

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Adi Cohn-120898 (10/22/2013)


    You have to be logged in to the server that you want to query. Another option is to use login to 1 server and use linked servers or openrowset function to query the other servers. You'll have to use a query that looks more or less like the one bellow

    select name as JobName

    from msdb.dbo.sysjobs

    where suser_sname(owner_sid) = 'Write Login name here'

    Adi

    That is why I recommended use a Central Management Server.



    Microsoft Certified Master - SQL Server 2008
    Follow me on twitter: @keith_tate

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • ..or, if this happens a lot, and it's on SQL2008 and above, you could use Policy Based Management. 🙂

    Easier solution would be to use Powershell.

    [font="Courier New"]sqlmunkee[/font]
    [font="Courier New"]Bringing joy and happiness via SQL Server since 1998[/font]

  • Thank you all for your recommendations.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply