Upgrade to a new machine

If you have an existing system but you are installing OpenVPMS on a new machine, you essentially go through the steps for a new install, but instead of creating a new openpms database, you restore your existing one, and then upgrade that to the new release.

 

First you need to use mysqldump to take a backup of the database on the old machine (see Upgrade|Preparation).

You can then follow the New Installation steps until you get to the Database Setup step.

Then, to create the OpenVPMS MySQL database, run the following in a shell prompt
  > cd <OPENVPMS_HOME>/bin
  > dbtool --create restore -u admin -p apasswd

If the OpenVPMS database already exists on the new server, this step will fail with the error message:

Cannot create openvpms as it already exists

The database should dropped and the command run again. Failure to do so may result in the database containing different versions of OpenVPMS tables. This can affect upgrades, and cause data corruption.

NOTES:

  • replace 'admin' with a user that has administrator privileges in MySQL and 'apasswd' with their password
  • the --create restore option creates a user 'openvpms' with password 'openvpms' that only has privileges to connect from localhost.
  • If the MySQL database is a different host to that running Tomcat, then you will need to:
    1. Edit the <OPENVPMS_HOME>/conf/hibernate.properties file to replace 'localhost' in the line

      hibernate.connection.url=jdbc:mysql://localhost:3306/openvpms
      by the IP address or host name of the database server.
      This MUST be done before running dbtool.

    2. After running dbtool, use the mysql utility to grant access using the command:

GRANT ALL PRIVILEGES ON openvpms.* TO 'openvpms'@'%'           IDENTIFIED BY 'openvpms' WITH GRANT OPTION;

To improve security, the '%' can be limited to the host that Tomcat will connect from.

 

Having created the database, you can now use the mysql utility to restore your backup onto the new machine.  This is done using the command:

 

  > mysql -u admin -p openvpms < openvpms.sql

where admin is the name of your root user and openvpms.sql is the dump from the old machine.

You should continue with the Web Application and Open Office installation steps.

To complete the process, we need to upgrade the installation on the new machine, so we simply use the steps to Upgrade an Existing Installation. Note that if you are migrating from 1.9 or earlier, this describes the necessary database migration steps.

Dropping the database

If the database to restore a backup to already exists, it should be dropped first.

Dropping the database destroys any data present, so ensure there is a backup before proceeding.

> mysql -u admin -p
> drop schema openvpms;
    Query OK, 46 rows affected (1.04 sec)
> quit

 

Syndicate content