N1 Provisioning Server 3.1, Blades Edition, Installation Guide

Migrating From Oracle to PostgreSQL

You must upgrade from N1 Provisioning Server, Blades Edition version 3.0 to version 3.1 before you can migrate your N1 Provisioning Server 3.0 database data from Oracle to PostgreSQL (Postgres).

ProcedureTo Migrate N1 Provisioning Server 3.0 Data from Oracle to Postgres

Steps
  1. Log in as root (su - root) on the control plane server.

  2. Verify that the database administration group exists by typing grep dba /etc/group.

    • If the dba group exits, the response dba::100: is displayed. Go to the next step.

    • If the dba group does not exist, only the prompt is displayed. Type groupadd dba to create the database administration group.

  3. Type useradd -g dba postgres to add the Postgres user account.

  4. Change the database port.

    1. Log onto the control center as administrator using a Control Center management PC.

      The Control Center main screen is displayed.

    2. Click Admin in the menu bar.

      The Administration Screen is displayed.

    3. Click I-Fabric in the Configuration Tools panel.

      The I-Fabrics screen is displayed.

    4. Replace the displayed port number with the Postgres port number 5432.

    5. Click Commit Changes.

    6. Click Logout to log out of the Control Center.

  5. Type /opt/terraspring/sunone/bin/appserv stop to stop the control center application server.

  6. Back up the control plane database.

    Type the command /opt/terraspring/sbin/backupdb -o ${Oracle_Home} backup_file

    where backup_file is the name you have chosen for the backup file.

  7. Back up the Control Center database by typing /opt/terraspring/gwdb/bin/backupDB.sh.

    The Control Center database is backed up to the file /var/opt/terraspring/gwdb/backup/tsprgwdb.backup.

  8. Update the database properties file to point to the Postgres database and port.


    Note –

    The following single-line examples have been split across two lines for display purposes.


    1. In the file /etc/opt/terraspring/tspr.properties, change the following DBConnection text string.

      com.terraspring.core.sys.GridOS.DBConnection=
              com.terraspring.db.oracle.OracleCpdbConnection

      to

      com.terraspring.core.sys.GridOS.DBConnection=
              com.terraspring.db.postgres.PostgresCpdbConnection
    2. Change to port number in the CpdbConnection text string from 1521 to 5432.

      com.terraspring.db.CpdbConnection.port=1521

      For example:

      com.terraspring.db.CpdbConnection.port=5432
    3. Save and close the file.

  9. Install the Postgres database.

    1. Insert the N1 Provisioning Server 3.1 Installation DVD-ROM in the control plane server DVD-ROM drive.

    2. Install the Postgres package by typing pkgadd -d /cdrom/cdrom0/Products/SUNWn1pg.pkg

  10. Create the Postgres database.

    Type the command /opt/terraspring/lib/postgres/createdb -i -H localhost -o /opt/postgres -n tsprdb -f postgres_data postgres_log where postgres_data is the full path of the directory in which the database is created, and postgres_log is the full path name of the directory in which the database logs are saved.

  11. Restore the control plane database data to Postgres.

    Type the command /opt/terraspring/sbin/restoredb restore_file

    where restore_file is the name of the control plane database backup file you created in Step 6.

  12. Configure the database by typing /opt/terraspring/gwdb/bin/configure.sh.

    You are prompted for configuration information. The following list shows the prompts and the required responses. Responses are case-sensitive and must be typed exactly as shown with no leading and no trailing spaces unless otherwise noted.

    • DB_TYPE: Postgres

    • DB Admin User: postgres

    • DB Admin Password: postgres

    • DB User: tcc

    • DB User Password: tcc

    • DB Host Name: localhost

    • DB Instance Name: tsprdb

    • DB Instance Listening Port: 5432

    • DB Backup Directory [/var/opt/terraspring/gwdb/backup]:

      Press Enter.

    • DB Backup Filename [tsprgwdb.backup]:

      Press Enter.

  13. Initialize the Postgres database by typing /opt/terraspring/gwdb/bin/createDB.sh -y.

  14. Restore the database Web configuration information by typing /opt/terraspring/gwdb/bin/restoreDB.sh.

    The following messages appear:


    WARNING: That will destroy the current Control Center database.
    Do you want to continue anyway(y/n)? [n]:

    Type y to continue.

  15. Reconfigure the Control Center for Postgres.

    1. Change the database type and port.

      In the file /var/opt/terraspring/gw/gw.sunone.state, change the following text string

      DB_TYPE=Oracle

      to

      DB_TYPE=Postgres

      Change the following text string

      DB_PORT=1521

      to

      DB_PORT=5432
    2. Save and close the file.

  16. Stop and reconfigure the Control Center application server by typing /opt/terraspring/sunone/bin/setup7.sh -silent.

    The setup7.sh script stops and then reconfigures the Control Center (CC) application server using the files you have updated in the previous steps.

  17. Type the following commands in sequence to stop and restart the monitoring manager:

    /opt/terraspring/sbin/snmpd stop

    /opt/terraspring/sbin/snmpd start

  18. Type the following commands in sequence to stop and restart the segment manager.

    /etc/rc3.d/S97sm stop

    /etc/rc3.d/S97sm start

  19. Type the following commands in sequence to stop and restart the monitoring manager:

    /opt/terraspring/sbin/mmd stop

    /opt/terraspring/sbin/mmd start

  20. Restart the CC application server by typing /opt/terraspring/sunone/bin/appserv start