Backup and Restore Your SQL Database

It’s easy to backup or restore your database directly with SQL.

backup database MyDatabase TO DISK=‘c:pathtoMyDatabase.bak’ with INIT

The syntax is pretty self-explanatory once you see it. Backup the database “TO DISK”, or to a file at the designated path. The “WITH INIT” specifies that any existing backup file will be overwritten.

The restore syntax is nearly identical. If the database you are restoring currently exists, be sure to drop the database before doing the restore.

restore database MyDatabase FROM DISK=‘c:pathtoMyDatabase.bak’

Simple as that.

Leave a Reply

  Theme Brought to you by Directory Journal and Elegant Directory.