SQL Server 2005:如何将数据库从一个服务器复制到另一个(手动/编程) [英] SQL Server 2005: how to copy database from one server to another (manually/programmatically)

查看:255
本文介绍了SQL Server 2005:如何将数据库从一个服务器复制到另一个(手动/编程)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用SQL2005-DB的ASP.NET应用程序 - 并且我需要不断地将db从dev-environment复制到测试或生产环境,反之亦然。
使用SQL2000,我编写了一些批处理来做到这一点,但是没有时间去了解如何在2005年之前做,并且手动。在SQL Mgmnt Studio中,我将分离这两个dbs,然后将MDF + LDF文件从一个服务器复制到另一个服务器,然后重新附加文件。这已经工作了一两次,但突然当我附加被复制的数据库,它是在ReadOnly模式 - 这不是真的帮助。

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.

为什么是发生,我做错了 - 我怎么能避免呢?
如果有人有.BAT这样做,更好! ;)

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! ;)

推荐答案

使用复制数据库向导手动执行此操作。

并从弹出菜单中选择任务>复制数据库...。

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

这篇关于SQL Server 2005:如何将数据库从一个服务器复制到另一个(手动/编程)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆