SQL Server 2005: how to copy database from one server to another (manually/programmatically)

会有一股神秘感。 提交于 2019-12-02 10:14:33

问题


I am developing an ASP.NET-app which uses an SQL2005-DB - and from time to time I need to copy the db from the dev-environment to test or production - or vice-versa. With SQL2000, I had written some batches to do that, but haven't had the time yet to find out how to do that under 2005, and did it manually. In SQL Mgmnt Studio, I would detach both dbs, then copy the MDF+LDF-Files from one server to the other and then re-attach the files. This has worked once or twice, but suddenly when I attach the db that was copied, it is in ReadOnly-Mode - which doesn't really help.

Why is that happening, am I doing something wrong - and how can I avoid that? And if someone has .BAT to do that, even better! ;)


回答1:


Use the Copy Database Wizard to do this manually.

Start it by right clicking a database in Management Studio and selecting Tasks > Copy Database... from the popup menu.



来源:https://stackoverflow.com/questions/2389179/sql-server-2005-how-to-copy-database-from-one-server-to-another-manually-progr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!