Friday, June 21, 2024

Importing a bacpac file to a development box SQL

 Just to memorize some steps to import a database from a bacpac file.

  1. Download and run the DacFramework.msi installer for Windows
  2. Put the backup.bacpac file close to the SQL database, say, in the root folder on disk G:
  3. Run the bat file. 

@echo Importing a bacpac data to SQL database
c:
cd C:\Program Files\Microsoft SQL Server\160\DAC\bin
SqlPackage.exe /a:import /sf:G:\backup.bacpac /tsn:localhost /tdn:AxDB_Restored /p:CommandTimeout=1200 /TargetTrustServerCertificate:True
pause

Take note about the last option: without it importing fails with the following error.