简体   繁体   中英

Create BAK from MDF without SQL Server Management Studio (SSMS)

I have a restricted environment without SQL Server Management Studio, only Visual Studio 2012, and a restricted internet connection.

I have a 50mb MDF file. I need to create a BAK file that I can use to restore a database on my hosting provider (it's the only option they have to create a database).

Is there a way I can create a BAK file from the MDF? Either by scripting through Visual Studio, or a small tool I can download to do this.

Use the BACKUP DATABASE t-sql command. Check the link below and scroll about halfway down the page, past the "Using Management Studio" section, for more detail on how to use the command:

https://msdn.microsoft.com/en-us/library/ms187510.aspx

Here's the sample from that page, in case the link ever goes dark:

USE AdventureWorks2012;
GO
BACKUP DATABASE AdventureWorks2012
TO DISK = 'Z:\SQLServerBackups\AdventureWorks2012.Bak'
   WITH FORMAT,
      MEDIANAME = 'Z_SQLServerBackups',
      NAME = 'Full Backup of AdventureWorks2012';
GO

Osql或Sqlcmd可用于运行Sql备份数据库命令

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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