PostgreSQL Backing up the data

Precis

Backing up of an SQL database isn’t complicated, but it is different to what you would be used to in backing up data from Minder.

Normally you would simply do a file-level backup of either the entire ‘mbs’ directory, or just the ‘*.TPS’ files to a different (preferably off-site) location. This doesn’t change, but what we want is for the SQL data to be included in that file listing.

This can be accomplished using a simple ‘bat’ file which is called regularly from the Windows system.


Sample Batch file

Locate this in the same directory which contains the TPS files.

sql_backup_mbs.bat

 

rem Backup the SQL dataset set BACKUP_FILE=Minder_SQL.backup echo backup file name is %BACKUP_FILE% SET PGPASSWORD=******** "C:\Program Files\PostgreSQL\12\bin\pg_dump.exe" -h localhost -p 5433 -U minder -F c -b -v -f %BACKUP_FILE% dbname

You should be able to runs this directly. Modify the program locations / database / passwords to suit.

When you can, move onto the next step.


Call from Windows

You need to have admin rights to the Windows server to set this up.

  • Control Panel

    • Administrative Tools

      • Task Scheduler

Create Basic Task

Name:- Minder_SQL_Backup

Next

For the Trigger - Select Daily

 

Ensure it runs well before you other, file-level' backups start.

 

Action - Start a Program

Call the batch file & start it in the mbs\company directory (ensures that the file is saved in that location)

Finish


Testing

Ensure that the batch file runs, and that your output file is located in the correct directory, it needs to be backed up together with the TPS files.

 


Related

Copyright Programmed Network Management PL 2023