Обсуждение: Restore to a new database from a backup (.tar) generated from

Поиск
Список
Период
Сортировка

Restore to a new database from a backup (.tar) generated from

От
PG Doc comments form
Дата:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/app-pgrestore.html
Description:

After creating a new database in postgreSQL :
CREATE DATABASE x;
I dump it in a .tar file:
                    pg_dump -p 5433 -U postgres -W -F t x >
C:\pgBackups\x.tar
Then I restore it with  the restore command:
   pg_restore -p 5433 -U postgres -W -d x -C --verbose C:\pgBackups\x.tar
                   RESULT : pg_restore: création de DATABASE « x »
                                    pg_restore: pendant le traitement de la
TOC (« PROCESSING TOC ») :
                                    pg_restore: de l'entrée TOC 3315 ; 1262
29865 DATABASE x postgres
                                    pg_restore: erreur : could not execute
query: ERREUR:  la base de données « x » existe déjà
                                    La commande était : CREATE DATABASE x
WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE =
'French_Canada.1252';
                                    pg_restore: connexion à la nouvelle base
de données « x »
                                    pg_restore: attention : erreurs ignorées
lors de la restauration : 1                     ' PROBLEM WITH CODE PAGE
1252 and the fact that the (empty) db already exists
if I remove the database (x) from PostgreSQL (Version 15.5)            DROP
DATABASE x;
and I try the same restore command:
          pg_restore -p 5433 -U postgres -W -d x -C --verbose
C:\pgBackups\x.tar
                  RESULT :  pg_restore: connexion à la base de données pour
la restauration
Mot de passe :
pg_restore: erreur : la connexion au serveur sur « localhost » (::1), port
5433 a échoué : FATAL:  la base de données « x » n'existe pas     ' The
problem is that the database does not exist  

So, I can I create a database from scratch, in PostgreSQL, from a backup
(.tar) file generated from  pg_dump ?

Re: Restore to a new database from a backup (.tar) generated from

От
Daniel Gustafsson
Дата:
> On 29 Nov 2023, at 23:18, PG Doc comments form <noreply@postgresql.org> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/15/app-pgrestore.html
> Description:
>
> After creating a new database in postgreSQL :

This form is not intended to be used for general questions about postgres,
please use the appropriate mailinglist for this.  In your case I would
recomment pgsql-general.

    https://www.postgresql.org/list/

--
Daniel Gustafsson