开发者

How do I copy my database

I am working on visual studio 2010 and i have a database in Server Explorer that i can see that is not in the App_data in the solution explorer.. I need to copy it somewhere to upload it to the host..

开发者_如何转开发I think the database is suitable for SQL server2005 , cause that is the only sql server version installed on my computer with the vs2010.

Here are my connection string:

<add name="YourGuruDB" connectionString="Data Source=DIMA-00AA1DA557;Initial Catalog=model;Integrated Security=True" />


You can back up the database by right click on db and choose back up. Restore it on your host /web server.


I would prefer to export you database schema and mandatory data as sql scripts using SSMS (SQL Server Management Studio) then run the script on the host.

Here is a great tutorial about it http://blog.sqlauthority.com/2007/08/21/sql-server-2005-create-script-to-copy-database-schema-and-all-the-objects-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/

EDIT: if you are using VS2010 there is a new feature in the deployment called "Package/Publish SQL" allow you to package your SQL DB. Here is a tutorial how to use it http://rachelappel.com/deployment/database-deployment-with-the-vs-2010-package-publish-database-tool/


Erm. your connection string says the database in use is model. That's a special database in SQL Server that's used a template for new databases (that's why you can't detach/copy). You're going to have all sorts of problems if you stick with that name.

But DO NOT rename it. You're going to have to create a new database - which will have everything you've put in model in it. Then remove everything you've added to model.

You should now be able to detach your new database and move it elsewhere.


Select you database in SQL Managment Studio.Then Tasks\Detach. After this you can copy the database files to another distination. To make you database on-line again, just do Tasks\Attach.

P.S It's only the one among other approaches to accomplish your task.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜