3

Recently moved SQL Server from a desktop to a virtual machine and now facing the below error message while connecting to SQL Server using SQL Authentication.

-2147205987:[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot execute as the database principal because the principal “guest” does not exist, this type of principal cannot be impersonated, or you do not have permission.

The user ID SQLADMIN is used to connect to SQL Server.

May I know the permissions that SQLADMIN should have to do a BULK_COPY operation along with normal functions?

Currently SQLADMIN is set with the PUBLIC and BULKADMIN permissions. For Database1 and Database2 (used in the project), SQLADMIN is given PUBLIC and db_OWNER permissions.

After these changes, I am still facing the same issue.

  • 2
    You say that the database has been moved. Have both user and login been created correctly on the new server and are they connected? If not careful, one often ends up with orphan users because the login is either not created or the user has not been connected to the login. – Allan S. Hansen Apr 1 '16 at 5:21
  • @AllanS.Hansen - What version of SQL Server are you using? 2008 R2, 2012, 2014? – RLF Apr 1 '16 at 17:40
1

I have not needed to overcome this problem on a SQL Server except when I make a mistake with permissions. I do not endorse the below, because I have not spent time on the problem.

However, for what it is worth, Symantec has an article on this issue using SQL Server 2012 and Windows 2012 at:

Cannot execute as the database principal because the principal “guest” does not exist

Their answer is based on how your SQL Server is configured.

  1. A default instance running under Local System should run under NT Service\MSSQLServer, then NT Authority\System has db_datareader role to the “master” database.

  2. A named instance running under Local System should run under NT Service\MSSQLServer or NT Service\MSSQL$ServerXInstanceX, then ONLY NT Authority\System has db_datareader role to the “master” database.

  3. If running under Domain or Local user account the instance should run under Mydomain\MyUser, then Mydomain\MyUser has “db_datareader” role to the “master” database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.