search
top

Procéder a une mise a jour de PostgreSQL

Préparation

Vérifier l’encodage des bases :

srv-src:~$ su - postgres
postgres@srv-src:~$ psql -l
     Liste des bases de données
    Nom | Propriétaire | Encodage
-----------+--------------+----------
 bdd1 | user1 | UTF8
{...}
(9 lignes)

Migration

  1. Dumper l’intégralité des données :
    pg_dumpall > outputfile
  2. 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
  3. Importer les données :
    /usr/local/pgsql/bin/psql -d postgres -f outputfile

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

*

Vous pouvez utiliser ces balises et attributs HTML : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

top