什么是简单的命令行程序或脚本来备份 SQL 服务器数据库?

2021-12-27 00:00:00 command-line backup scripting sql-server

我对在我们的内部服务器上执行数据库备份太松懈了.

I've been too lax with performing DB backups on our internal servers.

是否有一个简单的命令行程序可以用来备份 SQL Server 2005 中的某些数据库?或者有没有简单的VBScript?

Is there a simple command line program that I can use to backup certain databases in SQL Server 2005? Or is there a simple VBScript?

推荐答案

要从命令行备份单个数据库,请使用 osql 或 sqlcmd.

To backup a single database from the command line, use osql or sqlcmd.

"C:Program FilesMicrosoft SQL Server90ToolsBinnosql.exe" 
    -E -Q "BACKUP DATABASE mydatabase TO DISK='C:	mpdb.bak' WITH FORMAT"

您还需要阅读有关备份的文档和RESTORE 和 一般程序.

You'll also want to read the documentation on BACKUP and RESTORE and general procedures.

相关文章