When an Ax environment is setup for version control with MorphX, there are times when the database needs to be restored, or another database is required to be used instead. This causes the loss of all version control data. Ax has some standard tables where it stores all this data which can be backed up and restored.
The tables used by Ax for MorphX version control are:
However due to certain Ax frameworks its just not a straight copy.
The Backup procedure:
In this procedure, i create an SSIS task and add it to a Job that runs nightly backing up data from the tables specified above to a seperate database, which is then completely backed up. This is a simple “export data” functionality within SQL, and saved in the SSIS and attached to a job.
The restore procedure:
This is where a similar export data from the backup database is done to the Ax database. There are a couple of things that need to be done before importing the data. Assuming that a different database has been restored, and Ax is compiled and syncronized.
- Ax does not create the tables defined above on syncronization. The parameters for MorphX need to be turned on.
- After setting up MorphX version control, go to Tools –> Development tools –> Version Control –> Setup –> System Settings –> click Ok.
This creates the version control XML file definition and checks it out (Resources\SysVersionControlSystemMorphXDefFile). Check this file in and we are ready to
- Shut down the AOS to avoid any conflicts
- Import the data from the 5 tables defined above into the Ax database
- Now this is where we need to reset the record Id’s of Ax. To do so open SQL and run the following commands on the Ax database
Update systemSequences Set nextval = (select max(RecId) + 1 from SYSVERSIONCONTROLMORPHXREV2543) Where tabid = 2543;
Update systemSequences Set nextval = (select max(RecId) + 1 from SYSVERSIONCONTROLMORPHXITE2541) Where tabid = 2541;
- After starting the AOS the version control should be restored
Update 26/10/2015: For 2012 application the table names are used in full and not terminated by the string limit