Thread: Postgres backup & restore

Postgres backup & restore

From
Daulat Ram
Date:

Hello team,

 

We have a postgres11.2 on docker and we are migrating a kb_rep database from postgres 9.6 to postgres 11.2 via pg_dump/pg_restore

We have created a kb_rep schema in postgres 11.2 also but during pg_restore there is an error “pg_restore: [archiver (db)] connection to database "kb_rep" failed: FATAL:  database "kb_rep" does not exist”

 

See below:

 

psql (11.2 (Ubuntu 11.2-1.pgdg18.04+1))

Type "help" for help.

 

postgres=# \l

                              List of databases

   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges

-----------+----------+----------+---------+---------+-----------------------

kb_rep    | postgres | UTF8     | C.UTF-8 | C.UTF-8 |

kbdb      | postgres | UTF8     | C.UTF-8 | C.UTF-8 |

postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 |

template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +

           |          |          |         |         | postgres=CTc/postgres

template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +

           |          |          |         |         | postgres=CTc/postgres

(5 rows)

 

postgres=#

 

 

postgres@b06a42b503e9:/$ pg_restore -h 10.29.50.21 -p 5432 -d kb_rep -v /var/lib/kb_rep_backup16

pg_restore: connecting to database for restore

Password:

pg_restore: [archiver (db)] connection to database "kb_rep" failed: FATAL:  database "kb_rep" does not exist

postgres@b06a42b503e9:/$

 

Please help on this issue.

 

Regards,

Daulat

 

 

 

Re: Postgres backup & restore

From
Justin Pryzby
Date:
On Tue, Apr 16, 2019 at 05:41:31PM +0000, Daulat Ram wrote:
> postgres=# \l
> kb_rep    | postgres | UTF8     | C.UTF-8 | C.UTF-8 |

> postgres@b06a42b503e9:/$ pg_restore -h 10.29.50.21 -p 5432 -d kb_rep -v /var/lib/kb_rep_backup16
> pg_restore: [archiver (db)] connection to database "kb_rep" failed: FATAL:  database "kb_rep" does not exist

Are you sure this DB is the one running on 10.29.50.21 port 5432 ?

Justin