Mango upgrade procedure to preserve existing data in the database
-
I want to upgrade the Mango from 1.2 to 2.03. What is the procedure so that I can keep the existing data in the database after the version upgrade.
Thanks !
-
If you are using m2m2 1.2 it should upgrade just fine. Make a full backup just in case. You will need to purchase a upgrade license after the upgrade but you can run it in free mode to make sure the upgrade as worked.
Joel.
-
Thank you for your quick reply. I try to upgrade but with errors and the process terminated. The errors messages in the ma.log are listed as follows.
INFO 2012-11-21 12:03:05,303 (com.serotonin.util.properties.ReloadingProperties.checkForReload:142) - (env) Found updated file(s) at [C:\m2m2-2.0.3\classes\env.properties]. Reloading properties
INFO 2012-11-21 12:03:07,658 (com.serotonin.m2m2.Main.loadModules:222) - Loading module 'graphicalViews', v1.4.0 by Serotonin Software
INFO 2012-11-21 12:03:07,721 (com.serotonin.m2m2.Main.loadModules:222) - Loading module 'meta', v1.4.0 by Serotonin Software
INFO 2012-11-21 12:03:07,767 (com.serotonin.m2m2.Main.loadModules:222) - Loading module 'modbus', v1.4.1 by Serotonin Software
INFO 2012-11-21 12:03:07,799 (com.serotonin.m2m2.Main.loadModules:222) - Loading module 'sstGraphics', v1.0.1 by Serotonin Software
INFO 2012-11-21 12:03:07,861 (com.serotonin.m2m2.Main.loadModules:222) - Loading module 'virtualDS', v1.4.0 by Serotonin Software
INFO 2012-11-21 12:03:07,908 (com.serotonin.m2m2.Main.loadModules:222) - Loading module 'watchlists', v1.4.0 by Serotonin Software
INFO 2012-11-21 12:03:09,187 (com.serotonin.m2m2.db.BasePooledProxy.initializeImpl:36) - Initializing pooled connection manager
WARN 2012-11-21 12:03:11,433 (com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade:88) - Upgrading 'core' from 2 to 3
INFO 2012-11-21 12:03:11,449 (com.serotonin.m2m2.db.upgrade.DBUpgrade.createUpdateLogOutputStream:145) - Writing upgrade log to C:\com.serotonin.m2m2.db.upgrade.Upgrade2.log
WARN 2012-11-21 12:03:11,449 (com.serotonin.m2m2.db.upgrade.DBUpgrade.createUpdateLogOutputStream:155) - Failing over to console for printing database upgrade messages
WARN 2012-11-21 12:19:35,318 (com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade:88) - Upgrading 'core' from 3 to 4
INFO 2012-11-21 12:19:35,337 (com.serotonin.m2m2.db.upgrade.DBUpgrade.createUpdateLogOutputStream:145) - Writing upgrade log to C:\com.serotonin.m2m2.db.upgrade.Upgrade3.log
WARN 2012-11-21 12:19:35,338 (com.serotonin.m2m2.db.upgrade.DBUpgrade.createUpdateLogOutputStream:155) - Failing over to console for printing database upgrade messages
WARN 2012-11-21 12:20:17,938 (com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade:88) - Upgrading 'core' from 4 to 5
INFO 2012-11-21 12:20:17,957 (com.serotonin.m2m2.db.upgrade.DBUpgrade.createUpdateLogOutputStream:145) - Writing upgrade log to C:\com.serotonin.m2m2.db.upgrade.Upgrade4.log
WARN 2012-11-21 12:20:17,959 (com.serotonin.m2m2.db.upgrade.DBUpgrade.createUpdateLogOutputStream:155) - Failing over to console for printing database upgrade messages
WARN 2012-11-21 12:20:20,634 (com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade:88) - Upgrading 'core' from 5 to 6
INFO 2012-11-21 12:20:20,645 (com.serotonin.m2m2.db.upgrade.DBUpgrade.createUpdateLogOutputStream:145) - Writing upgrade log to C:\com.serotonin.m2m2.db.upgrade.Upgrade5.log
WARN 2012-11-21 12:20:20,646 (com.serotonin.m2m2.db.upgrade.DBUpgrade.createUpdateLogOutputStream:155) - Failing over to console for printing database upgrade messages
ERROR 2012-11-21 12:20:22,624 (com.serotonin.m2m2.Main.main:88) - Error during initialization
com.serotonin.ShouldNeverHappenException: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [ALTER TABLE dataPoints ADD COLUMN pointFolderId int; ]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column name 'pointFolderId'
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:94)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:34)
at com.serotonin.m2m2.db.DatabaseProxy.initialize(DatabaseProxy.java:136)
at com.serotonin.m2m2.Lifecycle.databaseInitialize(Lifecycle.java:412)
at com.serotonin.m2m2.Lifecycle.initialize(Lifecycle.java:143)
at com.serotonin.m2m2.Main.main(Main.java:82)
Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [ALTER TABLE dataPoints ADD COLUMN pointFolderId int; ]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column name 'pointFolderId'
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:94)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:406)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:427)
at com.serotonin.m2m2.db.BasePooledProxy.runScript(BasePooledProxy.java:71)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:122)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:136)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:127)
at com.serotonin.m2m2.db.upgrade.Upgrade5.upgrade(Upgrade5.java:16)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:90)
... 5 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column name 'pointFolderId'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2477)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:741)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:587)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:266)
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:420)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395)
... 12 more
INFO 2012-11-21 12:20:22,753 (com.serotonin.m2m2.db.BasePooledProxy.terminate:108) - Stopping databaseBy the way, if I use graphicalViews modules in 1.2, do I need to copy some folders/files to the corresponding directory of the 2.0.3 ?
-
Hi Ray,
Note that in 2.0.3 the name of the database is madb
You will probably need to change this in the classes\env.properties file to the name of the older database (probably m2m2db). Hopefully that will allow the upgrade to work right.
Thanks,
Joel.