What is a simple command line program or script to backup SQL server databases?

后端 未结 11 899
北海茫月
北海茫月 2020-11-28 19:35

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

Is there a simple command line program that I can use to backup certain databases in SQL Serv

11条回答
  •  自闭症患者
    2020-11-28 19:58

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

    "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\osql.exe" 
        -E -Q "BACKUP DATABASE mydatabase TO DISK='C:\tmp\db.bak' WITH FORMAT"
    

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

提交回复
热议问题