Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have backup database from server A. Then I want to restore it in server B. I have manage to restore it, but I cannot connect to it when running my VB program. I already change the configuration file, but still doesn't work.

I guess that I need to change something related with the permission, but I dont know what should I change. Anyone can help me?

share|improve this question

migrated from Dec 16 '11 at 6:25

This question came from our site for professional and enthusiast programmers.

What database software? SQL Server, MySQL, Oracle, PG, etc....? – Jake Feasel Dec 16 '11 at 6:03
This question belongs on ServerFault – Verbeia Dec 16 '11 at 6:08
@Verbeia or possibly on DBA – Jake Feasel Dec 16 '11 at 6:09
@JakeFeasel yes but SF is in the list when one votes to close ;-) – Verbeia Dec 16 '11 at 6:10
try to create new login. – BizApps Dec 16 '11 at 6:14

In the absence of more information, I'll guess SQL Server.

  • SQL Server uses logins to connect at the Instance (server) level
  • A login maps to a user in a databases

You can see this in SSMS in the Security nodes on Object Explorer.

I suspect you have "orphaned" users. That is, the users in your restored database no longer have an associated login to map to. This need recreated (Windows logins) or remapped (SQL logins)

The MSDN article Troubleshooting Orphaned Users has checks, fixes and more details. I'd simply copy/paste or re-hash this so I recommend you look at this.

share|improve this answer
yes, im using MS SQL Server 2005. for the parent server, i have created a user which is user A. for the database, i give permission for user A to access the database. am i doing the right thing? – Humaira Laila Dec 16 '11 at 9:48
@Humaira Laila: if you have created a SQL login called "userA" on the new server then you need to map it as per the link I gave. – gbn Dec 16 '11 at 10:12
i guess it is because, the setting for database user:dbo is from server A. since i overwrite the bakup file, it had restore all the user too. that is why it the database cannot be access. but i try to modified the login setting for dbo, but it cannot be modified.any idea? – Humaira Laila Dec 16 '11 at 10:35
Don't change dbo, please read the link and run ALTER USER UserA ... – gbn Dec 16 '11 at 10:43
OK i have restore again the database. so now everything is set the initial.For my database, i open user(dbo) properties. i realize that the login name is empty,so as you said, this is what we called orphaned users. then i try to change the login name, so i run this query : USE <databasename>; exec sp_changedbowner <loginuser>; then i change the config file: <connectionStrings> <add name="AMR.My.MySettings.AMRConnectionString" connectionString="Data Source=servername;Initial Catalog=AMR;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> still doesn't work – Humaira Laila Dec 19 '11 at 7:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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