Use data db with a new model db

I was trying to find a simple and efficient way to actually get one instance data database to work together with anther instance's model database. Of course, one thing to remember, the models installed on the two instances were 99% identical (I'm saying 99% because one might have received several new object with the higher models imported).

So, the approach, instead of trying to fix the IDs in one instance's SQLDictionary according to the other one's AOT IDs, or something in that area, I took a more direct approach (here I'm keeping the _a data and will use the _b model):

truncate table MicrosoftDynamicsAX_a.dbo.SQLDICTIONARY
insert into MicrosoftDynamicsAX_A.dbo.SQLDICTIONARY
    select * from MicrosoftDynamicsAX_b.dbo.SQLDICTIONARY
Alright, as you can see I'm overwriting the IDs in the database to keep with the ones coming from the model. However, for this trick to work I did some preparation in advanced, which is:

run this t-sql first and perform a full Data Dictionary synchronize on the instance B (from where you are taking the model) - this will prepare all the tables/fields in the database according to your license configuration (a note: I am assuming you are having the same license file loaded)

truncate table MicrosoftDynamicsAX_b.dbo.SYSCONFIG
insert into MicrosoftDynamicsAX_b.dbo.SYSCONFIG
    select * from MicrosoftDynamicsAX_a.dbo.SYSCONFIG


So, at the end of this exercise, after running Data Dictionary sync on your A instance you should obtain what you were looking for (it might take too DD syncs if there are indexes that initially will error out; also, you might have some index violations which you have to resolve for yourself).

2 comments:

  1. That could still make problems.
    On some settings you set/select classes for example -> get saved by id in data db fields

    greetings

    ReplyDelete
    Replies
    1. Hi Rene,

      Yes, I completely agree with you, the method outlined above is not error free (one reason would be exactly the one you mentioned, but others could be listed) and also I would not used it in a PROD or in some cases even on a TEST instance ... however, there are times when you just need to clone a TEST instance over a DEV or maybe move somehow the data between two TEST instances: this is because you want to preserve the data (and I underline the word preserve in this sentence) while keeping the model database from the second instance. I have not played enough with the Transfer data tool, which might work, but I needed a fast solution, so this was the only one. It worked quite ok.

      I have however performed another step, which I didn't get the time to mention, that is also move the SystemSequences records from one instance to the other, so that the RecIds are not causing issues.

      Delete