Home > Uncategorized > Backing up SQL Express Database

Backing up SQL Express Database

I use SQL Express for my McAfee ePO setup and to backup the SQL database it has to be done manually by initiating the backup yourself in SQL Express Management but this can get tedious doing it everyday.  This cannot be automated because SQL Express does not come with SQL Server Agent like the full package of SQL Server.
But to get around this we can use the command SQLCMD and execute it in a bat file using Scheduled Tasks.
To backup my database I used the following command:

sqlcmd -E -S SERVER\SQLINSTANCE -Q “BACKUP DATABASE ePO4_SQLDATABASE TO DISK = ‘D:\EPO_SQL_BACKUP\ePO4_SQLBackup.bak‘ WITH INIT,SKIP”

The bits in bold is the information you need to change to reflect your server.  To decipher what I have written you have got servername\sqlinstance, SQLDatabase and location of backup. Put your command line in a batch file and setup a Scheduled Task and you now have full backup of your SQL server.
My batch file:
@echo off

sqlcmd -E -S SERVER\SQLSERVER -Q “BACKUP DATABASE ePO4_SQLDATABASE TO DISK = ‘D:\EPO_SQL_BACKUP\ePO4_SQLBackup.bak’ WITH INIT,SKIP”

exit

Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment