Earlier this week I embarked on a series of posts on DB restore scripts for Dynamics AX by providing a list of data entities in your AX database that need to be updated when restoring a database from a production environment to a development or QA one.
Today I will be drilling into how to reset/configure your AX AOS and batch AOS configurations via DB scripts. These scripts are necessary especially for the SSRS script and for the batch server update script (available soon) as these rely on a correct AOS configuration.
Note: Under normal circumstances a new configuration for your AOS will automatically be created if it does not exist when the AOS starts up after a restore, however all your other configs like batch jobs, SSRS settings etc won’t be pointing to it, but rather the old settings that are not cleared. Thus I prefer to fix this in my script.
In the Dynamics AX 2012 client these configurations are located under System Administration -> Setup -> System -> Server Configuration
Depending on the configuration of your source system (e.g. Production) you may have multiple AOSs setup here and typically your destination may only have a single AOS configuration therefore your script would need to do the following:
1. Remove all but one of the AOS configurations
2. Update the server details of the remaining configuration
3. Enable the remaining server as the “batch” server.
The following SQL code will accomplish the above. I have parameterised the SQL for easier reuse or adjustment.
--Reuse the parameter declared for the SSRS update script Declare @AOS varchar(30) = '[AOSID]' -- Must be in the format '01@SEVERNAME' -- Clear out all but one server config. delete from SYSSERVERCONFIG where RecId not in (select min(recId) from SYSSERVERCONFIG) -- Update the remaining one to point to your current AOS and enable it for batch processing update SYSSERVERCONFIG set serverid=@AOS, ENABLEBATCH=1 where serverid != @AOS -- Optional if you want to see the "affected row count" after execution.
Note: These changes assume everything is setup correctly on the SSAS server itself.
View Next – AX DB Restore Scripts #4 – Reconfigure batch jobs