·
3 min read

Steps to Restore an AX Database

In support we ask customers for backups of their databases to investigate issues that do not occur in the demo data.  We usually also request a copy of their application files so the code files match the database.  Below are the steps I take to get the database backup and application files in a working state in my environment.

Pre-requisites
In my existing environment I have a running instance of AX 2009 that is on sp1.  If the customer is on AX 2009 I assume the customer is on sp1 since most are.  The AOS, SQL server and AX client are all on the same machine.  The AOS service under Start > Control Panel > Administrative Tools > Services is started and runs under my domain account.  In the AX application my domain account is the Admin account under Administration > Users.

Prepare the Database
-Create a new database in SQL and restore the backup from the customer into it.
-In SQL in the newly restored database go to Security > Users.  Right-click on Users and choose new user.  Add the user account that runs the AOS service.  For me, this is my domain account.
-In the middle of this user form, under Owned Schemas mark db_owner.
-Still in the same form where you added the user, under Database role membership mark db_datareader, db_datawriter, and db_owner.
-In SQL in the newly restored database go to Programmability > Stored Procedures and right-click on CreateServerSessions and choose Properties.
-Click Permissions and click the Search button.  Find the account you just added to the database as a user, for me this is my domain account.
-In the bottom of this form under the Grant column mark all of the choices.
-In SQL in the newly restored database go to Programmability > Stored Procedures and right-click on CreateUserSessions and choose Properties.
-Click Permissions and click the Search button.  Find the account you just added to the database as a user, for me this is my domain account.
-In the bottom of this form under the Grant column mark all of the choices.
-In SQL click the New Query button.
-Choose your EXISTING AX database – so not the customer’s database you just restored but the AX database you have with demo data in it, run the following query:
select SID, NETWORKDOMAIN, NETWORKALIAS, * from UserInfo where Id = ‘Admin’
-Click the New Query button and choose the CUSTOMER’s database.  Leave your existing query against your own database open.  We are going to use the results in our next query.
-In the New Query against the customer’s database run the following:
update USERINFO set SID = ‘SID field from previous query’, NETWORKDOMAIN = ‘NETWORKDOMAIN field from previous query’, NETWORKALIAS = ‘NETWORKALIAS field from previous query’
where ID = ‘Admin’ –The idea here is you want to grab the SID, NETWORKDOMAIN and NETWORKALIAS values from your own UserInfo table and update the customer’s UserInfo table with your user information so you can log into their database.

Prepare the Application Files
-When you install if you choose the default paths the Application files are stored at this location “C:\Program Files\Microsoft Dynamics AX\50\Application\Appl”.  Take the copy of the customer’s application folder and copy it to this location.   When it finishes copying you should have your existing application folder and the customer’s application folder sitting side-by-side inside the Appl directory.
-Go into the copied application folder and find the file named axapd.aoi and rename it.

Create a New Server Configuration
-Go to Start > Control Panel > Administrative Tools > Microsoft Dynamics AX 2009 Server Configuration and open the server configuration utility.
-In this utility click Manage > Create configuration and give the new configuration a name.
-In the new configuration under the Application Object Server tab find the Application instance dropdown and click it.  If the customer’s application files are restored correctly you should see the customer’s folder in this list, pick it.
-Under the Database Connection tab click the Database name dropdown.  If the customer’s database has been restored you should see the name of that database in the list, pick it.
-Click OK and it should prompt you to restart the AOS, choose Yes.  This will restart the AOS with your AX install pointing to the customer’s database and application files.  Since we renamed the axapd.aoi file the AOS service will take a while to start.  You can go into Control Panel > Administrative Tools > Services and find the Dynamics AX AOS service.  It will likely be in a Starting state as it rebuilds the axapd.aoi file.  Wait for it to change to a Started state.

Test the Environment
-Launch AX to verify you can get in.  Be aware of the company you are logged into when trying to recreate an issue as customer’s tend to have a lot more companies than the demo data.