Home > Microsoft SQL DB Database restore backup osql > SQL: Backup and restore ms sql DB

SQL: Backup and restore ms sql DB

del d:\sglc_backup\sglc_backup.bak
osql -S SQLSERVER -E -Q " BACKUP DATABASE master TO DISK = 'd:\sglc_backup\sglc_backup.bak' "


REM Restore
REM ::START DATABASE IN SINGLE USER MODE TO ALLOW RESTORE
REM C:\Program Files\Microsoft SQL Server\MSSQL\Binn\sqlservr.exe -m -sMSSQLSERVER

REM
REM osql -S SQLSERVER -E -Q " RESTORE DATABASE master FROM DISK = 'd:\sglc_backup\sglc_backup.bak' "

REM ::Will automatically stop SQL server
REM :: Restart and you should be all set
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: