"您只能在包含的数据库中创建具有密码的用户。"从SQLAZure

时间:2017-06-09 19:25:16

标签: azure-sql-database

我有一个从我尝试导入到本地SQL Server实例的Azure SQL实例生成的.bacpac文件。 我正在使用“导入数据层应用程序”向导,但收到以下错误:

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

Could not import package.
Warning SQL72012: The object [Backup_20170609-184846_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 [Backup_20170609-184846_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 33233, Level 16, State 1, Line 1 You can only create a user with a password in a contained database.
Error SQL72045: Script execution error.  The executed script:
CREATE USER [JOB_ENTRY_MANAGER]
    WITH PASSWORD = N'balh';


 (Microsoft.SqlServer.Dac)

向导中没有任何选项,但看起来我需要打开一些东西?

我已经读过我需要运行以下内容,但我只能针对Master运行它(因为目标数据库不存在)

EXEC sp_configure 'contained', 1; RECONFIGURE;

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

这是一个已在SSMS的最新版本中修复的错误......

如果您没有使用最新版本的SSMS,则需要先运行此脚本

sp_configure 'contained database authentication', 1;
GO
RECONFIGURE;
GO

以下是连接项目,其中包含更多详细信息:
https://connect.microsoft.com/SQLServer/feedback/details/1274164/error-when-importing-azure-bacpac-as-contained-database

link has few more details on approaches used,如果您没有使用最新版本的SSMS

  

当我从本地包含数据库编辑bacpac时,我找到了这个属性:

     

但bacpac azure DB导出中缺少此属性。

     

将model.xml编辑到bacpac后,生成一个新的Checksum,数据库导入成功完成!! :)