Wednesday, November 30, 2011

Terminating this procedure. 'dbo' is a forbidden value for the login name parameter in this procedure.

I was trying to move a database from one server to the other. After successfully restoring the database. I ran the orphaned users report and found a couple of users and I fixed them by creating new logins for them.

The user dbo was being reported as an orphaned user and if tried to run the command to fix it I would get the following error.

Server: Msg 15287, Level 16, State 1, Line 1
Terminating this procedure. 'dbo' is a forbidden value for the login name parameter in this procedure.

The fix for this error is to run the following command.

Exec sp_changedbowner 'sa' 



If you are still getting a list of orphaned users then do the following.
1) This will lists the orphaned users:
    EXEC sp_change_users_login 'Report'

2) If you already have a login id and password for this user, fix it by running following command for    each user
    EXEC sp_change_users_login 'Auto_Fix', 'user'

3) If you want to create a new login id and password for this user, fix it by running the following command for each user. Make sure you assign the password and give that to the user.

  EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'

No comments:

Post a Comment