Backing up HDSI server database
Purpose: You wish to perform a complete backup of the OpenIZ primary data store, or a data store which OpenIZ uses.
Introduction: Backing up your database server is a routine procedure and should be performed on an automated schedule. This article will guide system administrators through the backup and restore process.
Applies To:
OpenIZ Immunization Management Server (running PostgreSQL database)
Steps:
Open the C:\Program Files (x86)\Mohawk College\OpenIZ\openiz.exe.config file in a text edit
Navigate to the <connectionStrings> section and note the server, username and password for your primary OpenIZ connection string. For example, the connection below is pointing to localhost with username postgres and password postgres.
Open a command prompt and navigate to C:\Program Files\PostgreSQL\9.4\bin (note: if you are using the bundled installation of OpenIZ your directory may be C:\Program Files (x86)\Mohawk College\OpenIZ\PostgreSQL\bin)
Stop the OpenIZ service by typing : net stop openiz
Type the following command:
Enter your password when prompted
Restart the OpenIZ service by typing : net start openiz
If you need to restore a backup use the following instructions:
Open a command prompt and navigate to C:\Program Files\PostgreSQL\9.4\bin (note: if you are using the bundled installation of OpenIZ your directory may be C:\Program Files (x86)\Mohawk College\OpenIZ\PostgreSQL\bin)
Stop the openiz service by executing : net stop openiz
Run the command psql -U postgres -W -h localhost
Optional: In the SQL command prompt rename the current copy of your database to another name (this will preserve the database in the server)
Create a new database to which to restore the backup: (note: lines prefixed with postgres=# are the inputs)
Restore the database by using the \i command
You may encounter errors on the first run, this is due to pg_dump not adhering to foreign key constraints. If you receive an error such as that listed below, simply re-run the above command a second time:
Start the OpenIZ host process by running net start openiz
Last updated