简体   繁体   English

数据层导出到BacPac失败

[英]Data Tier Export to BacPac Fail

I need to export an entire SQL Server database - schema, tables, data etc and trying to use the following method. 我需要导出整个SQL Server数据库-架构,表,数据等,并尝试使用以下方法。

Login to SSMS with admin credentials, locate relevant database, right click on database, select Tasks >> Export Data-tier Application. 使用管理员凭据登录到SSMS,找到相关数据库,右键单击数据库,选择“任务” >>“导出数据层应用程序”。 Then select a location on the server to save the .bacpac file with the aim of exporting to another server on another network. 然后在服务器上选择一个位置来保存.bacpac文件,以导出到另一个网络上的另一个服务器。 The process starts okay but then fails and the report for the error has hundreds of errors stating, 该过程可以开始,但随后失败,并且错误报告中包含数百个错误,

"Error SQL71562: Error validating element [dbo].[capt_blockperiod]: Trigger: [dbo].[capt_blockperiod] has an unresolved reference to object [master].[dbo].[sysprocesses].[hostname]. External references are not supported when creating a package from this platform" “错误SQL71562:验证元素[dbo]时出错。[capt_blockperiod]:触发器:[dbo]。[capt_blockperiod]对对象[master]。[dbo]。[sysprocesses]。[hostname]有未解析的引用。外部引用不是从此平台创建软件包时受支持”

How do I resolve these without going through each one please? 我如何解决这些问题而不需要逐一讨论? Is there an alternative way of exporting the entire database that will avoid these issues? 是否有导出整个数据库的替代方法来避免这些问题?

Try to generate bacpac in the console 尝试在控制台中生成bacpac

cd C:\Program Files (x86)\Microsoft SQL Server\<SQL_VERSION>\DAC\bin

sqlpackage.exe /a:Export /ssn:myServer /sdn:myDatabase /tf:C:\<MY_PATH>\myBacpac.bacpac

If the logged in user is executing the script, Integrated Windows Authentication will be used. 如果登录的用户正在执行脚本,则将使用集成Windows身份验证。 So no need to specify the username or password. 因此,无需指定用户名或密码。

You're sure to bacpac and not dacpac? 您确定要bacbac而不是dacpac吗?

For dacpac : 对于dacpac:

cd C:\Program Files (x86)\Microsoft SQL Server\<SQL_VERSION>\DAC\bin
sqlpackage /Action:Extract /SourceDatabaseName:"MyDatabase" /SourceServerName:localhost /TargetFile:"C:\SomeDirectory\MyDatabase.dacpac"

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

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