Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:18:51+00:00 2026-05-26T03:18:51+00:00

I have just moved a database from our test server to the live server

  • 0

I have just moved a database from our test server to the live server by creating an empty database and restoring a backup to it.

Despite adding the Login correctly, I am getting the following error:

The server principal “myUser” is not able to access the database
“myDatabase” under the current security context.

I have tried clicking F7 in Object Explorer Details with no luck. I can get the error simply by running:

> USE myDatabase 
> GO
> 
> EXECUTE AS LOGIN = 'myUser'

Running the following script (from a related question) shows the user correctly

select  princ.type_desc
,       princ.name
,       perm.permission_name
,       perm.state_desc
,       object_name(perm.major_id)
from    sys.database_permissions perm
left join
        sys.database_principals princ
on      princ.principal_id  = perm.grantee_principal_id 

SQL_USER myUser CONNECT GRANT

Any suggestions???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:18:52+00:00Added an answer on May 26, 2026 at 3:18 am

    Try using sp_change_users_login with the “Auto_Fix” action to resync the logins between the server and the database.

    exec sp_change_users_login @Action = 'Auto_Fix', @UserNamePattern = 'myUser'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weekly script that moves data from our live database and puts
I have just moved from phase 1 to phase 2 of a project. In
I have just moved job and gone from VB 6 to VB.Net and found
I have just set up cruise control.net on our build server, and I am
We just recently moved our DB from 9i to 10G (Yes..better late than never
need help from some gurus here, I have a database which I have moved
I have just moved a web application to a windows server and having some
I just moved my website from a test domain to the actual domain and
Have just started using Google Chrome , and noticed in parts of our site,
I have just inherited a server application, however it seems that the only copy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.