Friday, August 26, 2022

Restore/Import Database with RETAIL functionality

 Restoring a Dynamics 365 finops database has become much easier with the export database functionality in LCS. More details here

 

With the new feature in LCS the database is exported out of Azure SQL and a bacpac file is added to the asset library

image

image

After the database is exported the database file can be seen in the Asset library.

image

The following steps can be used to import the database to development environment for Retail testing/debugging

 

1) Restore the bacpac file

 

SqlPackage.exe /a:import /sf:D:\EXPORTED-DB.bacpac /tsn:localhost /tdn:AxDB_Copy /p:CommandTimeout=1200

 

2) Stop the world wide publishing service, Batch, DIXF and management reporter service

 

3) Rename the original database to AXDB_Orig and database imported to AxDB

 

4) Start the services stopped in step2.

 

5) In the imported database the change tracking will automatically be turned off at database level. Enable change tracking on AxDB. This can be easily done from database properties in a Tier 1 environment.

 

Note-For retail after running the initialize retail scheduler the change tracking details are updated(This is done in step 9).

 

6)  Please run build and database sync. Ensure there are no errors

 

7)  Run the below script to add users. This script is needed for running the environment retarget tool. If the users already exist in the database you can ignore the errors when running the script.

 

CREATE USER [axdbadmin] FOR LOGIN [axdbadmin]

CREATE USER [axdeployuser] FOR LOGIN [axdeployuser]

CREATE USER [axmrruntimeuser] FOR LOGIN [axmrruntimeuser]

CREATE USER [NT AUTHORITY\NETWORK SERVICE] FOR LOGIN [NT AUTHORITY\NETWORK SERVICE]

CREATE USER [axretaildatasyncuser] FOR LOGIN [axretaildatasyncuser]

CREATE USER [axretailruntimeuser] FOR LOGIN [axretailruntimeuser]

 

ALTER ROLE [db_owner] ADD MEMBER [axdbadmin]

ALTER ROLE [db_owner] ADD MEMBER [axdeployuser]

ALTER ROLE [db_datareader] ADD MEMBER [axmrruntimeuser]

ALTER ROLE [db_datawriter] ADD MEMBER [axmrruntimeuser]

ALTER ROLE [db_datareader] ADD MEMBER [NT AUTHORITY\NETWORK SERVICE]

ALTER ROLE [db_datawriter] ADD MEMBER [NT AUTHORITY\NETWORK SERVICE]

ALTER ROLE [db_ddladmin] ADD MEMBER [NT AUTHORITY\NETWORK SERVICE]

ALTER ROLE [DataSyncUsersRole] ADD MEMBER [axretaildatasyncuser]

ALTER ROLE [ReportUsersRole] ADD MEMBER [axretailruntimeuser]

ALTER ROLE [UsersRole] ADD MEMBER [axretailruntimeuser]

 

8) Run the environment retarget tool from LCS.

In your project's Asset Library, in the Software deployable packages section, click Import.

From the list of shared assets, select the Environment retarget Tool.

On the Environment details page for your target environment, select Maintain > Apply updates.

Select the Environment retarget tool that you uploaded earlier, and then select Apply to apply the package.

Monitor the progress of the package deployment.

 

9) Initialize the retail scheduler with delete existing configuration data marked as yes. Delete existing configuration “yes” will delete the existing retail change tracking configuration and create the base change tracking configuration for sync jobs again. Also, it updates any new mapping from the resource files.

 

Retail > Headquarters setup > Retail scheduler >Initialize retail scheduler

 

10) Update the identity providers to point to your tenant.

 

Retail > Headquarters setup > parameters > Retail shared parameters

 

11) Update the identity on worker. The identity on worker is required for device activation. 

https://docs.microsoft.com/en-us/dynamics365/unified-operations/retail/retail-modern-pos-device-activation

  

12)   Run the 9999 sync job to Sync all data with channel db

No comments:

Post a Comment