Exporting ASPNETDB.MDF to an external database
ASP.Net 4.0/C#/MSSQL/Microsoft SQL Server Management Studio
Hey I am now at the stage where I want to move a project to a live server
Now I want to move the tables from the ASPNETDB file in the App_Data folder to the server.
I have used the Aspnet_regsql.exe
tool to successfully generate the following tables
on my shared hosted server
dbo.aspnet_Applications
dbo.aspnet_Membership
dbo.aspnet_Paths
dbo.aspnet_PersonalizationAllUsers
dbo.aspnet_PersonalizationPerUser
dbo.aspnet_Profile
dbo.aspnet_Roles
dbo.aspnet_SchemaVersions
dbo.aspnet_Users
dbo.aspnet_UsersInRoles
dbo.aspnet_WebEvent_Events
Now what is the next step to essentially copy the tables from ASPNETDB.MDF to these tables on the server?
Many thanks =)
What version of SQL server have you got?
If you can open the database locally in SQL Management Studio you can just use Generate Scripts
that you can then simply open and run on your production server. It has the option to copy
- Data
- Schema
- Both
So you can start with an empty database on Production and copy both the data and schema at once with a single .sql file and you'll be good to go.
You can use the export data feature from the management studio to migrate the data from the msf file to the live dtabse.
You are really better off putting all the membership etc. tables, views and stored procs into the main database for your production application. You can do this with the Database Publishing Wizard, which will create a script to recreate everything including all the data. No need to use two separate databases.
Alternatively, one can run this exe to copy empty tables from ASPNETDB.mdf to external SQL server. drive:\WINDOWS\Microsoft.NET\Framework\versionNumber\aspnet_regsql.exe
精彩评论