简体   繁体   English

使用bacpac导入数据层应用程序

[英]Import data tier application using bacpac

I had Export my Database backup from Azure DB in .bacpac form successfully, but when I'am going to import that .bacpac it will throw an error. 我已经成功从Azure DB以.bacpac格式导出数据库备份,但是当我要导入该.bacpac时,它将引发错误。

这是我导入.bacpac时遇到的错误

You probably had blob auditing enabled on your Azure SQL, right? 您可能在Azure SQL上启用了Blob审核,对吗?

Please have a look at this article: Exported database from Azure SQL failed to be imported to Azure SQL or to local SQL Server 请看一下本文: 从Azure SQL导出的数据库无法导入到Azure SQL或本地SQL Server

Taken from that article: 摘自该文章:

The cause: 原因:
This caused by a different behavior between Azure SQL DB and Local SQL Server installation 这是由于Azure SQL DB和本地SQL Server安装之间的行为不同引起的

a master key without password is an Azure SQL DB only feature, while local SQL Server installation must have password encryption for master key. 没有密码的主密钥是仅Azure SQL DB的功能,而本地SQL Server安装必须对主密钥进行密码加密。

Resolution: 解析度:

Option 1 选项1
to mitigate import to Azure SQL DB use the import from the Azure portal. 为了减轻导入Azure SQL DB的麻烦,请使用Azure门户中的导入。

to mitigate import to local SQL Server installation you can alter the existing master key and add password encryption to it. 为了减轻导入本地SQL Server安装的负担,您可以更改现有的主密钥并为其添加密码加密。

this should be done before you export the database 这应该在导出数据库之前完成

ALTER MASTER KEY ADD ENCRYPTION BY PASSWORD = '<PasswordHere>';

Option 2 for short term mitigation we provide you PowerShell script that do the following: 短期缓解的选项2 ,我们为您提供执行以下操作的PowerShell脚本:

remove the master key object from the bacpac 从bacpac中删除主密钥对象
remove the credential object from the bacpac 从bacpac中删除凭证对象

after running this PS script on the bacpac you will have new bacpac file with "patched" suffix. 在bacpac上运行此PS脚本后,您将拥有带有“ patched”后缀的新bacpac文件。

Before exporting your database as bacpac you need to do the following steps: 在将数据库导出为bacpac之前,您需要执行以下步骤:

  1. Disable Database Auditing if you have it enabled. 如果启用了数据库审核,请禁用它。
  2. Drop the database master key with DROP MASTER KEY command. 使用DROP MASTER KEY命令删除数据库主密钥。

After that export your database again and import it on your local SQL Server. 之后,再次导出数据库并将其导入本地SQL Server。

I successfully resolve this issue, first I execute CREATE MASTER KEY script in azure db instance, then export that Database. 我成功解决了此问题,首先在azure数据库实例中执行CREATE MASTER KEY脚本,然后导出该数据库。 And then import that database to local SQL server. 然后将该数据库导入本地SQL Server。

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

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