Creating Archive Table and Assigning Permissions for Postgres Database
To create an archive table, assign proper permissions to archive users, and execute archiving services with postgres database configured in Integration Server, follow the examples below:
Set the default archiving parameter in the OPERATION_PARAMETER table. PostgreSQL: Process Audit Log schema name
BPM Archival for PostgreSQL database only supports multiple schemas with a single database only. CREATE DATABASE bpmarchive(db name);
\c bpmarchive;(connect to database)
CREATE SCHEMA processbpm(process schema name);
SET search_path TO processbpm;
-- to create user --
CREATE USER processbpmuser (process schema user);
ALTER USER processbpmuser WITH ENCRYPTED PASSWORD 'manage';
ALTER USER processbpmuser SET search_path = processbpm;
-- to grant permissions --
GRANT CONNECT ON DATABASE bpmarchive TO processbpmuser;
GRANT USAGE, CREATE ON SCHEMA processbpm TO processbpmuser;
GRANT ALL ON SCHEMA processbpm TO processbpmuser;
-- the below grants are needed and they are available for new objects created in the future --
ALTER DEFAULT PRIVILEGES IN SCHEMA processbpm GRANT ALL ON TABLES TO processbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA processbpm GRANT ALL ON SEQUENCES TO processbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA processbpm GRANT ALL ON FUNCTIONS TO processbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA processbpm GRANT ALL ON TYPES TO processbpmuser;
-- to create archive schema --
CREATE SCHEMA archiveprocessbpm(archive schema name);
SET search_path TO archiveprocessbpm;
-- to create user --
CREATE USER archiveprocessbpmuser(archive schema user) ;
ALTER USER archiveprocessbpmuser WITH ENCRYPTED PASSWORD 'manage';
ALTER USER archiveprocessbpmuser SET search_path = archiveprocessbpm;
-- to grant permissions --
GRANT CONNECT ON DATABASE bpmarchive TO archiveprocessbpmuser;
GRANT USAGE, CREATE ON SCHEMA archiveprocessbpm TO archiveprocessbpmuser;
GRANT USAGE, CREATE ON SCHEMA processbpm TO archiveprocessbpmuser;
GRANT ALL ON SCHEMA archiveprocessbpm TO archiveprocessbpmuser;
GRANT ALL ON SCHEMA processbpm TO archiveprocessbpmuser;
-- the below grants are needed and they are available for new objects created in the future --
ALTER DEFAULT PRIVILEGES IN SCHEMA archiveprocessbpm GRANT ALL ON TABLES TO archiveprocessbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA archiveprocessbpm GRANT ALL ON SEQUENCES TO archiveprocessbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA archiveprocessbpm GRANT ALL ON FUNCTIONS TO archiveprocessbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA archiveprocessbpm GRANT ALL ON TYPES TO archiveprocessbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA processbpm GRANT ALL ON TABLES TO archiveprocessbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA processbpm GRANT ALL ON SEQUENCES TO archiveprocessbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA processbpm GRANT ALL ON FUNCTIONS TO archiveprocessbpmuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA processbpm GRANT ALL ON TYPES TO archiveprocessbpmuser;
GRANT ALL ON ALL TABLES IN SCHEMA processbpm TO archiveprocessbpmuser;
GRANT ALL ON ALL SEQUENCES IN SCHEMA processbpm TO archiveprocessbpmuser;
GRANT ALL ON ALL FUNCTIONS IN SCHEMA processbpm TO archiveprocessbpmuser;