backup/backup

Issue in pg_dump schema backup for foreign servers

unotech001 opened this issue · 2 comments

Hello,

We are taking schema backup by pg_dump and restoring the schema backup using psql, we have foreign servers created in our schema/database but this foreign servers are not coming in schema level backup hence after restoration the foreign servers are not restoring

We run the below queries to create foreign servers:

  1. Create Extension tds_fdw
  2. Create SERVER server_name foreign data wrapper tds_fdw options (database 'dbname',msg_handler 'notice',port 'port',servername 'server_ip');
  3. CREATE USER MAPPING FOR local_user SERVER server_name OPTIONS (username 'foreign_user', password 'password');
  4. create foreign table;

But after taking backup by below command the above scripts are not coming in schema backup file(only foreign table coming)
pg_dump -d dbname -n schema | gzip > /path/file.sql.gz

then we dropped the schema by below command:
Drop Schema schema_name cascade;

After that we restored the above schema level backup:
gunzip -c file.sql.gz | psql -d dbname

But after restoration the foreign server not comming in database and showing error like below:

ERROR: server "server_name" does not exist

Kindly provide us the solution on this. It wil be helpful for us.

Thanks.

I am facing the same issue with Postgres-11.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.