Tuesday, 5 March 2024

Step-by-Step Guide to Restore a SQL BACPAC File - Microsoft dynamics D365 Fin & Ops

 Restore steps for bacpac file in to SQL server - Microsoft dynamics D365 Fin & Ops.


Log in to LCS and navigate to the asset library. Once there, select the latest database backup file. Click on "Generate SAS link" to obtain a randomly generated URL.

Proceed to the VM and paste the SAS link into the web browser. This action will initiate an automatic download Bacpac file.

After downloading, rename the file and store it in a separate folder.

Stop the all Microsoft Dynamics-related services

Open the command prompt as an administrator and navigate to the directory by entering: "cd C:\Program Files\Microsoft SQL Server\160\DAC\bin".

Replace the URL, file name, and new database name in the following script, then execute it in the command prompt:

"SqlPackage.exe /a:import /sf:I:\Bacpac\backupfilename.bacpac /tsn:localhost /tdn:AxDBNew /p:CommandTimeout=50000 /ttsc:True"

Once done all the above steps and successfully imported need to do alter database, below script for alter database.

USE master; 
GO 
ALTER DATABASE AxDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE; 
GO 
ALTER DATABASE AxDBNew MODIFY NAME = AxDB; 
GO 
ALTER DATABASE AxDB SET MULTI_USER; 
GO

Below script used for enabling user


UPDATE USERINFO
SET USERINFO.ENABLE = 1
FROM USERINFO 
WHERE ID = 'username'




No comments:

Post a Comment

Step-by-Step Guide to Restore a SQL BACPAC File - Microsoft dynamics D365 Fin & Ops

 Restore steps for bacpac file in to SQL server - Microsoft dynamics D365 Fin & Ops. Log in to LCS and navigate to the asset library. On...