Wednesday, August 19, 2015

How to promote entire Microsoft Dynamics AX 2012 R2 Code Base (MSSQL VS AXUtil VS Powershell)

The following will walk you thru multiple ways to export and import a code base from one aos to another.

 Microsoft recommends option 2 or 3. But option 2 utilizes powershell which Microsoft has been pushing so this is probably the best route.
All methods below goes under the assumption that a clean compile has just occurred on the source that you are exporting from.

Related: How to copy data from one Microsoft Dynamics AX 2012 R2 AOS to another (MSSQL VS Test Data Transfer Tool (TDTT))

Export Code

o   Option 1 (MSSQL Server):
§  Stop AOS
§  Make backup of database from within MSSQL management studio
§  Be sure to compress the db! (via software method)
o   Option 2 (AOS Server):  Microsoft Dynamics AX Management Shell (Control Panel > Admin Tools)
§  Export-AXModel –Model <name> -File <Filename.axmodel>
·       Example: Export-AXModel –Model “CUS Model” –File Cus073115.axmodel
o   Option 3 (AOS Server): AXUtil
§  CMD.EXE > CD  %ProgramFiles%\Microsoft Dynamics AX\60\ManagementUtilities
§  CMD.EXE > axutil export /model:<Modelname> /file:<filename> /verbose
·       Example: axutil export /model:”CUS Model” /file:Cus073115


 

Import Code

o   Option 1 (MSSQL Server): Restore Database

§  Settings (General): Override old db name with the db you want to restore to
§  Settings (Files): Change file name under “restore as” to the db you want import to.
§  Settings (Options): Overwrite the existing database (WITH REPLACE) should be checked
§  Start AOS
§  Run full compile via client side (long compile)
·       Since the DB is different it’s better to do this on the client to make sure no errors exist
§  Sync Data Dictionary (makes sure table indexes are good to go)
§  Full CIL
§  Deploy ALL reports
o   Option 2 (AOS Server):  Microsoft Dynamics AX Management Shell (Control Panel > Admin Tools)
§  Install-AXModel –File <Filename.axmodel> -Details
·       Example: Install-AXModel –File Cus073115.axmodel –Details
§  Sync Data Dictionary (makes sure table indexes are good to go)
§  Full CIL
§  *It’s good to note that a full compile is not necessary but it won’t hurt anything
§  You can run server side compile (quick)
·       CMD.EXE (As Admin) > cd C:\Program Files\Microsoft Dynamics AX\60\Server\AX_TEST_01\bin
·       CMD.EXE > axbuild.exe  xppcompileall  /s=01 /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin"
§  Deploy ALL reports
§  You may need to run the note at the bottom of this list as well
§  To re-index the model if need be: axutil optimize /config:ax_configuration_utility_instance_name
o   Option 3 (AOS Server): AXUtil
§  CMD.EXE > CD  %ProgramFiles%\Microsoft Dynamics AX\60\ManagementUtilities
§  CMD.EXE > axutil import /file:<filename> /verbose
·       Exmple: axutil /file:Cus073115 /verbose
§  Sync Data Dictionary (makes sure table indexes are good to go)
§  Full CIL
§  *It’s good to note that a full compile is not necessary but it won’t hurt anything
§  You can run server side compile (quick)
·       CMD.EXE (As Admin) > cd C:\Program Files\Microsoft Dynamics AX\60\Server\AX_TEST_01\bin
·       CMD.EXE > axbuild.exe  xppcompileall  /s=01 /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin"
§  Deploy ALL reports
§  You may need to run the note at the bottom of this list as well
§  To re-index the model if need be: axutil optimize /config:ax_configuration_utility_instance_name

 

Note: You may need to do the following if you have a clean code base but can’t get a clean cil

·       Stop all AOS instances
·       Delete all files on the AOS server under C:\Program Files\Microsoft Dynamics AX\60\Server\<aos instance name>\bin\XppIL
·       Connect to the model db via SQL Management studio
·       Truncate the table SYSXPPASSEMBLY which lists all of the files found in step 2
·       You can do this via the command: TRUNCATE TABLE SYSXPPASSEMBLY
·       Start 1 AOS instance if running under a cluster
·       Run Full CIL
·       Start remaining AOS instances

No comments:

Post a Comment