MySQL to PostgreSQL Migration


Note: You need to be on Version 13210 of Applications Manager or above to do migration, so please check the build number in the Support tab.

Prerequisites

  1. Before starting Migration check the Database port number in following files (and make sure it's the same in all the files):
    • AMServer.properties in "AppManager_Home/conf"
    • database_params.conf in "AppManager_Home/working/conf"
    • startMySQL.bat (before export in MySQL build) / startPGSQL.bat (before import in PGSQL build) in "AppManager_Home/working/bin"
  2. Install the PostgreSQL build which is same as MySQL. Start and stop the new PostgreSQL build.
  3. Take backup of the MySQL Database before starting Migration.

Steps for Migration:

Step 1 - Stop MySQL build “ManageEngine Applications Manager” service and via command prompt (make sure you run as administrator) , go to <AppManager Home> directory and execute the below commands.

                            shutdownApplicationsManager.bat
                            shutdownApplicationsManager.bat -force
                Via command prompt, go to <AppManager Home> directory and execute the below command in Linux.
                            sh shutdownApplicationsManager.sh 
                            sh shutdownApplicationsManager.sh -force

Step 2 - In MySQL AppManager, open a command prompt using administrator privileges, run the <AppManagerHome>/bin/Migration/MigrateToPGSQL.bat script, data export process will start. You can view progressin <AppManager Home>/logs/Migration/.

                     Example:
                                 MigrateToPGSQL.bat Export
                                 sh MigrateToPGSQL.sh Export (in case of Linux)
 
Step 3 - From the MySQL AppManager copy <AppManager Home>/working/Migration.zip file to the same location in the PGSQL AppManager and unzip it (All the *.txt files should be in <AppManagerHome>/working/Migration/)
 
Step 4 - In MySQL AppManager run the <AppManager Home>\bin\BackupConfig.bat (or sh) script and copy the <AppManager Home>\working\backup\backupconfzip_Type_Build_Date_HH_MM_SS.zip file to the same location in the PGSQL AppManager.
 
Step 5 - Take a backup of AMServer.properties under AppManager_HOME/conf folder in PGSQL build.
 
Step 6 - Run the <AppManager Home>\bin\RestoreConfig.bat (or sh) script with the backupconfzip_Type_Build_Date_HH_MM_SS.zip file that  was copied in step 4.
 
Step 7 - In PGSQL AppManager go to <AppManager Home>/working/pgsql/data and remove or rename  “amdb” folder.
 
Step 8 - In PGSQL AppManager, open a command prompt using administrator privileges, run the <AppManager Home>/bin/Migration/MigrateToPGSQL.bat script, data import process will start. You can view progress in <AppManager Home>/logs/Migration/.
                         Example:
                                    MigrateToPGSQL.bat Import
                                    sh MigrateToPGSQL.sh Import (in case of Linux)
 
Step 8 - Replace the host details of PGSQL build in AMServer.properties with the details in backup file taken in step 5.
 
Step 9 - Start the PGSQL Applications Manager & check your data.
 

Note:
1. After Migration, it is mandatory to copy and paste all the Prerequisites files needed for monitoring from MYSQL to the PGSQL build. Once database migration is completed, please confirm that there are no failed tables. Once this is done, start the migrated build.
2.If the MigrateToPGSQL or MigrateToMSSQL scripts are once executed in a build, a text file will be created in the working\migration folder which will not allow you to run the same script again successfully. Delete or rename the 'migration' folder to run the scripts again.