SqlException: User does not have permission to perform this action

Issue

The import service fails to run and the following error occurs:

SqlException: User does not have permission to perform this action

Cause

At the beginning of import, AssetTrack re-indexes it's database. During this process, we call EXEC updatestats stored AssetTrack procedure. In order for this procedure to run successfully, the DBO User of the AssetTrack database must match the AssetTrack Database Owner.

To find out the database owner, right click the AssetTrack database in SQL and choose properties.

 

 

From the above screenshot, we can see that the owner is sa2. 

Expand the database node along with the Security and User in the Object Explorer tree. Right click on dbo and select properties.

 

 

The login name should match the Owner from the first screenshot. In this case, the login name is sa. sa was the original creator of the database, however it was restored into SQL with the sa2 account. When this occurs, the owner or db user login name must be changed to match.

Solution

Run the following query to change the Database Owner:

EXEC sp_changedbowner 'usernamehere';

 

 

Have more questions? Submit a request

Comments

Please sign in to leave a comment.