Migrating RMsis from H2 to MySQL (RMsis 1.7.8)

Introduction

There have been some requests, where RMsis users entered some critical data in the embedded database during the evaluation period and at a later date wish to migrate to a production ready DataBase.

The process is not straightforward and we have worked out a solution, which is presented below. 

However, specific installations may have some unique issues. If you face any such issue, please contact support@optimizory.com. Also see the notes at the end of this article.

This document is applicable only for migrating RMsis 1.7.8 data from H2 to MySQL. If you are using any other version of RMsis, please contact support@optimizory.com for the appropriate migration guide.

Supported Platforms

  • Linux OS has been used in the procedure described below.
  • For migration on MS Windows platform, please use windows versions of all the listed tools. One of our customers has migrated on Windows 7 Platform and shared the following additional points:
    • When we installed SQuirrel SQL on our Windows 7 machine, some plugins where not correctly installed although they were selected for installation in the installer.
    • Especially "Copy Table" did not show up in the context menu.
    • After manually installing the plugins in the right place and restarting the tool the context menu was there.

Resources / Tools Required

Perquisite

  • Jira admin access
  • MySQL root access

Procedure

  1. Installing SQuirrel SQL
    1. Download SQuirrel SQL from link given above
    2. Follow installation instructions given on http://www.squirrelsql.org/#installation
    3. Make sure, you enable all the plugins, specially H2 and MySQL database support
    4. Copy provided H2 and MySQL driver file in <SQuirrel Installation directory>/Contents/Resources/Java/lib directory
  2. Stop your JIRA instance
  3. Take RMsis database backup
    1. Go to <Jira Home>/rmsis/db/h2/1.7.8/rmsis.h2.db
    2. Copy this file and put in your <Work Folder>
      1. we will use this folder for most of our activities, so make sure it doesn't contain any other file
      2. creating a new folder is good idea
  4. Create two MySQL databases
    1. Only one will be used by RMsis, and you can drop other one later
    2. we will assume "rmsis_db_1" and "rmsis_db_2" as two database with user name "rmsis" and password "rmsis"
    3. You can choose different parameters, if you wish
  5. Start SQuirrel SQL (follow instructions given on installation page)
  6. Connecting to your H2 database file, placed in your work folder
    1. Go to Alias > New Alias
    2. Put rmsis-h2 as alias name
    3. From driver select "H2 Embedded"
    4. In URL replace <db-name> with path to <path to work folder>/rmsis
    5. User Name - "sa"
    6. Leave other password blank
    7. Click "Test" for testing your connection, if it fine, press save alias by clicking "OK".

7. Preparing H2 database for migration

    1. In alias section click on rmsis-h2 (connect to it)
    2. On left hand pane select rmsis-h2 > RMSIS > PUBLIC
    3. Go to SQL pane and write following queries, one per line
      1. ALTER TABLE PROJECT ALTER COLUMN VERSION RENAME TO VERSION_NEW;
      2. ALTER TABLE TEST_CASE ALTER COLUMN VERSION RENAME TO VERSION_NEW;
      3. ALTER TABLE REPORTING ALTER COLUMN DOMAIN RENAME TO DOMAIN_NEW;
      4. ALTER TABLE TEST_STEP ALTER COLUMN ACTION RENAME TO ACTION_NEW;
    4. Run queries (CTRL + ENTER)
    5. Now your H2 database is ready for migration

8. Connecting to MySQL database

    1. Go to Alias > New Alias
    2. Put rmsis-mysql as alias name
    3. Select "MySQL Driver" for driver
    4. In URL put jdbc:mysql://<hostname>:<port>/<dbname>
      1. replace <hostname> with MySQL host name, localhost if it is running on localhost,
      2. replace <port> with MySQL port, 3306 is default
      3. replace <dbname> with rmsis_db_1 (created in step 4)
    5. Put user name and password, that you can created in step 4
    6. Test connection and save it once it is done.

9. Copying database

    1. Go to Alias pane
    2. Connect to "rmsis-h2"
    3. Go to rmsis-h2 > RMSIS > PUBLIC > TABLE
    4. Right click on TABLE and select "Copy Table" from context menu

10. Pasting database

    1. Go to Alias pane
    2. Connect to "rmsis-mysql"
    3. Go to "rmsis-mysql > rmsis_db_1 > TABLE
    4. Right click on TABLE and select "Paste Table" from context menu
    5. it will take some time according to size of your database
    6. once it is done successfully, close SQuirrel SQL Client

11. Preparing MySQL database from step 10

    1. Open terminal and connect to rmsis_db_1 using MySQL
      1. mysql -u<username> -p<password> rmsis_db_1
    2. Run following queries
      1. ALTER TABLE  `PROJECT` CHANGE  `VERSION_NEW`  `VERSION` INT( 11 ) NULL DEFAULT NULL;
      2. ALTER TABLE  `TEST_CASE` CHANGE  `VERSION_NEW`  `VERSION` INT( 11 ) NULL DEFAULT NULL;
      3. ALTER TABLE  `REPORTING` CHANGE  `DOMAIN_NEW`  `DOMAIN` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
      4. ALTER TABLE `TEST_STEP` CHANGE `ACTION_NEW` `ACTION` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci;
    3. Now close MySQL connection
    4. Go to your work folder (created in step 3), and dump your RMsis database MySQL file (rmsis_db_1)
      1. mysqldump -u<username> -p<password> --no-create-info --skip-add-drop-table rmsis_db_1 > rmsis_db_1.sql
    5. Open this SQL file in VIM
      1. Run command
        1. :%s/`\(\w\+\)`/\L&/g  (it is to change case of table and column name)
      2. Save and exit editor
        1. :wq

12. Loading blank RMsis database to second RMsis database (created in step 4, rmsis_db_2)

    1. Copy RMsis blank database (rmsis_178_r206_blank.sql) attached to work folder
    2. Run command
      1. mysql -u<username> -p<password> rmsis_db_2 < rmsis_178_r206_blank.sql
      2. replace <username>, <password> as required

13. Loading data to second MySQL database (using sql file created in step 11)

    1. Run command
      1. mysql -u<username> -p<password> rmsis_db_2 < rmsis_db_1.sql
      2. replace <username>, <password> as required

14. You are almost ready now ...

15. Replacing database pointer in RMsis

    1. Start your Jira Server (switched off in step 2)
    2. Login using Administration
    3. Go to RMsis > RMsis Configuration (click on down arrow near RMsis tab for RMsis configuration)
    4. Open "Database Configuration" tab
    5. Change "Database Connection" to External
    6. Database Type, "MySQL"
    7. Hostname, your MySQL server host name (localhost if it runs local)
    8. Port, your MySQL server port (3306 is default for MySQL)
    9. Database, rmsis_db_2 (replace it, if you used different name for second database in step 4)
    10. Username, database username
    11. Password, database password
    12. Save configuration

16. It will take some time to start RMsis server again, once it is done press "Finish"

17. Go to RMsis, and test if everything is fine.

Have Issues ?

  • If the process breaks down in between or if you have any issues, do not proceed and contact support@optimizory.com.
  • looking at the complexity of migration, it may not be practical to exchange information on mails. At the minimum, we will need mechanism to view your screen, either through WebEx or Skype. Please ensure that this is possible, before contacting support.

Â