0

I am working on an ASP.NET project which accessing a remote SQL Server database. My objective is to set up this remote database on my local system.

I have tried 2 ways, but I'm facing problems both ways:

(1) Using SQL Server import and export wizard.

I get an error saying that the connection state is closed, but I am able to fetch all database tables of remote database:

enter image description here

enter image description here

(2) Schema and Data comparison from SQL Server object explorer inside of Visual Studio.

Here I get an error in that database user-related issues are showing. User or group not found:

enter image description here

I have tried other things in the last 4 days also but not found any clue to solve it. I am new to ASP.NET and SQL. Please help. Any helpful answer will always be appreciated. Thanks.

I have tried the Dennis1679's answer, but the following issues are coming.

One or more unsupported elements were found in the schema used as of a data package. Error SQL71564:Error validating element[username]: The element[username] has been orphaned from its login and cannot be deployed.

enter image description here

1 Answer 1

1

Install SQL Server Management Studio, connect to the remote database, right-click on the database, choose export data-tier application. Then connect to your local instance and import data-tier application.

Connect to the remote database:

Login

Right-click on the database choose export data-tier application:

Export data-tier

  • Follow the wizard and save the .bacpac somewhere
  • Connect to your local SQL Server (localdb)\MSSQLLocalDB
  • Choose Import data-tier application
  • Select the previously saved .bacpac and import it. Now your local instance should have the same database

Import data-tier application

Sign up to request clarification or add additional context in comments.

2 Comments

this error is coming while exporting the database - "One or more unsupported elements were found in the schema used as of a data package. Error SQL71564:Error validating element[username]: The element[username] has been orphaned from its login and cannot be deployed."
@AbhishekJoshi My answer will work for you, but you're now facing a different issue. Try to follow learn.microsoft.com/en-us/sql/sql-server/failover-clusters/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.