Vasily already described different types of moving DBs (SQL baks and Bacpac files) for tier1 and tier2 in his earlier article here
Restore/move D365 database
Here you can find a specific case for BACPAC files within tier1 using Powershell commands below (in
Bold):
- Open PowerShell as Administrator:
If you do not have d356.fo tools installed, first run:
Install-Module -Name d365fo.tools
Invoke-D365InstallSqlPackage
- Restore BackPack file:
Import-D365Bacpac -ImportModeTier1 -BacPacFile "C:/Temp/
NewAxDB.bacpac
" -NewDatabaseName "
AxDB_new
" -showOriginalProgress
This process can take up to 2 hours so be patient.
-
Stop your D365FO services so no active connections are locking your current AxDB:
Stop-D365Environment
Open IIS manager
/ Application Pools / AOSService / Stop.
If you have open Visual Studio, also quit
IISExpress
- right click its icon in the tray (screen bottom left corner, usually inside
^ group) and click Exit.
-
Switch databases:
Switch-D365ActiveDatabase -SourceDatabaseName "
AxDB_new" -DestinationSuffix "
_old"
Where "
_old" is postfix for previously used AxDB so it will be renamed to
AxDB_old.
AxDB
is now new active database.
-
Start your D365FO services:
Start-D365Environment
Open IIS manager
/ Application Pools / AOSService / start
Close all Visual Studio instances. Re-open Visual Studio.
In VS go to Extensions > Dynamics 365 > Synchronize database