|
From: | Dany De Bontridder |
Subject: | Re: [noalyss-generale] Récupérer une base de donnée après une ré-installation en catastrophe |
Date: | Thu, 28 May 2020 16:43:27 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
Bonjour
Le lancement manuel de la 9.6 ne semble pas fonctionner ...
postgres@mardi:~$ /usr/lib/postgresql/9.6/bin/pg_ctl start --pgdata /var/lib/postgresql/9.6/main/ -o "--port=4000"Ce qui doit être dû au moment où je remplace le dossier 9.6/main/ de la nouvelle installation avec les données du dossier historique (vu que je le fait depuis sudo caja).
serveur en cours de démarrage
postgres@mardi:~$ 2020-05-28 15:51:19.955 CEST [12218] FATAL: le répertoire des données « /var/lib/postgresql/9.6/main » a un mauvais propriétaire
2020-05-28 15:51:19.955 CEST [12218] ASTUCE : Le serveur doit être en cours d'exécution par l'utilisateur qui possède le
répertoire des données.
psql ls -l /var/lib/postgresql/9.6/main/
total 112
drwxrwxrwx 11 root root 4096 juin 20 2019 base
drwxrwxrwx 2 root root 4096 avril 2 08:50 global
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_clog
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_commit_ts
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_dynshmem
-rw-r----- 1 root root 4643 mai 28 15:48 pg_hba.conf
drwxrwxrwx 4 root root 4096 avril 18 2019 pg_logical
drwxrwxrwx 4 root root 4096 avril 18 2019 pg_multixact
drwxrwxrwx 2 root root 4096 avril 2 08:49 pg_notify
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_replslot
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_serial
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_snapshots
drwxrwxrwx 2 root root 4096 avril 2 17:13 pg_stat
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_stat_tmp
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_subtrans
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_tblspc
drwxrwxrwx 2 root root 4096 avril 18 2019 pg_twophase
-rwxrwxrwx 1 root root 4 avril 18 2019 PG_VERSION
drwxrwxrwx 3 root root 4096 mai 16 2019 pg_xlog
-rwxrwxrwx 1 root root 88 avril 18 2019 postgresql.auto.conf
-rw-r--r-- 1 root root 22718 mai 28 15:48 postgresql.conf
-rwxrwxrwx 1 root root 133 avril 2 08:49 postmaster.opts
J'ai essayé de chmod et chown ce dossier depuis sudo -i -u postgres mais apparement je n'ai pas les droits... et sudo chmod ... depuis postgres@...:~$ ne me demande pas le même mot de passe que l'utilisateur de base (logique).
Je continue de chercher ... !
Maxime
On 28/05/2020 14:28, Dany De Bontridder via noalyss-generale wrote:
Bonjour
Le 28/05/20 à 13:46, maxime a écrit :
Bonjour,
Merci pour ce début de solution, mes essais (pour l'instant toujours infructueux) dans le corps du message(...)
J'ai essayé et voici le résultat :
postgres@mardi:~$ /usr/lib/postgresql/9.6/bin/pg_ctl start --pgdata /var/lib/postgresql/9.6/main/ -o "--port=4000"
serveur en cours de démarrage
postgres@mardi:~$ postgres : n'a pas pu accéder au fichier de configuration « /var/lib/postgresql/9.6/main/postgresql.conf » : Aucun fichier ou dossier de ce type
NB/ Je n'ai effectivement pas de fichier postfresql.conf dans le dossier historique /var/lib/postgresql/9.6/main/, j'ai tout au plus un fichier postgresql.auto.conf
Copier dans le répertoire les 2 fichiers donnés ci-dessous
(...)(...)Posgresql.conf minimumlisten_addresses = 'localhost' # what IP address(es) to listen on;
port = 4000 # (change requires restart)
pg_hba.conf minlocal all all peer
host all all 127.0.0.1/32 trust
Avec la nouvelle version de postgresl faire
/usr/lib/postgresql/10/bin/pg_dumpall > /tmp/full-backup.dmp
... du coup, j'arrive à lancer la suite /usr/lib/postgresql/12/bin/pg_dumpall > full-backup.dmp
pg_dump: attention : WITH OIDS n'est plus supporté (table « action »)
(....)
postgres@mardi:~$ /usr/lib/postgresql/9.6/bin/pg_ctl stop --pgdata /var/lib/postgresql/9.6/main/ -o "--port=4000"
pg_ctl : le fichier de PID « /var/lib/postgresql/9.6/main/postmaster.pid » n'existe pas
Le serveur est-il en cours d'exécution ?
postgres@mardi:~$
Ce qui me fait un fichier full-backup de 775Ko, ce qui je pense n'est pas ma base de donnée (qui n'est pas grosse, mais quand même :)
Oui ces tables sont un problème, heureusement il y a une solution , à partir de la version 12 , on ne peut plus utiliser "with oids" qui était le défaut jusque là :-/
Il va falloir faire un script pour les modifier , quand la 9.6 tourne, se connecter et faire pour chaque base de données , en tant que postgres
psql db1
\o /tmp/x.sql
select 'alter table '||nsp.nspname ||'.'|| tbl.relname ||' without oids;'
from pg_namespace nsp
join pg_class tbl on nsp.oid = tbl.relnamespace
where tbl.relhasoids='t' and nsp.nspname <> 'pg_catalog';\o
\i /tmp/x.sql
Puis faire le pg_dumpall :-)
D.
psql
(...)
-- gpg key 0x6259f36e Alchimerys sprl http://www.alchimerys.be Noalyss , serveur de comptabilité libre ,http://www.noalyss.eu
--- NOALYSS est un Serveur de Comptabilité et de Gestion libre NOALYSS is an ERP Server opensource focused on accountancy Gérer votre abonnement https://lists.nongnu.org/mailman/listinfo/noalyss-generale
--- NOALYSS est un Serveur de Comptabilité et de Gestion libre NOALYSS is an ERP Server opensource focused on accountancy Gérer votre abonnement https://lists.nongnu.org/mailman/listinfo/noalyss-generale
-- gpg key 0x6259f36e Alchimerys sprl http://www.alchimerys.be Noalyss , serveur de comptabilité libre ,http://www.noalyss.eu
[Prev in Thread] | Current Thread | [Next in Thread] |