Moving Code Using Dynamics AX Temp Schema

by | Updated January 3, 2018 | Dynamics AX

The reason for moving code using Dynamics AX temp schema is because you do not have a large window for downtime. By using this method, you would eliminate the time you would normally take to import a modelstore. Check out this article for more information on, How to: Create, Drop, or Reinitialize a Model Store [AX 2012].

This is how you would use Temp Schema for Dynamics AX:

In your TARGET environment where you would like the TempSchema created, do the following steps:

Note: You must first drain the target AOS before creating a new schema.

1. In Management util, run the command to create a new schema called TempSchema:

Axutil schema /schemaname:TempSchema


Initialize-AXModelStore -SchemaName <NewSchema>

This will create a new schema against the database defined in your current active AX server configuration. Refer to this link for details

For example, my current active AX server configuration is pointing to MicrosoftDynamicsAX database. So my AX model db is MicrosoftDynamicsAX_Model

Dynamics AX Temp Schema

This is what the schema looks like before I ran the above axutil schema command – note: TempSchema does not exist.

The schema looks like before I ran the above axutil schema command

This is the command I ran to create the new schema called TempSchema:

This is the command I ran to create the new schema called TempSchema

When finished you will see the message ‘Model store schema successfully created.”

'Model store schema successfully created'

And in SQL management studio, on the MicrosoftDynamicsAX_model > Schemas, you will now see the new schema called TempSchema.

You will now see the new schema called TempSchema.

you will now see the new schema called TempSchema.

you will now see the new schema called TempSchema.

2. Next import the modelstorefile (this is the modelstore file you exported from the server with the changed/updated AX code) to the temporay schema.

You would do this on your TARGET environment at the same time when you are importing your modelstore to your TEST environment.

So, in management utilities on the AOS server of your Target environment run this command:

axutil importstore /file:modelstorefile.axmodelstore /schemaname:TempSchema /verbose


Import-AXModelStore -File modelstorefile.axmodelstore -SchemaName TempSchema

The model store that you import to the non-default schema is not visible to Microsoft Dynamics AX.

This will cause the model db at the target to increase in size. So make sure you have enough disk space.

This is what I did as a test –


My model db size was around 8GB. After the importstore, the size was 14GB. Model log file size increased by about 3GB. These sizes may be different on your environment depending of how much code you have.

3. When you are ready to make the code in the TempSchema visible to AX (ie. Move to the dbo schema), you would do the following:

a. Drain the AOS, have all users logout of AX.
b. Shut down the AOSs and other services used by your Dynamics AX like Management reporter.
c. Clear the content in server\xppil folder for all the AOSs (:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL)
d. When steps above are completed, run the following command in axutil –

axutil importstore /apply:TempSchema /verbose


Import-AXModelStore -Apply:TempSchema

This is what I did as a test –


It completed in about 5 seconds.

completed in about 5 seconds

In SQL management studio, if you now look at the tables under the AX_model database, you will notice the tempSchema.tablenames are no longer there. Only dbo.tablesnames exist now. Same as in programmability node in the AX_model database. TempSchema still exist as a schema under AX_Model> Security> Schema.

Notice the tempSchema.tablenames are no longer there.

e. Start up 1 AOS, run synchronize
f. When synchronize is completed, deploy reports etc (follow the normal process you would do for moving code from one environment to another using the import modelstore method).

4. You may use the following commands to remove the temporary or nondbo schema:

axutil schema /drop:TempSchema


Initialize-AXModelStore –Drop TempSchema

Related Posts

  • Over on the AX Support site on MSDN, Daniel Durrer has taken the time to keep tabs on the latest builds for Microsoft Dynamics AX 4.0, 2009 and 2012.  I…

  • While attempting to create a Transfer Order with the InventInventoryTransferOrderCreateService you may encounter an error similar to this: The element 'InvTransTable' in namespace '' has invalid child element 'InventLocationIdTransit' in…

  • I recently came across an issue in Dynamics AX when creating a new payroll tax transition from the Tax transaction history detail inquiry. The Dynamics AX error stated: Field Tax…


Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events


06oct10:00 am10:30 amPreview of D365 Business Central Fall Release Features and Functionality

06oct12:00 pm12:30 pmInsider's Guide to New Features Available in the Fall Release of D365 Finance and Supply Chain

07oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Technical

13oct12:00 pm12:30 pmWave 2 Release – What’s Coming for Dynamics 365 Sales and Customer Service

21oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Functional

26oct(oct 26)9:00 am28(oct 28)5:00 pmStoneridge Connect Leadership and Community Conference


04nov11:00 am12:00 pmConfab LIVE with Stoneridge - Challenging the Development Paradigm

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!