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.
The syntax to use this command:
Sqlcmd
[-U login id] [-P password] [-S server] [-H hostname]
[-E trusted connection] [-d use database name] [-l login timeout]
[-t query timeout] [-h headers] [-s colseparator] [-w screen width]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-c cmdend] [-L[c] list servers[clean output]] [-q "cmdline query"]
[-Q "cmdline query" and exit] [-m errorlevel] [-V severitylevel]
[-W remove trailing spaces] [-u unicode output]
[-r[0|1] msgs to stderr] [-i inputfile] [-o outputfile]
[-f | i:[,o:]]
[-k[1|2] remove[replace] control characters]
[-y variable length type display width]
[-Y fixed length type display width]
[-p[1] print statistics[colon format]]
[-R use client regional setting] [-b On error batch abort]
[-v var = "value"...]
[-X[1] disable commands[and exit with warning]]
[-? show syntax summary]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