Automated Database Backup

With the help of the Windows Task Scheduler, you can easily setup an automated backup schedule for your Acronis Access database.

Creating the database backup script

  1. Open Notepad (or another text editor) and enter the following:

@echo off

for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (

set dow=%%i

set month=%%j

set day=%%k

set year=%%l

)

set datestr=%month%_%day%_%year%

echo datestr is %datestr%

set BACKUP_FILE=AAS_%datestr%_DB_Backup.sql

echo backup file name is %BACKUP_FILE%

SET PGPASSWORD=password

echo on

bin\pg_dumpall -U postgres --inserts -f %BACKUP_FILE%

move "%BACKUP_FILE%" "C:\destination folder"

  1. Replace "password" with the password for user postgres you have entered when you installed Acronis Access.
  2. Replace C:\destination folder with the path to the folder where you want to save your backups.
  3. Save the file as DatabaseBackup.bat (the extension is important!) and select All Files for the file type.
  4. Move the file to the PostgreSQL installation folder in the version number directory (e.g. \9.3\).

Creating the scheduled task

  1. Open the Control Panel and open Administrative Tools.
  2. Open the Task Scheduler.
  3. Click on Action and select Create Task.

On the General tab:

  1. Enter a name and description for the task (e.g. AAS Database Backup).
  2. Select Run whether user is logged in or not.

On the Triggers tab:

  1. Click New.
  2. Select On a schedule for Begin the task.
  3. Select daily and select the time when the script will be run and how often the script should be rerun (how often you want to backup your database).
  4. Select Enabled from the Advanced settings and press OK.

On the Actions tab:

  1. Click New.
  2. Select Start a program for Action.
  3. For Program/Script press Browse, navigate to and select the DatabaseBackup.bat file.
  4. For Start in (optional), enter the path to the folder in which the script resides. e.g. If the path to the script is C:\Program Files (x86)\Acronis\Access\Common\PostgreSQL\9.3\PSQL.bat enter C:\Program Files (x86)\Acronis\Access\Common\PostgreSQL\9.3\
  5. Press OK.

Configure any additional settings on the other tabs and press OK.

You will be prompted for the credentials for the current account.