我试图将SQL Azure导出文件(.bacpac)导入到我的本地数据库并收到以下错误.
Powershell命令
PS C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin> .\SqlPackage.exe /a:import /sf:C:\SQLDATA\Backups\test-
2015-9-10-12-10.bacpac /tdn:test-live-local /tsn:.\sql2014
以下错误消息
Error importing database:Could not import package.
Error SQL72014: .Net SqlClient Data Provider:
Msg 547, Level 16, State 0, Line 3
The ALTER the FOREIGN KEY constraint “FK_CompanyPeopleCompany”. The conflict occurred in database “dbo.Companies”, column ‘Id’.Error SQL72045: Script execution error. The executed script: PRINT N’Checking constraint: FK_CompanyPeopleCompany [dbo].[CompanyPeoples]’; ALTER TABLE [dbo].[CompanyPeoples] WITH CHECK CHECK CONSTRAINT [FK_CompanyPeopleCompany];
我尝试了从实时数据库中备份的数量而没有成功.
任何帮助将不胜感激.
最佳答案 当您生成bacpac文件时,是否从实时数据库(用户正在积极更改值)中导出?从实时数据库导出可能会导致bacpac文件包含不一致的数据,无法成功导入.这是因为与备份文件不同,bacpac文件不保证事务一致性.创建bacpac的推荐过程是在Azure中创建数据库副本(保证事务一致性),然后从不变的副本导出.