Automating backups of SQL Express databases

Open SQL Server Management Studio Express

Select Database to backup

Right Click and select Tasks

Select Back Up

In Backup Screen,

Select Full
Input the Destination Location with filename ending in .bak
Select Options in left pane
Select Overwrite all existing backup sets

Select the “Script” option at top of screen
Copy the SQL Script to sql file. (Ex. backup.sql)
Create a Batch file to call the SQL script

Sqlcmd –S LOCALHOST\SQLEXPRESS –i backup.sql –o \output.txt

Note:
This assumes trusted login relationships. If specific user, may have to use OSQL –U –P options
Use OSQL /? to see parameters.

Tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *