I have two host servers s1 and s2. In both the servers I have a schema named n1
. Now I have made some changes to some of the tables present in schema n1
of s1. I want the same change to be done to schema n1
of server s2. what I am planning to do is to take a backup of the schema n1 of server s1 using pg_dump
and restore in the server s2 using pg_restore
.
For backup and restore used these commands:
pg_dump -Fc -h XXXXX -U user -d dbname > test.dump
pg_restore -h XXXXX -U user -d dbname < test.dump
But when I restore using pg_restore
, I get this error:
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 200; 1259 16435 TABLE table_name database_name
pg_restore: error: could not execute query: ERROR: relation "address" already exists
Command was: CREATE TABLE public.table_name (
id integer NOT NULL,
status character varying(1) NOT NULL,
table_name1 character varying(80) NOT NULL,
table_name2 character varying(80),
table_name3 character varying(80),
location_id integer NOT NULL
);