SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Logins and DB Users


Logins and DB Users

Author
Message
MSSQL_NOOB
MSSQL_NOOB
SSC Veteran
SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)

Group: General Forum Members
Points: 263 Visits: 173
Issue Replication:
1) Create Login for user Domain\ABC
2) User Mapping for user Domain\ABC to Database ABCTest (DB User created in ABCTest database)
3) Remove Domain\ABC username from Login

I am still able to login using Domain\ABC to ABCTEST database and query for records.

Questions
a) Is there a way to delete both Logins and DB User at the same time without having to go through each user databases looking for the username?
b) Anyone know of any scripts that will check DB Users on each database against Logins and output those that does not exists in Logins?
John Mitchell-245523
John Mitchell-245523
SSC-Dedicated
SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)

Group: General Forum Members
Points: 34403 Visits: 16649
If you use the GUI in Management Studio to delete the login, you can go to the User Mapping tab and untick each database that is ticked. This will delete the users from the databases and is quicker than going into each database individually.

John
Orlando Colamatteo
Orlando Colamatteo
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39296 Visits: 14411
MSSQL_NOOB (6/27/2013)
Issue Replication:
1) Create Login for user Domain\ABC
2) User Mapping for user Domain\ABC to Database ABCTest (DB User created in ABCTest database)
3) Remove Domain\ABC username from Login

I am still able to login using Domain\ABC to ABCTEST database and query for records.

Questions
a) Is there a way to delete both Logins and DB User at the same time without having to go through each user databases looking for the username?

The GUI is a shortcut as John pointed out. Do yourself a favor though, use the Script button and review it before running it in a Query window.

b) Anyone know of any scripts that will check DB Users on each database against Logins and output those that does not exists in Logins?

Loginless In Seattle

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
MSSQL_NOOB
MSSQL_NOOB
SSC Veteran
SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)

Group: General Forum Members
Points: 263 Visits: 173
Thanks for the tip, John.

And OPC, thank you for the link. I was able to run the script on SQL Server 2008. You don't by any chance have a script to check on SQL Server 2000, do you?
Orlando Colamatteo
Orlando Colamatteo
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39296 Visits: 14411
MSSQL_NOOB (6/27/2013)
Thanks for the tip, John.

And OPC, thank you for the link. I was able to run the script on SQL Server 2008. You don't by any chance have a script to check on SQL Server 2000, do you?


What is SQL 2000? :-P

Sorry, no. My SQL 2000 knowledge fell off the queue a long time ago.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
MSSQL_NOOB
MSSQL_NOOB
SSC Veteran
SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)SSC Veteran (263 reputation)

Group: General Forum Members
Points: 263 Visits: 173
No apologies necessary. I totally understand. :-)
Unfortunately, this place I'm currently volunteering is still very heavy on SQL Server 2k.

Nevertheless, thank you very much for your help.
Steve Jones
Steve Jones
SSC Guru
SSC Guru (145K reputation)SSC Guru (145K reputation)SSC Guru (145K reputation)SSC Guru (145K reputation)SSC Guru (145K reputation)SSC Guru (145K reputation)SSC Guru (145K reputation)SSC Guru (145K reputation)

Group: Administrators
Points: 145529 Visits: 19425
This might work. Looks like it's got old sprocs being called in it

http://www.sqlservercentral.com/scripts/Security/63991/



Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search