Cogitek

Database Backup and Restore

 

Database Backup

It is highly recommended that there is an automatic backup procedure in place. The RIACase installer program sets up a scheduled task that performs daily maintenance, including automatic backups of the database. The default location of backup is "C:\ProgramData\RIACase\backup" folder. The location can be changed from RIACase by the system administrator using the "Settings" view.

Each execution of the backup creates a zip file with name YYYY-MM-DD-Hour-Min-Sec.zip. The name reflects the date and time the backup was performed. Older backups are not automatically deleted. System administrator can manually delete old backups if they are not needed.

It is the responsibility of the system administrator to periodically verify that automatic backups are taking place and are healthy. The best way to ensure the health of the backups is to perform a restore procedure on clean installation of RIACase on a separate system.

Database Restore

To restore the RIACase database the following steps must be performed:

  • Install a clean RIACase system as described in the Installation documentation.
  • Extract the backup zip file to a temporary folder.
  • Restore PostgreSQL database.
    • Open postgresql.conf file and find the port number that PostgreSQL is configured to listen to. It is specified in line containing "port = NNNN" text. The default port is 5432.
      postgresql.conf can be found in "C:\ProgramData\RIACase\DB" if you installed RIACase using the automatic installer program. You will specify the port number using option –p in the following commands.
      You will also need to know the PostgreSQL user name and specify it using option –U to the following commands. The user name created by automatic RIACase installer is riacase_pgsql.
      Note: if you installed RIACase manually and used separate PostgreSQL installer program then for the following commands:
      • the username to use with –U option is postgres instead of riacase_pgsql that is specified below;
      • the commands may prompt you to enter the password that you selected during PostgreSQL installation.
    • Open the Windows Command Prompt in the PostgreSQL bin folder (by default "C:\Program Files (x86)\RIACase\pgsql\bin"). Drop the existing RIACASE database:
      dropdb.exe -p 5432 -U riacase_pgsql RIACASE
      WARNING! The above command will delete entire existing RIACASE database. Make sure you do not run this on a working RIACase system.
    • Create an empty RIACASE database:
      createdb.exe -p 5432 -U riacase_pgsql RIACASE
    • Restore the RIACASE database content (entire command should be on one line):
      pg_restore.exe -d RIACASE -p 5432 -U riacase_pgsql "C:\TempFolderWithExtractedBackupZip\2012-09-29T080647+0000.pg_backup"
      Make sure you specify the correct path to the .pg_backup file in the above command. The file with .pg_backup extension should be in the folder where you extracted the backup zip file.
  • Access RIACase system as an administrator to perform a database version upgrade (optional for if the backup was done on an older version of RIACase and restored on a newer version). See RIACase Software Upgrade section in this guide.
  • Ensure that the RIACase system is accessible by logging in and performing all the necessary steps to make sure the restored data is consistent.
You are here RIACase Documentation Backup and Restore