It is a good idea to regulary backup your Power Studio database. This page contains a script and instructions to automatically take a backup and write this backup to a unique file.
Create specific folder for your backup script e.g. PS_Backup, and create a new batch file databasebackup.bat. In this file paste the following script:
@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=%year%%month%%day% echo datestr is %datestr% set folder=<Destination folder> echo folder is %folder% set BACKUP_FILE=%folder%\%datestr%_PowerStudio.backup echo backup file name is %BACKUP_FILE% SET PGPASSWORD=<Password> echo on pg_dump -h <Hostname> -p 5432 -U <Username> -F c -b -v -f %BACKUP_FILE% <Databasename>
Getting the pg_dump, pg_dumpall binaries by copying them from your PostgreSQL Server install. (e.g. C:\Program Files\PostgreSQL\11\bin) There is no package available to get just these files.
Get the following files:
libeay32.dll libiconv-2.dll libintl-8.dll libintl-9.dll libpg.dll libwinpthread-1.dll msvr120.dll pg_dump.exe pg_dumpall.exe ssleay32.dll zlib1.dll
Depending on what version PostgreSQL Server you are running, libintl-8.dll or libintl-9.dll may not be available.
You should download and install the Windows C/C++ runtime libraries from Microsoft for the version Postgresql being used, version 11.0 uses VS-2013.
Create a Task for the MS Task Scheduler.
Once you have chosen the security context the Task in going to run in, it is advised to change the directory security where the backup is run and the files are stored, as a high level user name and password are stored in plain text.