Search Postgresql Archives

Re: How to migrate from PGSQL 9.3 to 9.6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/30/2016 10:27 AM, Sinclair, Ian D (Ian) wrote:

The actual upgrade will be that I have an existing server running 9.3 on RHEL 6.2. We’ll have to do a backup of the database, then deploy a new OVA to get to RHEL 7 with PG 9.6, then restore the database. Are there any specific steps that I’ll have to execute in the scripts that will restore the database to get the 9.3 data to work with 9.6?

 

Since all my users will be getting to 9.6 from a new system deployment, not by any sort of partial upgrade, do I need to worry about trying to get a correct version of the setup script with upgrade handling? (Other than whatever I need for the answer above.)

 


the upgrade scripts, like pg_upgrade, are for in place upgrades (same server, postgres X.Y to X.newer).

if the old server will still be running when you have the new one ready, what I already said, configure the old server to allow the postgres user on the new server to access it over the network, then, from the postgres user on the new server, do this..

    pg_dumpall -h oldserver | psql

this assumes the new version of postgres is installed, initialized, and running, but otherwise untouched

My personal preference for a full backup dump-n-restore goes something like this...

dump script, run as the postgres system user...

   DD=$(date +%F)
   PP=/path/of/where/to/put/dumps
   pg_dumpall  -g -f $PP/pg_dumpall.globals-$DD.sql
   for db in $(psql -tc "select datname from pg_database where not datistemplate"); do
       pg_dump -Fc --schema-only -f $PP/pgdump.$db.$DD.dump -d $db
   done

this creates a globals dump in plain sql, then a compressed dump of each non-system database.

to restore these on a new cluster...

    psql -f $PP/pg_dumpall.globals-2016-11-15.sql
    for db in $PP/*.dump; do
        pg_restore -d postgres --clean --create  $db
    done

but this is more for regular backups, the advantage of the compressed format is pg_restore has a lot more options during database restore.





-- 
john r pierce, recycling bits in santa cruz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux