Schedule MS SQL Backups via GUI With SQL Express

AID: 8609
  • Status: Published

2190 points

  • Bygwickert
  • TypeTips/Tricks
  • Posted on2011-11-17 at 03:13:54
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does have a few limitations.

Most small companies would tend to use SQL Express, however setting up backups using the express manager can be a bit of a pain, as it doesn't allow you to schedule them.  Well luckily the express manager still lets you script actions to an SQL script using the GUI - so for example you can setup a once off backup operation, then script that operation to an SQL script file.

Using the following method, you can schedule the backup of a live SQL database.  Please note that these steps assume you are familiar with the SQL Express GUI and also familiar with creating a scheduled task within windows.
 
The following steps must be taken:

 1. First, you must have a database on a MS SQL Server.

 2. Open SQL Express manager and right click the database that requires backing up.  Go to all tasks, backup.

 3. This will open a backup window, where you can perform one time backups with the GUI, this GUI also has an option to ‘script’ the action that you just setup.  So basically, you setup the backup location etc, then script that to a file that can be called in the batch file.

 4. Select script action and let the script generate.  Save this script to your SQL server Eg: C:\scripts\SQL\

 5. Make a new Text file, rename to ‘sqlbackup.bat’ and add the following line:
 sqlcmd -U user -P Pass -i PathToSQLScript\script.sql

 6. Save it to the same spot as your .sql script
 
That gives you the 2 files that you need.  Then all that is left to do is open up windows scheduler on the SQL server, setup a new task that calls the batch file and set it to run as often as you need (daily, weekly etc).
 
This is a great way to do backups for small companies that dont want to buy the full version of MS SQL Server, but still want the reassurance of scheduled backups.
 
Glen
Asked On
2011-11-17 at 03:13:54ID8609
Tags

SQL

,

Server

,

Backup

,

Database

,

script

Topic

MS SQL Server

Views
1612

Comments

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top MS SQL Server Experts

  1. jogos

    246,566

    Guru

    1,668 points yesterday

    Profile
    Rank: Sage
  2. acperkins

    246,249

    Guru

    1,000 points yesterday

    Profile
    Rank: Genius
  3. lcohan

    194,990

    Guru

    2,000 points yesterday

    Profile
    Rank: Genius
  4. anujnb

    179,525

    Guru

    2,000 points yesterday

    Profile
    Rank: Wizard
  5. ScottPletcher

    154,405

    Guru

    6,500 points yesterday

    Profile
    Rank: Genius
  6. matthewspatrick

    131,392

    Master

    1,620 points yesterday

    Profile
    Rank: Savant
  7. ValentinoV

    126,429

    Master

    1,800 points yesterday

    Profile
    Rank: Genius
  8. EugeneZ

    120,790

    Master

    2,000 points yesterday

    Profile
    Rank: Genius
  9. TempDBA

    112,141

    Master

    1,168 points yesterday

    Profile
    Rank: Sage
  10. angelIII

    100,133

    Master

    0 points yesterday

    Profile
    Rank: Elite
  11. HainKurt

    93,046

    Master

    0 points yesterday

    Profile
    Rank: Genius
  12. mwvisa1

    88,585

    Master

    40 points yesterday

    Profile
    Rank: Genius
  13. dtodd

    88,114

    Master

    0 points yesterday

    Profile
    Rank: Genius
  14. huslayer

    81,392

    Master

    0 points yesterday

    Profile
    Rank: Sage
  15. ralmada

    75,583

    Master

    400 points yesterday

    Profile
    Rank: Genius
  16. BCUNNEY

    74,206

    Master

    0 points yesterday

    Profile
    Rank: Guru
  17. dqmq

    66,272

    Master

    0 points yesterday

    Profile
    Rank: Genius
  18. rajeevnandanmishra

    60,246

    Master

    2,000 points yesterday

    Profile
    Rank: Guru
  19. dbaduck

    58,208

    Master

    2,000 points yesterday

    Profile
    Rank: Sage
  20. CodeCruiser

    55,120

    Master

    0 points yesterday

    Profile
    Rank: Genius
  21. Qlemo

    53,598

    Master

    2,000 points yesterday

    Profile
    Rank: Genius
  22. ryanmccauley

    52,252

    Master

    0 points yesterday

    Profile
    Rank: Sage
  23. Cluskitt

    50,880

    Master

    800 points yesterday

    Profile
    Rank: Wizard
  24. sdstuber

    50,836

    Master

    0 points yesterday

    Profile
    Rank: Genius
  25. mark_wills

    49,374

    10 points yesterday

    Profile
    Rank: Genius

Hall Of Fame