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.
<add name="PSQL_CLIN" connectionString="server=localhost; database=openiz_staging; user id=postgres; password=postgres; " providerName="Npgsql"/>
Type the following command:
C:\Program Files\PostgreSQL\9.4\bin>pg_dump -h localhost -U postgres -W --dbname=openiz_staging > c:\temp\mybackup.sql Password:
Restart the OpenIZ service by typing : net start openiz
If you need to restore a backup use the following instructions:
postgres=# alter database openiz_staging rename to openiz_original; ALTER DATABASE
postgres=# create database openiz_staging owner postgres; CREATE DATABASE postgres=# \c openiz_staging Password for user postgres: WARNING: Console code page (437) differs from Windows code page (1252) 8-bit characters might not work correctly. See psql reference page "Notes for Windows users" for details. You are now connected to database "openiz_staging" as user "postgres". openiz_staging=#
Restore the database by using the \i command
openiz_staging=# \i /temp/mybackup.sql
psql:/temp/mybackup.sql:435254: ERROR: new row for relation "act_ptcpt_tbl" violates check constraint "ck_act_ptcpt_rol_cd" DETAIL: Failing row contains (6689a586-3c42-4a2d-bbdc-bec0843856ef, 41b008a6-fcf8-40bc-ab96-7567e94bcf8f, 74baee85-6e99-43d5-95ef-bc70edd0b554, 1, null, null, 99e77288-cb09-4050-a8cf-385513f32f0a, 0). CONTEXT: COPY act_ptcpt_tbl, line 1: "6689a586-3c42-4a2d-bbdc-bec0843856ef 41b008a6-fcf8-40bc-ab96-7567e94bcf8f 74baee85-6e99-43d5-95ef-bc..." COPY 0
Start the OpenIZ host process by running net start openiz