D365 Export Database from LCS UAT Or Production and Restore in the Dev Environment

 

Export database UAT or Production over LCS:

Login LCS with lcs.dynamics.com and enter your authorized credential for export UAT or Production database bacpac file.

Follow these steps to export and restore database over development machine:

Step I:

  • Go to LCS.
  • From sandbox Environment Details page, click the Maintain menu, and then select Move database.
  • Select the Export Database option.
  • Database will export as bacpac file to the Database backup option in the Asset Library.

Step II:

  • Check your Directory Path for SQLPackage.exe installer it may be over 150 or 140 folder it’s depends upon versions.

Step III:

Note:
  • Restore Database File is your Backup File.
  • SSProd your current name database you can change as per AXDBUAT
  • Paste your Downloaded bacpac file to known folder which you will redirect through CMD.
  • Run CMD as a administrator.
  • Cd C:/
  • cd Program Files (x86)\Microsoft SQL Server\150\DAC\bin
  • SqlPackage.exe /a:import /sf:J:\Exportedbacpac\RestoreDatabaseFile.bacpac /tsn:localhost /tdn:SSProd /p:CommandTimeout=50000 /ttsc:True
  • Importing to Database is starting Now.

 

Step IV:

Stop the services below:

  • World wide web publishing service
  • Batch Management service
  • Management reporter service.

 

 

Step V:

  • Rename the AxDB database to AxDBOld then rename SSProd database to AxDB.
  • If you are facing an error to rename AXDB manually then you can use below query:

USE master;

GO

ALTER DATABASE AxDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE

GO

ALTER DATABASE AxDB MODIFY NAME = AxDBOld ;

GO

ALTER DATABASE AxDBOld SET MULTI_USER

GO

 

Step VI:

  • Synchronization Database.

Thank You

Comments

Popular posts from this blog

Chain of Command & Event Handler (D365FO)