在 SQL Server Express 中复制数据库? [英] copy a database within SQL Server Express?
问题描述
我想复制我拥有的数据库,但将它与测试数据库保存在同一台服务器上.但是,我发现的一切都是使用复制数据库向导(我使用的是 MS SQL Server Express).
I would like to make a copy of a database I have but keep it on the same server as a test database. However, everything I have found is to use the copy database wizard (I am using MS SQL Server Express).
说明总是说:在 SQL Server Management Studio 的对象资源管理器中,展开数据库,右键单击数据库,指向任务,然后单击复制数据库.
The instructions always say: In SQL Server Management Studio, in Object Explorer, expand Databases, right-click a database, point to Tasks, and then click Copy Database.
我没有复制数据库选项.我以管理员身份运行,所以不知道为什么我缺少它 - 我必须单独安装它吗?我无法执行分离/附加,因为它正在复制到同一台服务器.我尝试分离、复制 MDF/LDF、重命名、附加,但正如您可以想象的那样,这搞砸了 :) 我不太擅长 SQL 以编程方式完成所有工作.有没有我可以使用的工具?
I don't have the Copy Database option. I am running as an admin, so no clue why it is missing for me - is it something I have to install separately? I can't do the Detach/Attach since it is copying to the same server. I tried detaching, copying the MDF/LDF, renaming, attaching but as you can imagine that messed a ton up :) I am not great with SQL to do it all programatically. Is there a tool out there I could use?
推荐答案
在 SSMS 2008 中,您可以这样做:
In SSMS 2008 you can do this:
创建要复制的数据库的备份
Create a backup of the database you want to copy
在 SSMS 中,右键单击数据库"并选择还原数据库"
In SSMS, right-click 'Databases' and select 'Restore Database'
从还原源"部分的从数据库"下拉列表中选择要复制的数据库
Select the database you wish to copy from the 'From database' drop-down list in the 'Source for restore' section
在还原目标"部分的到数据库"字段中输入新数据库的名称 - 这不能是现有数据库的名称.
Enter the name of the new database in the 'To database' field in the 'Destination for Restore' section - this cannot be the name of an existing database.
点击确定
你完成了!:)
这篇关于在 SQL Server Express 中复制数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!