{"id":403,"date":"2015-09-04T05:54:21","date_gmt":"2015-09-04T05:54:21","guid":{"rendered":"http:\/\/www.exploreax.com\/blog\/?p=403"},"modified":"2015-09-08T06:44:15","modified_gmt":"2015-09-08T06:44:15","slug":"ax-db-restore-scripts-3-configure-ax-servers-and-batch-servers","status":"publish","type":"post","link":"http:\/\/www.exploreax.com\/blog\/blog\/2015\/09\/04\/ax-db-restore-scripts-3-configure-ax-servers-and-batch-servers\/","title":{"rendered":"AX DB Restore Scripts #3 &#8211; Configure AX servers and batch servers"},"content":{"rendered":"<p>Earlier this week\u00a0I embarked on a<a href=\"http:\/\/www.exploreax.com\/blog\/blog\/2015\/09\/01\/ax-database-restore-scripts-list\/\"> series of posts<\/a> on DB restore scripts for Dynamics AX by providing a <a href=\"http:\/\/www.exploreax.com\/blog\/blog\/2015\/09\/01\/ax-database-restore-scripts-list\/\">list <\/a>of data entities in your AX database\u00a0that need to\u00a0be updated when restoring a database from a production environment to a development or QA one.<\/p>\n<p>Today I will be\u00a0drilling into how to reset\/configure your <strong>AX AOS\u00a0and batch AOS\u00a0configurations<\/strong> via DB scripts. These scripts are necessary especially for the <a href=\"http:\/\/www.exploreax.com\/blog\/blog\/2015\/09\/02\/ax-db-restore-scripts-1-ssrs-servers\/\">SSRS script<\/a>\u00a0and for the batch server update script (available soon) as these rely on a correct AOS configuration.<\/p>\n<p><em> 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&#8217;t be pointing to it, but rather the old settings that are not cleared. Thus I prefer to fix this in my script.<\/em><\/p>\n<p>In the Dynamics AX 2012 client these configurations are located\u00a0under System Administration -&gt; Setup -&gt; System -&gt; Server Configuration<\/p>\n<p><a href=\"http:\/\/www.exploreax.com\/blog\/wp-content\/uploads\/2015\/09\/AOS_servers.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-405\" src=\"http:\/\/www.exploreax.com\/blog\/wp-content\/uploads\/2015\/09\/AOS_servers-300x153.png\" alt=\"AOS_servers\" width=\"300\" height=\"153\" srcset=\"http:\/\/www.exploreax.com\/blog\/wp-content\/uploads\/2015\/09\/AOS_servers-300x153.png 300w, http:\/\/www.exploreax.com\/blog\/wp-content\/uploads\/2015\/09\/AOS_servers.png 973w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Depending on the configuration of your source system (e.g. Production) you may have multiple AOSs\u00a0setup here and typically your destination may\u00a0only have a single AOS configuration\u00a0therefore your script would need to do the following:<\/p>\n<p>1. Remove all but one of the AOS\u00a0configurations<br \/>\n2. Update the server details of the remaining configuration<br \/>\n3. Enable the remaining server as the &#8220;batch&#8221; server.<\/p>\n<p>The following SQL code will accomplish the above. I have parameterised the SQL for easier reuse or adjustment.<\/p>\n<pre class=\"lang:mysql decode:true\"> --Reuse the parameter declared for the SSRS update script\r\nDeclare @AOS varchar(30) =  '[AOSID]' -- Must be in the format '01@SEVERNAME'\r\n\r\n-- Clear out all but one server config.\r\ndelete from SYSSERVERCONFIG where RecId not in (select min(recId) from SYSSERVERCONFIG)\r\n-- Update the remaining one to point to your current AOS and enable it for batch processing\r\nupdate SYSSERVERCONFIG set serverid=@AOS, ENABLEBATCH=1 \r\nwhere serverid != @AOS -- Optional if you want to see the \"affected row count\" after execution.\r\n<\/pre>\n<p>Note: These changes assume everything is setup correctly on the SSAS server itself.<\/p>\n<p><a href=\"http:\/\/www.exploreax.com\/blog\/wp-content\/uploads\/2015\/09\/2015-09-03_0751.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-394\" src=\"http:\/\/www.exploreax.com\/blog\/wp-content\/uploads\/2015\/09\/2015-09-03_0751.png\" alt=\"2015-09-03_0751\" width=\"262\" height=\"212\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.exploreax.com\/blog\/blog\/2015\/09\/08\/ax-db-restore-scripts-4-reconfigure-batch-jobs\/\">View Next &#8211;\u00a0AX DB Restore Scripts #4 \u2013 Reconfigure batch jobs<\/a><\/p>\n<p><a href=\"http:\/\/www.exploreax.com\/blog\/blog\/2015\/09\/03\/ax-db-restore-scripts-2-ssas-servers\/\">View Previous &#8211; AX DB Restore Scripts #2\u00a0\u2013 SSAS Servers<\/a><\/p>\n<p><a href=\"http:\/\/www.exploreax.com\/blog\/blog\/2015\/09\/01\/ax-database-restore-scripts-list\/\">Back to List<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier this week\u00a0I embarked on a series of posts on DB restore scripts for Dynamics AX by providing a list of data entities in your AX database\u00a0that need to\u00a0be updated when restoring a database from a production environment to a development or QA one. Today I will be\u00a0drilling into how to reset\/configure your AX AOS\u00a0and&hellip;<a href=\"http:\/\/www.exploreax.com\/blog\/blog\/2015\/09\/04\/ax-db-restore-scripts-3-configure-ax-servers-and-batch-servers\/\">Read more <span class=\"screen-reader-text\">AX DB Restore Scripts #3 &#8211; Configure AX servers and batch servers<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/posts\/403"}],"collection":[{"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/comments?post=403"}],"version-history":[{"count":3,"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/posts\/403\/revisions"}],"predecessor-version":[{"id":419,"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/posts\/403\/revisions\/419"}],"wp:attachment":[{"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/media?parent=403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/categories?post=403"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.exploreax.com\/blog\/wp-json\/wp\/v2\/tags?post=403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}