Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating ASP.NET Membership Database to SQL Azure

I am trying to migrate a database from SQL Server 2008 to SQL Azure. The database that I am attempting to migrate includes the ASP.NET Membership database (http://www.asp.net/web-forms/tutorials/moving-to-aspnet-20/membership). This database works fine when I run it in my SQL Server 2008 database. However, when I try to authenticate a user against SQL Azure, I receive an error that says:

"Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again."

However, I'm not sure what to do. When I try to update the index on the aspnet_Applications table, I receive a foreign key problem. I am using the following in an attempt to migrate my non-clustered index to a clustered index:

ALTER TABLE aspnet_Applications
DROP CONSTRAINT PK__aspnet_A__SOMEID

ALTER TABLE aspnet_Applications
ADD CONSTRAINT PK__aspnet_A__SOMEID PRIMARY KEY CLUSTERED(ApplicationId)

Can someone please help me overcome this issue? Thank you!

like image 371
JavaScript Developer Avatar asked Apr 13 '12 12:04

JavaScript Developer


People also ask

Can ASP Net connect to SQL Server?

ASP.NET Database Connection can connect with most databases, including Oracle, Microsoft SQL Server, MongoDB, and MySQL.

How does Microsoft SQL Connect to database in asp net?

Select >new Project from web option use ASP.NET empty Web Application. After loading project, select click Tools at top then select connect to Database option. Add connection dialogue box will appear click at change option and select the Microsoft SQL Server. Now enter your server name.

How do I migrate Azure database to another Azure SQL Database?

Open a new project and under Type, select Migration. Select source and target as SQL Server and Azure SQL Database, respectively. Select Schema and data as the scope of migration and choose Create. Specify the details of the source server (e.g., server name, credentials) in your migration project.


1 Answers

I had problems with the ASP.NET membership provider tables (non clustered indexes) and missing the "WITH (NOLOCK)" statement on the stored procedure aspnet_Membership_GetNumberOfUsersOnline etc.

The migration tool found here fixed the problems and exported the database to Azure.

http://sqlazuremw.codeplex.com/

It is a nice wizard that connects to your existing SQL Server and migrate the selected database to Azure.

like image 65
AH. Avatar answered Sep 22 '22 13:09

AH.