Postgres backup & restore

Daulat Ram <[email protected]>
Newsgroups gmane.comp.db.postgresql.performance
Message-ID <BL0PR01MB5187FF87AD89EC1CC7D673449B240@BL0PR01MB5187.prod.exchangelabs.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.