From: | Azimuddin Mohammed <azimeiu(at)gmail(dot)com> |
---|---|
To: | pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Postgres back up error |
Date: | 2018-04-26 18:34:03 |
Message-ID: | CAKUuFd6kmDzBimabtHgSU0GCDZWj1oM5XHB2E_DAWsSyrdNkjA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hello All,
I am trying to implement postgres database backup and restore on existing
database. I am using the pg_dump utility to back up the database pg_dump -U
postgres testdb -f testdb.sql
My backup is successfully generated with the latest data in it BUT when I
restore this file using the command “psql -U postgres db.sql testdb -f in
another standby server I am getting this below error. I understand that its
stopping me because the database already exist with table column as
primary key column. How can I over write this I need to restore my database
nightly on my standby server.
SET
SET
SET
SET
SET
SET
SET
SET
CREATE EXTENSION
COMMENT
SET
SET
SET
Psql testdb_pg_backup.sql:47: ERROR: relation "company" already exists
ALTER TABLE
Psql testdb_pg_backup.sql:60: ERROR: relation "department" already exists
ALTER TABLE
psql: testdb_pg_backup.sql:72: ERROR: duplicate key value violates unique
constraint "company_pkey"
DETAIL: Key (id)=(1) already exists.
CONTEXT: COPY company, line 1
COPY 0
psql: testdb_pg_backup.sql:88: ERROR: multiple primary keys for table
"company" are not allowed
psql: testdb_pg_backup.sql:96: ERROR: multiple primary keys for table
"department" are not allowed
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2018-04-26 18:44:59 | Re: Postgres back up error |
Previous Message | Sushil Shirodkar | 2018-04-26 15:47:25 | Re: vacuumdb causes memory drain. |