Préparation
Vérifier l’encodage des bases :
su - postgres
psql -l
Liste des bases de données
Nom | Propriétaire | Encodage
-----------+--------------+----------
bdd1 | user1 | UTF8
{...}
(9 lignes)
Migration
Dumper l’intégralité des données
pg_dumpall > outputfile
Initialiser le nouvel emplacement en UTF8
/usr/local/pgsql/bin/initdb --locale=UTF8 -D /usr/local/pgsql/data
Le dossier doit être comme cela :
drwx------ 5 postgres postgres 4096 4 nov. 15:25 base
drwx------ 2 postgres postgres 4096 4 nov. 15:25 global
drwx------ 2 postgres postgres 4096 4 nov. 15:25 pg_clog
-rw------- 1 postgres postgres 3652 4 nov. 15:25 pg_hba.conf
-rw------- 1 postgres postgres 1631 4 nov. 15:25 pg_ident.conf
drwx------ 4 postgres postgres 4096 4 nov. 15:25 pg_multixact
drwx------ 2 postgres postgres 4096 4 nov. 15:25 pg_stat_tmp
drwx------ 2 postgres postgres 4096 4 nov. 15:25 pg_subtrans
drwx------ 2 postgres postgres 4096 4 nov. 15:25 pg_tblspc
drwx------ 2 postgres postgres 4096 4 nov. 15:25 pg_twophase
-rw------- 1 postgres postgres 4 4 nov. 15:25 PG_VERSION
drwx------ 3 postgres postgres 4096 4 nov. 15:25 pg_xlog
-rw------- 1 postgres postgres 16903 4 nov. 15:25 postgresql.conf
lrwxrwxrwx 1 root root 36 4 nov. 15:28 server.crt -> /etc/ssl/certs/ssl-cert-snakeoil.pem
lrwxrwxrwx 1 root root 38 4 nov. 15:29 server.key -> /etc/ssl/private/ssl-cert-snakeoil.key
Importer les données
/usr/local/pgsql/bin/psql -d postgres -f outputfile