SCCM I AM

Ad you

Sunday, April 14, 2019

How to identify SQL Server job owner

I was trying to remove a user from SQL Server database box but while trying to remove the user, I got below error:














Now in order to identify where the user has create a SQL Server job, you can run below query to get the job details owned by the user. Here we go:

Select Name from msdb.dbo.sysjobs
WHERE owner_sid IN 
(
SELECT sid
FROM MASTER.sys.syslogins
WHERE Name = 'kirankr'
)

Once you get the job details, you have to remove the maintenance plan of that job from SQL Server Management Studio > Server Node > Management > Maintenance Plans > Get the plan name> Right click it > Delete . After successful removal of dependent job, you can delete the user from the database.Hope you like this post. If yes, do comment and share the post to those who needs it.



0 comments:

Post a Comment