I created a user pguser and gave it all the privileges on database RIC.
CREATE USER pguser WITH PASSWORD
'xyz123!'
;
GRANT ALL PRIVILEGES ON DATABASE
"RIC"
to pguser;
The database RIC was created by user postgres earlier.
Now, when I run the pg_restore I get an error:
xzcat "postgres-071215200001-database" | PGPASSWORD=xyz123! /opt/PostgreSQL/9.4/bin/pg_restore -h onxv0097 -U pguser -d RIC -c -p 5432 -vpg_restore: connecting to database for restorepg_restore: dropping CONSTRAINT recorder_pkeypg_restore: dropping TABLE DATA recorderpg_restore: dropping TABLE recorderpg_restore: creating TABLE recorderpg_restore: [archiver (db)] Error while PROCESSING TOC:pg_restore: [archiver (db)] Error from TOC entry 173; 1259 58915 TABLE recorder postgrespg_restore: [archiver (db)] could not execute query: ERROR: must be member of role "postgres" Command was: ALTER TABLE recorder OWNER TO postgres;