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

风格不统一 提交于 2019-12-20 09:54:10

问题


I have a website I've created in Visual Studio 2008 and I need to take it live. 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?


回答1:


From a SQL prompt:

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



回答2:


Go to Microsoft Server Management Studio and right click on your database name. 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.

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




回答3:


In ssms right click on the database, go to tasks, click back up. should be self explanatory from there.




回答4:


You don't need a backup to do so (I assume you are using the AttachDbFilename model that Visual Studio uses by default). Just send them the mdf and tell them to attach it to their SQL server instance.




回答5:


I assume you use SQL Server. This links will guide you:

How to: Back Up a Database (SQL Server Management Studio):

  • SQL Server 2008

  • SQL Server 2005



来源:https://stackoverflow.com/questions/883675/how-do-i-back-up-a-database-to-a-bak-file

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