pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Daulat Ram <Daulat.Ram@exponential.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Backup and Restore (pg_dump & pg_restore)
Date: Sun, 21 Apr 2019 11:46:09 -0700
Message-ID: <d5e85379-8055-5604-d236-60fced2a7ee4@aklaver.com> (raw)
In-Reply-To: <BL0PR01MB51872B41EDB099721B5606E59B210@BL0PR01MB5187.prod.exchangelabs.com>
References: <BL0PR01MB518710A35F4FF2A127563A2A9B200@BL0PR01MB5187.prod.exchangelabs.com>
	<BL0PR01MB51872B41EDB099721B5606E59B210@BL0PR01MB5187.prod.exchangelabs.com>

On 4/21/19 9:35 AM, Daulat Ram wrote:
> Hello Team,
> 
> We are getting below error while migrating pg_dump from Postgresql 9.6 
> to Postgresql 11.2 via pg_restore in docker environment.
> 
> 90d4c9f363c8:~$ pg_restore -d kbcn "/var/lib/kbcn_backup19"
> 
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> 
> pg_restore: [archiver (db)] Error from TOC entry 3; 2615 2200 SCHEMA 
> public postgres
> 
> pg_restore: [archiver (db)] could not execute query: ERROR: schema 
> "public" already exists
> 
> Command was: CREATE SCHEMA public;

Expected as the public schema is there by default. It is an 
informational error, you can ignore it.

If you want to not see it and want a clean install on the 11.2 side use:

-c
--clean

     Output commands to clean (drop) database objects prior to 
outputting the commands for creating them. (Unless --if-exists is also 
specified, restore might generate some harmless error messages, if any 
objects were not present in the destination database.)

     This option is only meaningful for the plain-text format. For the 
archive formats, you can specify the option when you call pg_restore.

on pg_restore side(along with --if-exists to remove other harmless error 
messages).

FYI the -W on the pg_dump is redundant as the password will be prompted 
for without it:

-W
--password

     Force pg_dump to prompt for a password before connecting to a database.

     This option is never essential, since pg_dump will automatically 
prompt for a password if the server demands password authentication. 
However, pg_dump will waste a connection attempt finding out that the 
server wants a password. In some cases it is worth typing -W to avoid 
the extra connection attempt.


> 
> Script used for pg_dump:
> 
> -------------------------------------
> 
> pg_dump -h 10.26.33.3 -p 5432 -U postgres -W -F c -v -f 
> tmp/postgres/backup/backup10/ kbcn_backup19  kbcn >& 
> tmp/postgres/backup/backup10/ kbcn_backup19.log; echo $? > 
> tmp/postgres/backup/backup10/_'date+%Y-%m-%d.%H:%M:%S'
> 
> Please advise.
> 
> Regards,
> 
> Daulat
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (9+ messages)  latest in thread

Message-ID: <d5e85379-8055-5604-d236-60fced2a7ee4@aklaver.com>
Permalink:  ../d5e85379-8055-5604-d236-60fced2a7ee4@aklaver.com/
Also on:    postgresql.org/message-id/d5e85379-8055-5604-d236-60fced2a7ee4@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, Daulat.Ram@exponential.com
  Subject: Re: Backup and Restore (pg_dump & pg_restore)
  In-Reply-To: <d5e85379-8055-5604-d236-60fced2a7ee4@aklaver.com>
  References: <BL0PR01MB518710A35F4FF2A127563A2A9B200@BL0PR01MB5187.prod.exchangelabs.com> <BL0PR01MB51872B41EDB099721B5606E59B210@BL0PR01MB5187.prod.exchangelabs.com> <d5e85379-8055-5604-d236-60fced2a7ee4@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox