Bonjour.
J'avoue ne pas être au point sous Linux et PostgreSQL mais je ne sais plus comment et vers où orienter mes recherches par rapport à mon pbm.
Bon, si personne ne comprend mon explication ci-dessous, je tenterai une formulation un peu plus basée sur la prose.
Merci de m'aider :
Action à réaliser :
___________________
Sauver la base de données nommée XXXX de type POSTGRESQL (accédée depuis un intranet) se trouvant sur l'ancien serveur Linux et la restaurer sur le nouveau serveur Linux.
Il existe un utilisateur PosgreSQL nommé postgres et j'ai créé un utilisateur XXXX sur le nouveau serveur tout cela l'avait été fait sur l'ancien. Je suis bête et méchant, donc je m'applique à recréer au mieux le même environnement des deux côtés.
Donc, pg_dump à faire sur l'ancien serveur, puis pg_restore sur le nouveau. Le fichier tar de sauvegarde est copié d'un serveur à l'autre depuis mon poste Windows via Samba.
Voici deux procédures qui mènent à un arrêt (FAILURE) durant le pg_restore :
-------------------------------------------------------
1 - ACTION REALISEE SOUS L'USER POSTGRES DES DEUX COTES
-------------------------------------------------------
Sur l'ancien serveur :
______________________
[root@dhcppc5 etc]# su - postgres
bash-2.05a$ psql XXXX
Bienvenu à psql, l'interface interactif de PostgreSQL.
Tapez: \copyright pour l'information de copyright
\h pour l'aide-mémoire sur les commandes SQL
\? pour l'aide-mémoire sur les commandes internes
\g ou point-virgule pour exécuter une requête
\q pour quitter
XXXX=# \l
Liste des bases de données
Nom | Propriétaire | Encodage
-------------+--------------+-----------
XXXX | postgres | SQL_ASCII
bug_tracker | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(4 lignes)
XXXX=# \q
bash-2.05a$ pg_dump -Ft XXXX > /tmp/savebase.tar
bash-2.05a$
Sur le nouveau serveur :
________________________
[root@dhcppc8 /]# su - postgres
bash-2.05a$ dropdb XXXX
DROP DATABASE
bash-2.05a$ createdb XXXX
CREATE DATABASE
bash-2.05a$ psql XXXX
Bienvenu à psql, l'interface interactif de PostgreSQL.
Tapez: \copyright pour l'information de copyright
\h pour l'aide-mémoire sur les commandes SQL
\? pour l'aide-mémoire sur les commandes internes
\g ou point-virgule pour exécuter une requête
\q pour quitter
XXXX=# \l
Liste des bases de données
Nom | Propriétaire | Encodage
-------------+--------------+-----------
XXXX | postgres | SQL_ASCII
bug_tracker | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(4 lignes)
XXXX=# \q
bash-2.05a$ pg_restore -d XXXX /mnt/disk2/XXXX/savebase.tar
pg_restore: [archiver (db)] could not reconnect to database: FATAL 1: IDENT authentication failed for user "XXXX"
----------------------------------------------------------------------------------------------------
2 - ACTION REALISEE SOUS L'USER POSTGRES DES DEUX COTES PUIS AVEC L'USER XXXX SUR LE NOUVEAU SERVEUR
----------------------------------------------------------------------------------------------------
Sur l'ancien serveur :
______________________
[root@dhcppc5 etc]# su - postgres
bash-2.05a$ psql XXXX
Bienvenu à psql, l'interface interactif de PostgreSQL.
Tapez: \copyright pour l'information de copyright
\h pour l'aide-mémoire sur les commandes SQL
\? pour l'aide-mémoire sur les commandes internes
\g ou point-virgule pour exécuter une requête
\q pour quitter
XXXX=# \l
Liste des bases de données
Nom | Propriétaire | Encodage
-------------+--------------+-----------
XXXX | postgres | SQL_ASCII
bug_tracker | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(4 lignes)
XXXX=# \q
bash-2.05a$ pg_dump -Ft XXXX > /tmp/savebase.tar
bash-2.05a$
Sur le nouveau serveur :
________________________
[root@dhcppc8 /]# su - postgres
bash-2.05a$ psql XXXX
psql: FATAL 1: Database "XXXX" does not exist in the system catalog.
bash-2.05a$ createdb XXXX
CREATE DATABASE
bash-2.05a$ psql XXXX
Bienvenu à psql, l'interface interactif de PostgreSQL.
Tapez: \copyright pour l'information de copyright
\h pour l'aide-mémoire sur les commandes SQL
\? pour l'aide-mémoire sur les commandes internes
\g ou point-virgule pour exécuter une requête
\q pour quitter
XXXX=# \l
Liste des bases de données
Nom | Propriétaire | Encodage
-------------+--------------+-----------
XXXX | postgres | SQL_ASCII
bug_tracker | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(4 lignes)
XXXX=# \q
bash-2.05a$ exit
logout
[root@dhcppc8 /]# su - XXXX
[XXXX@dhcppc8 XXXX]$ pg_restore -d XXXX /mnt/disk2/XXXX/savebase.tar
pg_restore: [archiver] WARNING:
Data restoration may fail because existing triggers cannot be disabled
(no superuser user name specified). This is only a problem when
restoring into a database with already existing triggers.
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'nombreposte_pkey' for table 'nombreposte'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'connexion_pkey' for table 'connexion'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'utilisateur_pkey' for table 'utilisateur'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'typeclient_pkey' for table 'typeclient'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'client_pkey' for table 'client'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clienttechnique_pkey' for table 'clienttechnique'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'titre_pkey' for table 'titre'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'hierarchie_pkey' for table 'hierarchie'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'interlocuteur_pkey' for table 'interlocuteur'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'actiondocument_pkey' for table 'actiondocument'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'option_pkey' for table 'option'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'produit_pkey' for table 'produit'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'produitoption_pkey' for table 'produitoption'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'sousproduit_pkey' for table 'sousproduit'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'propal_pkey' for table 'propal'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clientpropal_pkey' for table 'clientpropal'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'proposition_pkey' for table 'proposition'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'service_pkey' for table 'service'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clientcontrat_pkey' for table 'clientcontrat'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'suiviproduits_pkey' for table 'suiviproduits'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'suivioptions_pkey' for table 'suivioptions'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'bonlivraison_pkey' for table 'bonlivraison'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'livraison_pkey' for table 'livraison'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'rattachement_pkey' for table 'rattachement'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pays_pkey' for table 'pays'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'typeaction_pkey' for table 'typeaction'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'os_pkey' for table 'os'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'protocole_pkey' for table 'protocole'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'effectif_pkey' for table 'effectif'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'ca_pkey' for table 'ca'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'raisonlivraison_pkey' for table 'raisonlivraison'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'echeance_pkey' for table 'echeance'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'concurrent_pkey' for table 'concurrent'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'taxe_pkey' for table 'taxe'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'indice_pkey' for table 'indice'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'action_pkey' for table 'action'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'service2_pkey' for table 'service2'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'activite_pkey' for table 'activite'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'typecontrat_pkey' for table 'typecontrat'
pg_restore: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'contrat_pkey' for table 'contrat'
pg_restore: [archiver (db)] could not reconnect to database: FATAL 1: IDENT authentication failed for user "apache"
Partager