【发布时间】:2014-03-21 06:38:52
【问题描述】:
我正在将 SQL 数据库 (Umbraco 6.1.6) 迁移到 SQL Azure,并且在导入数据时遇到了一些问题。感觉有点像this。
按照当前的wiki,不同的是我必须执行sqlcmd来运行数据脚本,因为文件大约500MB。
sqlcmd -U user_dbo -P password -S cloudserver -d Database -i c:\script\data.sql -o c:\azuremigration.txt
通过我的输出文件的过程,我收到了几个错误,例如:
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_cmsPropertyData_umbracoNode". The conflict occurred in database "xxx", table "dbo.umbracoNode", column 'id'.
The statement has been terminated.
Msg 547, Level 16, State 1, Server xxx, Line 49
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_cmsDocument_cmsContent". The conflict occurred in database "xxx", table "dbo.cmsContent", column 'nodeId'.
The statement has been terminated.
Msg 547, Level 16, State 1, Server xxx, Line 20
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_cmsPropertyData_cmsPropertyType". The conflict occurred in database "xxx", table "dbo.cmsPropertyType", column 'id'.
当数据“部分”导入访问后台或站点的任何页面时,我得到了这个 SQL 异常:
Invalid object name 'cmsPropertyTypeGroup'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'cmsPropertyTypeGroup'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Invalid object name 'cmsPropertyTypeGroup'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +388
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515
System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +69
System.Data.SqlClient.SqlDataReader.get_MetaData() +134
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6553981
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +6556619
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +586
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +104
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +288
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +171
StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) +101
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() +17
Umbraco.Core.Persistence.<>c__DisplayClass4.<ExecuteReaderWithRetry>b__3() +277
Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction(Func`1 func) +545
Umbraco.Core.Persistence.<Query>d__1c`1.MoveNext() +1287
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +536
System.Linq.Enumerable.ToList(IEnumerable`1 source) +80
Umbraco.Core.Persistence.Repositories.ContentTypeBaseRepository`2.GetPropertyGroupCollection(Int32 id, DateTime createDate, DateTime updateDate) +1712
Umbraco.Core.Persistence.Repositories.ContentTypeRepository.PerformGet(Int32 id) +651
Umbraco.Core.Persistence.Repositories.RepositoryBase`2.Get(TId id) +123
Umbraco.Core.Persistence.Repositories.<PerformGetByQuery>d__f.MoveNext() +785
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +247
Umbraco.Core.Services.ContentTypeService.GetContentType(String alias) +548
Umbraco.Core.<>c__DisplayClass3.<GetDataType>b__0(Tuple`2 tuple) +68
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +112
Umbraco.Web.PublishedContentExtensions.GetPropertyValue(IPublishedContent prop, String alias, Boolean recursive, T ifCannotConvert) +247
Umbraco.Web.Routing.PublishedContentRequestEngine.FollowInternalRedirects() +91
Umbraco.Web.Routing.PublishedContentRequestEngine.HandlePublishedContent() +664
Umbraco.Web.Routing.PublishedContentRequestEngine.FindPublishedContentAndTemplate() +264
Umbraco.Web.Routing.PublishedContentRequestEngine.PrepareRequest() +103
Umbraco.Web.UmbracoModule.ProcessRequest(HttpContextBase httpContext) +457
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
也尝试使用 Red Gate 数据比较工具,他们不输出错误,但我的最终结果是一样的。
有什么想法可以让这个过程不那么痛苦并且实际上可以正常工作吗?
【问题讨论】:
标签: sql umbraco azure-sql-database database-migration