简体   繁体   English

如何将数据库备份到.bak文件?

[英]How do I back up a database to a .bak file?

I have a website I've created in Visual Studio 2008 and I need to take it live. 我有一个我在Visual Studio 2008中创建的网站,我需要将它带到现场。 How can I backup the database file to a .bak so I can hand it over to the hosting company to place on the server? 如何将数据库文件备份到.bak,以便我可以将其交给托管公司放在服务器上?

从SQL提示符:

BACKUP DATABASE MyDatabase TO DISK='E:\MyDatabase.bak'

Go to Microsoft Server Management Studio and right click on your database name. 转到Microsoft Server Management Studio并右键单击您的数据库名称。 Go to "Tasks" -> "Back Up..." 转到“任务” - >“备份...”

Then assign your properties, ensure that "Backup Type" is full. 然后分配您的属性,确保“备份类型”已满。

Then at the right there is a button "Add" press that and set your filename, ensure that you place the extension .bak at the end of the file name. 然后在右边有一个按钮“添加”按下并设置你的文件名,确保你将扩展名.bak放在文件名的末尾。

Finally hit ok and wait for the backup to complete. 最后点击确定并等待备份完成。

MSDN also has an article that explains this http://msdn.microsoft.com/en-us/library/ms187510.aspx MSDN也有一篇文章解释了这个http://msdn.microsoft.com/en-us/library/ms187510.aspx

In ssms right click on the database, go to tasks, click back up. 在ssms中右键单击数据库,转到任务,单击备份。 should be self explanatory from there. 应该从那里自我解释。

You don't need a backup to do so (I assume you are using the AttachDbFilename model that Visual Studio uses by default). 您不需要备份(我假设您使用的是Visual Studio默认使用的AttachDbFilename模型)。 Just send them the mdf and tell them to attach it to their SQL server instance. 只需向他们发送mdf并告诉他们将其附加到他们的SQL服务器实例。

I assume you use SQL Server. 我假设你使用SQL Server。 This links will guide you: 此链接将指导您:

How to: Back Up a Database (SQL Server Management Studio): 如何:备份数据库(SQL Server Management Studio):

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM