How to Backup and Restore SQL Database from Command Line

If you haven't installed SQL Management Studio and you need to backup or restore an Events2HVAC SQL database, here's the basic steps.  SMS is the recommended tool for backup and restore.

Open the Command Prompt in Windows and enter the text below.  This assumes that you are logged in as an Administrator and you are using Windows Authentication for database security.

For <servername> enter your SQL server\instance name.


SQLCMD -E -S <servername> -Q "BACKUP DATABASE [Events2HVAC] TO DISK='C:\temp\events2hvac.bak'"


SQLCMD -E -S <servername> -Q "RESTORE DATABASE [Events2HVAC] FROM DISK='C:\temp\events2hvac.bak'"

For full user guide on SQLCMD utility, see sqlcmd - Use the utility

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.