Logins no longer exists.

Today while checking the logins, just want to clear/clean logins which are no longer exists on NT domain.

To get the logins which are no longer exits run the following:

EXEC master.dbo.sp_validatelogins

http://msdn.microsoft.com/en-us/library/ms181728.aspx

It will show you the list of SID and logins which are not exists. And then after that run the below command to remove that login.

Exec.sp_revokelogin ‘domain\Login name’

http://msdn.microsoft.com/en-us/library/ms188784.aspx

This is old commands and will be remove in future release… so if you are using sql server 2005 and above use below command which will be same as sp_revokelogin.

DROP LOGIN login_name

http://msdn.microsoft.com/en-us/library/ms188012(SQL.90).aspx

You can use the Enterprise Manager or SSMS for the same.

Go to Securities –> logins –> Right click and Delete login.

HTH.

Vinay

twitter @thakurvinay.

Advertisements
This entry was posted in What I learned today and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s