Help is on the way. Run this:
EXEC xp_logininfoDo you see any ex-employees listed with admin rights? Oops. Next check the members of the groups that are listed:
EXEC xp_logininfo @acctname = '[group_name]', @option = 'members'Maybe you still have a little more cleanup work to perform, eh?
Here's another way to see the active sysadmins:
SELECT l.loginnameFinally, within a single database, this query is useful for reviewing folks' rights:
FROM SYS.syslogins l
join sys.server_principals ss on l.[name] = ss.[name]
where ss.is_disabled = 0
and l.sysadmin = 1
;WITH RT AS (SELECT name AS RoleType, principal_id
FROM sys.database_principals
WHERE (type_desc = 'DATABASE_ROLE'))
SELECT P.name, RT.RoleType
FROM RT INNER JOIN
sys.database_role_members AS RM ON RT.principal_id = RM.role_principal_id INNER JOIN
sys.database_principals AS P ON P.principal_id = RM.member_principal_id
ORDER BY RT.RoleType, P.name
No comments:
Post a Comment