restore MorphX Version control

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:

  • SYSVERSIONCONTROLMORPHXITE2541
  • SYSVERSIONCONTROLMORPHXLOC2542
  • SYSVERSIONCONTROLMORPHXREV2543
  • SYSVERSIONCONTROLPARAMETERS
  • SYSVERSIONCONTROLSYNCHRONI1982

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.

  1. Ax does not create the tables defined above on syncronization. The parameters for MorphX need to be turned on.
  2. 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
  3. Shut down the AOS to avoid any conflicts
  4. Import the data from the 5 tables defined above into the Ax database
  5. 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;
  6. After starting the AOS the version control should be restored

Comments

Popular posts from this blog

Running runnable class through URL in Dynamics 365 for Operations

D365FO Use of FileUpload control to Read CSV file

D365FO Send Report as email attachment