Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accidentally Deleted a Login

Status
Not open for further replies.

eao

MIS
Joined
Nov 14, 2001
Messages
104
Location
US
How can I restore a deleted login? I deleted it accidentally through Enterprise Manager. Thanks
 
i dont know of any way to actually restore it. restoring the master prior to its deletion might restore it, but im not sure. ive never had to try to restore a user. i just recreate them.
 
I tried to recreate the login, but SQL told me it already exists. The login does not appear under Security > Logins.
 
You have an orphaned login. Usually running sp_revokelogin will solve the problem.

Refer to the BOL for more information on orphaned users.

-SQLBill

BOL=Books OnLine=Microsoft SQL Server's HELP
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine

Posting advice: FAQ481-4875
 
This looks like it is for a Windows login.

Arguments
[@loginame =] 'login'

Is the name of the Windows NT user or group. login is sysname, with no default. login can be any existing Windows NT username or group in the form Domain\User.

I should have mentioned that this is a SQL login.
 
Use sp_droplogin then. Also try sp_revokedbaccess.

-SQLBill
 
OK, I'm starting to figure out what is going on here. I am able to drop and recreate the login, but the user still exists in the database, and I cannot remove it. I also cannot add the recreated user to the database; I receive a message stating that the user already exists in the database. When I try to remove the user from the database, I get a message stating that the user does not exist in the database.
 
The user does not exist in the sysusers table of this particular database; can I add it in manually?
 
I think I repaired things ultimately by using sp_grantdbaccess. The user can log in and perform normal functions. Thanks to those who helped!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top