Question :
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.
Answer :
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.
-
A default instance running under Local System should run under NT ServiceMSSQLServer, then NT AuthoritySystem has
db_datareader
role to the “master” database. -
A named instance running under Local System should run under NT ServiceMSSQLServer or NT ServiceMSSQL$ServerXInstanceX, then ONLY NT AuthoritySystem has
db_datareader
role to the “master” database. -
If running under Domain or Local user account the instance should run under MydomainMyUser, then MydomainMyUser has “db_datareader” role to the “master” database