Page 1 of 1

MSSQL "Ghost"-user

Posted: Thu Mar 18, 2004 7:27 pm
by ^rooker
[PROBLEM]
When reimporting a database backup with user information still stored in it, it might happen that the restored database ends up with some "ghost users" which do NOT appear in the Enterprise Manager GUI.
The problem with those accounts is, that you cannot use them to login, but if you try to re-assign the same account to the reimported DB, an error appears saying that the user IS already assigned.

[SOLUTION]
Use an SQL Query tool, connect to the affected database and execute some of the following commands:

-------------------------------------------------------
EXEC sp_revokedbaccess 'username'
EXEC sp_dropuser 'username'
EXEC sp_droplogin 'username'
-------------------------------------------------------

(of course: replace 'username' with the name of the user you want to remove)

General MSSQL user-information

Posted: Thu Mar 18, 2004 7:34 pm
by ^rooker
to get information about any user assigned to the current database, use:

---------------------------------------
EXEC sp_helpuser 'username'
---------------------------------------