Skip to main content

Schedule an automatic backup

A scheduled task in alameen ERP 10 takes a full backup of the company file at a time you set, even when the program is not open on any computer. The SQL Server Agent service on the server runs it, writes the file into a folder on the server itself, and deletes the older copies so that only the number you set remains.

Before you begin​

  • The SQL Server Agent service must be running on the server, or no task runs. If it is not running, the Current Tasks window shows "To execute tasks, you need to run SQL Server Agent". SQL Server Express does not include the service (Configure backup options).
  • Set the backup folder on the server in Program Options > Backup, then check that it exists on the server computer and that SQL Server can write to it (Configure backup options).
  • In Users Management > Operations you need the permission Scheduled tasks - Add new task to add the task, and scheduled tasks - Backups so that the type Backup shows in the list of types.
  • Decide how many copies you want to keep on disk. A daily task takes one copy a day, so with 7 the copies of the last seven days remain.

Steps​

  1. Click File > Tools > Schedule. Or click Scheduled Tasks... on the Backup page of Program Options. The Current Tasks window opens (the window explained).

  2. Click New. The Scheduled Task window opens.

  3. In Task Name type a name that says what the task does, such as Daily backup. The program does not accept the same name for two tasks.

  4. Click Schedule... and choose the Schedule Type: Daily, Weekly or Monthly. Then set Timing and the day, From date and To Date, and click Ok. The description of the schedule replaces "Not scheduled" in the window (the schedule window). Set the schedule before you add the step.

    note

    The schedule type decides the first letters of the name of the backup file. It also decides which copies are deleted when they exceed the number: the daily copies are counted on their own, the weekly on their own, and the monthly on their own.

  5. Click New in the Scheduled Maintenances group. A wizard opens with the list of types (Scheduled task steps).

  6. Select Backup and click Next. The Backup page appears (the page and its field).

  7. In Temporary Copies Count type the number of copies to keep, such as 7. If you leave 0 or leave it empty, the task deletes no copy and the disks fill with time.

  8. Click Finish. The step appears with the name Backup in the Scheduled Maintenances list, with a box under Stop the process when it fails. If you add more steps after it, they run in the order you see, and the box is disabled in the last step.

  9. Click Ok in the Scheduled Task window to save the task. Only then does the program create the task in SQL Server. It appears in the Current Tasks list with its name, its schedule and the state of its last run.

  10. To try it without waiting for the time, select the task, right-click and choose Run (the task menu). This command needs the permission Scheduled tasks - Execute task directly. In process shows in the state column, then Succeeded or Failed.

Result​

  • At every run SQL Server takes a full backup of the database of the file and writes it into the backup folder on the server. The task picks the folder when it runs in this order: the folder saved from the program on the server computer itself, then the folder saved for the whole file, then the folder the step recorded when you saved it.
  • The file name is letters, then the database name, then the date and time, ending in .dat. The letters ADJB_ are for a daily task, AWJB_ for a weekly one and AMJB_ for a monthly one. Example: ADJB_AmnDocs_Main_20261130-020000.dat. If the schedule repeats every few hours, a new file is written in each repetition, and it counts in the number.
  • After each copy, if Temporary Copies Count is greater than zero, SQL Server deletes from disk whatever exceeds the newest copies up to that number among those with the same database name and the same schedule type. A copy that you marked Permanent Copy in the restore window is not deleted, and neither are the copies of the manual wizard and the copies on exit, because their names are not of this pattern.
  • The files show in the restore list (Restore a company file from a backup).
  • You find the state of every run in the Execution Log.

If something goes wrong​

MessageWhy it appearsWhat to do
To execute tasks, you need to run SQL Server AgentThe service is stopped on the server.Start it from the Windows services on the server computer.
The task without name, Please name the taskYou clicked Ok and typed no name.Type a name in Task Name.
The task with no schedule, Please schedule task by pressing on "Schedule" commandYou did not click Schedule... and save.Set the schedule.
The task with no maintenance, Please add one maintenance at leastThere is no step in the list.Add the backup step.
Name exists! Please enter different nameA task with the same name exists in the file.Change the name.
Start date is more than End dateFrom date is after To Date.Correct the two dates.
Failed shows in the task state and there are no new files in the folderSQL Server refused to write, for example because the folder does not exist on the server or SQL Server has no right to write in it.Check the folder and the account of the SQL Server service, then run the task with Run.
The old copies are not deletedTemporary Copies Count is 0 or empty.Open the step with Modify, type a number and save the task.

This page applies to alameen ERP 10, version 10.1.79.764.