Buy Now

Backup4all Professional
$62.44 $49.95

Backup4all Standard
$53.27 $39.95

Backup4all Lite
$24.94 $19.95

Backup4all Portable
$53.27 $39.95

Awards & Reviews

  • 1_ico
  • 2_ico
  • 3_ico
  • 4_ico

Lockergnome feature

Backup4all is a bargain

"Backup4all lives up to its marketing claims. It’s versatile, has all the features you need, and is easy to use. The beginner can easily get a good backup the first time. And the professional can tweak the program until his backup hums along exactly as he wants it to. It runs on every Windows OS from 95 to XP, too. From $25 - $45, depending on the version you buy, Backup4all is a bargain."

ProNetworks review

A wealth of features

"We were quite pleasantly surprised to find that Backup4all installed and worked well on the latest Vista release. While this is still a Beta Operating system, it is nice to see that this program seems to be Vista compatible and that it will even use the Vista Aero theme without difficulties."

Sofpedia pick

Rated excellent by Softpedia

"To be honest, I always say "I'll burn that backup folder someday this week" and the week passes without having my files backed up. With a program like Backup4all this issue can disappear, and the stress related to “what if my hard drive crashes” problem will disappear. I think that I'll leave the backup tasks for this program from now on. What about you?"

The Office Letter review

Backup4all is flexible

"You can’t be too careful about your data, and Backup4All does a good job using a well-designed interface, with plenty of bells and whistles for more experienced users. A "standard" version may be all you need if you don’t want e-mail notification or AES 128, 192, and 256-bit encryption."

Latest News

January 20, 2010

Backup4all 4.4 was released.

Changes in version 4.4:
  • New option added to open backups from specific locations (Local, Network, FTP/SFTP)
  • Backup jobs can now be moved in the backup list(drag-and-drop)
  • Test runs after the merge operation too
  • Auto-complete path for network locations
  • User interface now available in Swedish

You can download version 4.4 here: Download Backup4all 4.4

Stay Updated

To join, simply enter your email address below and click on Subscribe.

About Us

Softland, the company that develops Backup4all, achieved the Microsoft Certified Partner status with an ISV/Software Solutions Competency.

Microsoft Certified Partner
Share
Add comment
Votes: 4
Comments: 0

Summary
This article explains how to backup MS SQL Server data with Backup4all using a scheduled task.

On this page:

How to create a batch file that stops the MS SQL Server
How to create a batch file that restarts the MS SQL Server
How to configure a backup for the MS SQL Server data using Backup4all

Details
The database files are locked by the MS SQL Server. In order to backup these files and avoid data corruption, it is necessary to perform these actions:

  1. Stop the MS SQL Server.
  2. Perform the backup.
  3. Restart the MS SQL Server.

To automate the process described above, a backup needs to be configured in Backup4all that will automatically stop the MS SQL Server, perform the backup and restart the MS SQL Server. The MS SQL Server will be stopped/restarted using some commands from a batch file loaded by Backup4all before/after the backup.


How to create a batch file that stops the MS SQL Server

MS SQL Server can be stopped using the sc.exe command line program. It is recommended to stop the MS SQL Server during off-hours or in week-ends. Here is the syntax for calling sc.exe:

Syntax
sc [ServerName] stop [ServiceName] [ServiceArguments]

Parameters
ServerName: Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format ("\\myserver"). To run SC.exe locally, ignore this parameter.
ServiceName: Specifies the service name to be stopped.

To automate the startup sequence of MS SQL Server a batch file that calls sc.exe needs to be created and added as a “before action” in the backup job scheduled in Backup4all. Below is an example of commands that can be used to stop  the MSSQLServer and SQLServerAgent services on a local computer (code also contains a sequence that sets a delay between each commands, to ensure the services were stopped):

sc stop sqlserveragent
@ECHO OFF
SET NUM=1
:LOOP
IF %NUM% == 6000 GOTO END1
SET /A NUM=NUM+1
GOTO LOOP
:END1
@ECHO ON

sc stop mssqlserver
@ECHO OFF
SET NUM=1
:LOOP2
IF %NUM% == 6000 GOTO END2
SET /A NUM=NUM+1
GOTO LOOP2
:END2
@ECHO ON

These commands will be saved in a batch file (stop_sql.bat) that will be executed by Backup4all before starting the backup.
To create the batch file:

  1. Go to Start->Run type notepad and press Ok. In the window that opens select File->Save as and name the file stop_sql.bat
  2. Add the commands needed to stop the MS SQL service following the example above (if is a local computer simply copy/paste the code above).

When the scheduled backup will start, the commands from the batch file will be executed, stopping the MS SQL Server. Only after that, the backup process will start. When the backup process has finished, the MS SQL Server must be restarted. You can set a second batch file to be automatically executed after the backup in order to restart the MS SQL Server.

How to create a batch file that restarts the MS SQL Server

MS SQL Server can be restarted using the sc.exe command line program.
Here is the syntax for calling sc.exe:

Syntax
sc [ServerName] start [ServiceName]

Parameters
ServerName: Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format ("\\myserver"). To run sc.exe locally, ignore this parameter.
ServiceName: Specifies the service name to be started.
ServiceArguments: Specifies service arguments to pass to the service to be stopped. Note that this option is not used when the command “stop” is issued.

To automate the restart sequence of MS SQL Server, a batch file that calls sc.exe needs to be created and added as an “after action” in the scheduled backup job in Backup4all. Below is an example of commands that can be used to restart the MSSQLServer and SQLServerAgent on a local computer:

sc.exe start mssqlserver
@ECHO OFF
SET NUM=1
:LOOP
IF %NUM% == 6000 GOTO END
SET /A NUM=NUM+1
GOTO LOOP
:END
@ECHO ON

sc.exe start sqlserveragent

These commands will be saved in a batch file (start_sql.bat) that will be executed by Backup4all after the backup process.
To create the batch file:

  1. Go to Start->Run type notepad and press Ok. In the window that opens select File->Save as and name the file start_sql.bat
  2. Add the commands needed to start the MS SQL service following the example above (if is a local computer simply copy/paste the code above).

If the backup is finished without errors, the MS SQL Server will be restarted.


Configure the backup in Backup4all

We recommend creating two backup jobs (in the same group). First job does the actual backup of the MS SQL Server data while the second job is a caution measure that ensures the MS SQL Server will be restarted (in case the first job fails and the batch file that restarts the server is not executed).

Note: If you don't have a Windows login password, before configuring the backup you must set (check) the "Allow blank passwords when scheduling" option from Backup4all's Tools->Options->Preferences window.

Steps needed to configure the backup:

  1. Create a new backup group from File->New Group. Name the group: Backup_SQL
  2. Create the first backup job (i.e. Backup_SQL1) in Backup_SQL group:
    • Open Backup4all and select File->New Backup (Ctrl+N).
    • On the first page enter a name for the backup (Backup_SQL1) in the Name field.
    • In the Where do you want to save the backup? section, you can select the backup destination. Click Next.
    • On the What do you want to backup page, add the MS SQL Server data to be backed up. You will have to select  both the .mdf and .ldf files from the Data folder. Click Next.
    • On the third page, you can choose the backup type and the encryption. Mirror is recommended. Click Next.
    • Press Advanced mode button.
    • Optionally on the Filter page you can add some include/exclude filters. Click Next.
    • On the Advanced page
      • In the Run action before backup section set (check) the Run program or action option and add the batch file that stops the MS SQL Server (stop_sql.bat).
      • In the Run action after backup section set (check) the Run program or action option and add the batch file that restarts the MS SQL Server (start_sql.bat).
    • Click Save.
  3. In the same backup group create the second backup job (i.e. Backup_SQL2) that will ensure the MS SQL Server is restarted even if the first backup job fails
    • Select File->New Backup (Ctrl+N).
    • On the first page enter a name for the backup (Backup_SQL2) in the Name field
    • In the Where do you want to save the backup? section, you can select the backup destination. Click Next.
    • On the What do you want to backup page, add a less important file to be backed up each time. Click Next.
    • On the Type page, select the Full backup type (or differential backup of sql server). Click Next.
    • On the Advanced page
      • On the Run action before backup section set (check) the Run program or action option and add the batch file that restarts the MS SQL Server start_sql.bat.
    • Click Finish.
  4. Add a scheduled task for this newly created group.
    • Press the Scheduler (F11) button from Backup4all's toolbar.
    • Press Add and in the Run section set (check) the Backup group option. Select Backup group and choose the new group name defined in step 1 (Start_stop_SQL).
      • Click on Set password and enter your windows login password (if you don't have one, skip this step).
      • After pressing OK the Task Scheduler window will open and you can set the time and frequency for the scheduled task (recommended is to set a time and date when the server is less utilized).
    • Click OK.
    • Click Close.

Note: The jobs will run sequentially in the same order as they appear in the backup list (from the left side of  Backup4all's window). It is important to name the jobs in such a manner that they are in the correct order (first backup job in the list is the one that actually backs up the MS SQL data, second job is the one that ensures the server gets restarted.

What happens when the scheduled task runs:

  • The commands from the batch file that stops the MS SQL Server will be executed.
  • The MS SQL Server data added as source in the first backup job will be backed up.
  • The commands from the batch file that starts the SQL Server will be executed.
  • The commands from the batch file that starts the SQL Server will be executed (again) ensuring that the MS SQL Server is restarted (if the server was restarted by the previous backup job nothing will happen).
  • The second backup job will be executed.

Applies to:

  • Backup4all 4
  • MS SQL Server 2000-2005
Add comment
Name:
Email:
* Comment:
(Use BBcode - No HTML)
code
* Confirmation code:
Write the characters in the image above exactly as you see it


Others in this Category
document How to schedule a backup group?
document Backup to Iomega REV drives
document Backup the Favorites folder
document How to back up data without using zip compression
document Backup images with Backup4all
» More articles
RSS

Legal Notices Terms of Use

Copyright Softland 2010. All rights reserved.