Upgrade Alpine Chorus Internal PostgreSQL 9.2 DB to 9.3

Upgrade Alpine Chorus Internal PostgreSQL 9.2 DB to 9.3

book

Article ID: KB0082615

calendar_today

Updated On:

Products Versions
Spotfire Data Science 6.x

Description

Upgrade Alpine Chorus Internal PostgreSQL 9.2 DB to 9.3

Issue/Introduction

Upgrade Alpine Chorus Internal PostgreSQL 9.2 DB to 9.3

Resolution

Directory Structure and Path Variables:

Alpine Chorus PostgreSQL 
/usr/local/chorus/current/postgres

Alpine Chrous PostgreSQL Binaries:
/usr/local/chorus/current/postgres/bin

Original 9.2 Binaries:
/usr/pgsql-9.2/

Original 9.3 Binaries:
/usr/pgsql-9.3/

Alpine Chorus PostgreSQL Data Directory DB (-> = softlink)
/usr/local/chorus/current/postgres-db -> /usr/local/chorus/shared/db -> /data/chorus/db

To manually connect to chorus database as postgres_chorus user.
$CHORUS_HOME/current/postgres/bin/psql -U postgres_chorus -p 8543 chorus;

To Start PostgreSQL 9.3 manually (-D Data Directory, -l Log directory/file)
/usr/pgsql-9.3/bin/pg_ctl -D /data/chorus/db2 -l /tmp/db2server.log start
/usr/pgsql-9.3/bin/pg_ctl -D /data/chorus/db2 -l /tmp/db2server.log stop

Step-by-step guide

PostgreSQL 9.3 Installation

  1. install 9.3. Ensure you use this as your data directory /data/chorus/db2.   Binary directory is most likely at this location: /usr/pgsql-9.3
  2.  Initialze the 9.3 Database. Make sure to use postgres_chorus as the installing user (superuser).
    /initdb -U postgres_chorus -D /data/chorus/db2
  3. Start Postgres9.3 database
    ./pg_ctl -l /tmp/server93.log -D /data/chorus/db2/ start
  4. Connect to PostgreSQL 9.3 - There may only be 1 or 2 standard DB (postgres and template1). This will esure you can login to the db as postgres_chorus and connect to an existing db (template1)
    ./psql -U postgres_chorus template1
  5. Stop PostgreSQL 9.3 DB
    ./pg_ctl -D /data/chorus/db2 stop
  6. Make Sure both PostgreSQL db have stopped before running this command
    ./pg_upgrade -v -b /usr/pgsql-9.2/bin/ -p 5432 -B /usr/pgsql-9.3/bin/ -d /data/chorus/db -D /data/chorus/db2 -u postgres_chorus
  7. After Successful completion, start PostgreSQL 9.3
    ./pg_ctl -D /data/chorus/db2/ -l /tmp/93server.log start
  8. Login as postgres_chorus and connect chorus db.
    ./psql -U postgres_chorus chorus
  9. Stop PostgreSQL 9.3 db
    ./pg_ctl -D /data/chorus/db2/ -l /tmp/93server.log stop
At this point of the upgrade, the migration from 9.2 to 9.3 has been successfully completed. We now must remove 9.2 data files.
  1. Remove old 9.2 binaries from $CHORUS_HOME
    rm -rf /usr/local/chorus/current/postgres/*
  2. Copy new 9.3 binaries from /usr/pgsql-9.3
    cp -R /usr/pgsql-9.3/* /usr/local/chorus/current/postgres/
  3. Remove old 9.2 data directory
    rm -rf /data/chorus/db/*
  4. Copy new 9.3 data from /data/chorus/db2
    mv /data/chorus/db2/* /data/chorus/db
    rm -rf /data/chorus/db2
  5. Use chorus_control.sh start to start Alpine Chorus (and the new db)
    chorus_constrol.sh start
  6. Use chorus_psql.sh script to connect to db
    /usr/local/chorus/chorus_psql.sh

http://www.uptimemadeeasy.com/databases/upgrade-postgresql/