Solved

SQL Jobs - Users that can create/modify/delete

Posted on 2014-11-18
4
150 Views
Last Modified: 2014-11-18
Is there a script to tell me which of my sql instance users have the ability to create, modify, and delete SQL agent jobs?
0
Comment
Question by:holemania
  • 2
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 40450047
;WITH RoleMembers (member_principal_id, role_principal_id)
AS
(
  SELECT
   rm1.member_principal_id,
   rm1.role_principal_id
  FROM sys.database_role_members rm1 (NOLOCK)
   UNION ALL
  SELECT
   d.member_principal_id,
   rm.role_principal_id
  FROM sys.database_role_members rm (NOLOCK)
   INNER JOIN RoleMembers AS d
   ON rm.member_principal_id = d.role_principal_id
)
select distinct rp.name as database_role, mp.name as database_user
from RoleMembers drm
  join sys.database_principals rp on (drm.role_principal_id = rp.principal_id)
  join sys.database_principals mp on (drm.member_principal_id = mp.principal_id)
WHERE rp.name = 'SQLAgentUserRole'
0
 

Author Comment

by:holemania
ID: 40450086
Thanks Aneesh.  

Is there a way to find out who's a member of the "database_user"?  Example, I get "dc_admin", would like to find out who's a member of that role.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 40450108
use the same query just change 'SQLAgentUserRole' to 'dc_admin'

dc admin and dc_operators are the data collector roles.  usually an SQL Server internal user will be the sole member of this role
0
 

Author Closing Comment

by:holemania
ID: 40450318
Thank you.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add different cell to otherwise similiar row 4 45
Email Notifications for SQL 2005 9 35
Run SQL Server Proc from Access 11 37
2 IIF's in Access query 25 44
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question