SQL Server 2008 - User cannot access restored database

I am trying to move a database from one SQL Server database running on one machine to another machine, which is a test server and a copy of the original.

On the main machine, I took a backup copy of the myDB database. On a test machine, I deleted the existing legacy myDB database. On a test machine, I restored a new myDB database.

It seems that the data met successfully. But I have a problem accessing the database. The owner of all tables is "user1", and user1 exists with the same name in both DBs.

After trying to access the restored database on a test computer, although problems arise as user1. It is first said that the password for user1 is incorrect. After resetting the password, he says that user1 does not have a default set of databases. But it is already installed in myDB. This is the same name as the restored db-myDB.

What did I do wrong when restoring the database? Does user1 have to be deleted in addition to the database before trying to restore the backup? I have tried this. How to handle recovery updates and support user access?

+5
source share
2 answers

after recovery

ALTER USER user1 WITH LOGIN = user1

inside the restored database that will fix the inconsistent SID

. sp_change_users_login ALTER USER UserName WITH LOGIN = UserName

+9

, (, ) , ( ) .

0

All Articles