Move the database from Dev to UAT or Tier1 to Tier2.
- Mostly, databases are moved from Tier 2 to Tier 1 environments.
- But in our case, most of the functional setup and configurations were completed in the Dev (Tier 1) environment, and the team needs this data to be moved to Sandbox (Tier 2).
- Since transactional data is involved, we cannot use Data Entities.
Therefore, we followed the process below:Step-by-Step Process to Move the Database from Dev (Tier 1) to UAT/Sandbox (Tier 2)
1. Export the AXDB from Dev (Tier 1) (.bak)
Export the AXDB database into a .bak file using one of the following methods:
Way1: Right-click on the AXDB database and Select Tasks > Back Up.
Way2: Use the following SQL script to back up the database:
BACKUP DATABASE [AXDB] TO DISK = N'D:\Backup\AxDB_Dev.bak' WITH NOFORMAT, INIT,
NAME = 'AxDB_Dev Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
2. Restore the Backup to a New Database
Use the Restore Database option in SSMS to restore the .bak file to a new database (AXDB_Dev).
3. Run Required SQL Scripts
Execute below SQL scripts in the newly restored database.
update sysglobalconfiguration
set value = 'SQLAZURE'
where name = 'BACKENDDB'
update sysglobalconfiguration
set value = 1
where name = 'TEMPTABLEINAXDB'
drop procedure XU_DisableEnableNonClusteredIndexes
drop schema [NT AUTHORITY\NETWORK SERVICE]
drop user [NT AUTHORITY\NETWORK SERVICE]
drop user axdbadmin
drop user axdeployuser
drop user axmrruntimeuser
drop user axretaildatasyncuser
drop user axretailruntimeuser
4. Export the Database to a .bacpac File
This is required to move the database to Tier 2 via LCS.
Way1:
- Right-click the restored database, Go to Tasks > Export Data-tier Application.
- Select a local folder and export the database as a .bacpac file
Export duration depends on database size

Way2 (Command Line): Use SqlPackage.exe to export the database to .bacpac.
- Ensure SqlPackage.exe is installed on your machine.
- Path will change for SqlPackage.exe, before executing the command please check the correct path
Run the following command (in CMD):
Cd C:\Program Files\Microsoft SQL Server\160\DAC\bin\SqlPackage.exe /a:export /ssn:localhost
/sdn:<database name to export> /tf:<File path> /p:CommandTimeout=1200
/p:VerifyFullTextDocumentTypesSupported=false /SourceTrustServerCertificate:True
I have used below command.
Cd C:\Program Files\Microsoft SQL Server\160\DAC\bin
"C:\Program Files\Microsoft SQL Server\160\DAC\bin\SqlPackage.exe" /a:export /ssn:localhost
/sdn:<database name to export> /tf:"D:\Test\AxDB_dev.bacpac" /p:CommandTimeout=1200
/p:VerifyFullTextDocumentTypesSupported=false /SourceTrustServerCertificate:True
5. Upload the .bacpac File to LCS
- Go to LCS > Asset Library > Database Backup
- Upload the .bacpac file
- Set the Backup Type as: Product Database (SQL Server or .bak)
6. Import Database into Tier 2 Environment
Go to the Tier 2 environment in LCS
- Click Maintain > Move database
- Select Import database
- Choose the uploaded .bacpac file from the asset library
- Complete the import wizard and confirm
The import process may take some time depending on database size.
7. Enable All Users
After the import is complete, connect to the new database using SSMS and run the following query.
update userinfo set enable = 1
Keep Daxing!!