将WideWorldImportersDW-Standard.bacpac导入Azure Data Studio 1.32时遇文件激活错误的技术求助
I’ve run into this exact issue before when importing bacpac files with custom filegroups—your error stems from SQL Server being unable to resolve or create the data file path specified in the bacpac’s deployment script. Let’s walk through actionable fixes step by step:
1. Manually Override Data/Log File Paths (Quickest Solution)
The Azure Data Studio wizard’s default variable substitution ($(DefaultDataPath), $(DefaultFilePrefix)) isn’t working as expected here. Here’s how to fix it:
- Restart the Data-tier Application Wizard and proceed to the Database Settings step.
- Expand the Filegroups section, then locate the
USERDATA_B694BC2entry under theUSERDATAfilegroup. - Replace the auto-generated
FILENAMEvalue (like$(DefaultDataPath)$(DefaultFilePrefix)_USERDATA_B694BC2.mdf) with a concrete, accessible path for your SQL Server instance. For example:C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\WideWorldImportersDW_USERDATA_B694BC2.mdf - Repeat this adjustment for the corresponding
.ldflog file entry under the same filegroup. - Complete the wizard and retry the import.
2. Verify SQL Server Service Account Permissions
If manual pathing doesn’t resolve the issue, your SQL Server service account might lack write access to the target directory:
- Open Server Properties in Azure Data Studio (right-click your server → Properties).
- Navigate to the Database Settings tab and note the default data/log paths.
- Go to that folder in File Explorer, right-click → Properties → Security.
- Add the SQL Server service account (usually
NT SERVICE\MSSQLSERVERfor default instances) and grant it Modify and Write permissions. - Restart the SQL Server service and try the import again.
3. Use sqlpackage.exe for Greater Control
The Azure Data Studio wizard can be finicky with variable substitution—using the command-line sqlpackage.exe tool often avoids these pitfalls:
- Locate
sqlpackage.exe(typically inC:\Program Files\Microsoft SQL Server\150\DAC\bin; adjust the version number to match your SQL Server installation). - Run this command, replacing placeholders with your actual paths:
sqlpackage.exe /Action:Import ^ /SourceFile:"C:\Your\Download\Path\WideWorldImportersDW-Standard.bacpac" ^ /TargetConnectionString:"Server=.;Database=WideWorldImportersDW;Trusted_Connection=True;" ^ /p:DefaultDataPath="C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\" ^ /p:DefaultLogPath="C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\" - This forces explicit path substitution, bypassing the wizard’s variable handling issues.
4. Ensure the Bacpac File Is Uncorrupted
Occasionally, a partial or corrupted download can trigger this error:
- Re-download the bacpac file to rule out corruption.
- Verify integrity by opening the bacpac (it’s a ZIP file) and confirming the
model.xmlfile inside is intact and contains valid filegroup configurations.
内容的提问来源于stack exchange,提问作者GlaceCelery

