简体   繁体   English

加密存储过程时无法导出 SQL Azure 数据库

[英]Can't export SQL Azure database when stored procedure is encrypted

I want to export my SQL Azure database to a file test.bacpac , but I failed:我想将我的 SQL Azure 数据库导出到文件test.bacpac ,但我失败了:

One or more unsupported elements were found in the schema used as part of a data package.在用作数据 package 的一部分的架构中发现一个或多个不受支持的元素。
Error SQL71564: Error validating element [dbo].[IsMyUserExisted]: The element [dbo].[IsMyUserExisted] cannot be deployed as the script body is encrypted.错误 SQL71564:验证元素 [dbo].[IsMyUserExisted] 时出错:由于脚本主体已加密,因此无法部署元素 [dbo].[IsMyUserExisted]。

The question is, why can't I back up my database like in SQL Server 2008, 2017 etc (just backup database, and then restore database).问题是,为什么我不能像 SQL Server 2008、2017 等那样备份我的数据库(只需备份数据库,然后恢复数据库)。

   "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\SqlPackage.exe" /a:Export /ssn:"servername" /sdn:"databasename" /su:"username" /sp:"passwordhere" /tf:"myfile.bacpac" ExcludeObjectsTypes=StoredProcedures 

but the property ExcludeObjectsTypes=StoredProcedures is invalid但属性ExcludeObjectsTypes=StoredProcedures无效

I also tried "/p:ExcludeObjectsTypes=StoredProcedures" but still get an error.我也尝试了“/p:ExcludeObjectsTypes=StoredProcedures”,但仍然出现错误。

Azure SQL Database does not support the WITH ENCRYPTION option for migrating objects such as stored procedures, user defined functions, triggers, or views. Azure SQL 数据库不支持 WITH ENCRYPTION 选项来迁移对象,例如存储过程、用户定义的函数、触发器或视图。 Therefore, migrating objects compiled with that option is not possible.因此,无法迁移使用该选项编译的对象。 You will need to remove the WITH ENCRYPTION option.您将需要删除 WITH ENCRYPTION 选项。

It means that Azure SQL doesn't support export/migrate database which contains these encrypted object, we will always get the error like this:这意味着 Azure SQL 不支持导出/迁移包含这些加密 object 的数据库,我们总是会得到这样的错误: 在此处输入图像描述

You must unencrypt this procedure then backup the database.您必须取消加密此过程,然后备份数据库。 After the database restored, find this stored procedure and encrypt it again.数据库恢复后,找到这个存储过程,重新加密。

Please ref this blog: https://thomaslarock.com/2013/05/migrate-encrypted-procedures-azure-sql-database/请参考此博客: https://thomaslarock.com/2013/05/migrate-encrypted-procedures-azure-sql-database/

HTH. HTH。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM