Azure SQL Server BACPAC导入失败

Dee*_*mar 4 sql-server bacpac azure-sql-server

每当我尝试在本地sql服务器上导入BACPAC时,我都会收到以下错误消息:

TITLE: Microsoft SQL Server Management Studio
------------------------------

Could not import package.
Warning SQL0: The source contains users that rely on an external authentication provider that is not supported by the target. These users will be treated as users without logins.
Warning SQL72012: The object [DB_NAME_Data] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Warning SQL72012: The object [DB_NAME_Log] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Error SQL72014: .Net SqlClient Data Provider: Msg 33161, Level 15, State 1, Line 1 Database master keys without password are not supported in this version of SQL Server.
Error SQL72045: Script execution error.  The executed script:
CREATE MASTER KEY;


 (Microsoft.SqlServer.Dac)

------------------------------
BUTTONS:

OK
------------------------------
Run Code Online (Sandbox Code Playgroud)

先前报告的所有关于SO的问题都与此不同。有人遇到过同样的问题吗?

Sad*_*deh 8

尝试针对您的master数据库运行此操作(右键单击 SSMS 中的服务器名称 -> 新查询)

sp_configure 'contained database authentication', 1;
GO 
RECONFIGURE;
GO
Run Code Online (Sandbox Code Playgroud)

在此之后,您可以再次通过导入 bacpac 向导,问题应该得到解决。


Dee*_*mar 6

最终,我能够按照此处建议的选项2解决此问题

简而言之,

  1. 此处保存实用程序RemoveMasterKeyFrombacpac
  2. 运行命令 .\RemoveMasterKey.ps1 -bacpacPath "C:\BacPacs\fileName.bacpac"

完成上述命令后,我们将获得-patched bacpac,它可以无缝导入。

更新资料

使用新的MS SQL Server 2016(13.0.1745.2)和SSMS v17.6不再是问题。

  • 这效果很好。我有 SSMS v18.6 并且需要运行此脚本。 (2认同)