2016-03-17 107 views
5

我非常熟悉從Azure SQL V12導出到我的開發箱然後導入到本地sql(2014)實例的過程。我正在旋轉一個新的Win10盒子並安裝了SQL 2016 CTP。我連接到同一Azure的實例,可以針對它進行操作 - 並能在.bacpac出口就如同2014年無法將SQL Azure bacpac導入到2016 CTP

但是,當我嘗試導入到本地我得到:

Could not import package. 
Warning SQL72012: The object [FOO33_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 [FOO33_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 547, Level 16, State 0, Line 3 The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_dbo.Address_dbo.User_idUser". The conflict occurred in database "FOO33", table "dbo.User", column 'idUser'. 
Error SQL72045: Script execution error. The executed script: 
PRINT N'Checking constraint: FK_dbo.Address_dbo.User_idUser [dbo].[Address]'; 

ALTER TABLE [dbo].[Address] WITH CHECK CHECK CONSTRAINT [FK_dbo.Address_dbo.User_idUser]; 
+0

那又如何?作爲CTP的SQL Server 2016 CTP並未得到其他產品的全面支持?這裏有什麼驚喜嗎? – TomTom

+0

它說「錯誤SQL72014:.Net SqlClient數據提供程序:Msg 547,級別16,狀態0,行3 ALTER TABLE語句與FOREIGN KEY約束」FK_dbo.Address_dbo.User_idUser「衝突。數據庫」FOO33「 ,表「dbo.User」,列'idUser'「 – TheGameiswar

+0

嘗試解決錯誤 – TheGameiswar

回答

1

由於這個問題也被MSDN詢問和回答,我會在這裏分享。從鏈接答案 https://social.msdn.microsoft.com/Forums/azure/en-US/0b025206-5ea4-4ecb-b475-c7fabdb6df64/cannot-import-sql-azure-bacpac-to-2016-ctp?forum=ssdsgetstarted

文字:

我懷疑這是怎麼回事錯在這裏是已使用正在改變而出口是正在進行的一個數據庫實例進行導出操作。這可能導致導出的表數據不一致,因爲與SQL Server的物理備份/恢復不同,導出不能保證事務一致性。相反,它們主要通過依次連接到數據庫中的每個表並執行select *來執行。如果兩個表之間存在外鍵關係,並且讀表數據不一致,則在將數據寫入數據庫並導入代碼嘗試重新啓用外鍵後,導入時會導致導入錯誤。我們建議使用數據庫複製機制(創建數據庫copyDb作爲originalDb的副本),從而確保具有事務一致性的副本,然後從不變數據庫副本中導出。

+5

避免只回答答案。這是SO的主要原則。 –

相關問題