Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • antao 81 posts 371 karma points
    Feb 20, 2014 @ 12:03
    antao
    0

    Umbraco 6.1.6 migration to SQL Azure

    I'm migrating an SQL Database (Umbraco 6.1.6) to SQL Azure and facing several problems when importing the data. It's felling a bit like this.

    Following the current wiki, with the difference that I have to execute sqlcmd to run the data script, because the file as approximately 500MB.

        sqlcmd -U user_dbo -P password -S cloudserver -d Database -i c:\script\data.sql -o c:\azuremigration.txt

     

    Through the process on my output file I get several errors like: 

        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'.

     

    When the data is 'partially' imported accessing the backoffice, or any page of the site I got this SQL exception:

         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
         

     

    Also tried to use the Red Gate Data Compare tool, they don't output me errors, but my end result is the same.

    Any ideas to make this process less painfull and actually working A ok? 

     

     

  • Dan Lister 416 posts 1974 karma points c-trib
    Feb 20, 2014 @ 13:08
    Dan Lister
    100

    How are you creating your data.sql script? If you are using the Generate Scripts option then make sure you change the database engine type to SQL Azure and that you script both schema and data. If you have SSMS 2012, I prefer to use bacpac files for transferring databases to SQL Azure via the Export Data-Tier Application option. This blog post might help you.

    Also, does the table cmsPropertyTypeGroup exist within your script or SQL Azure database? Your exception above usually occurs when the table doesn't exist. I believe the table is new for version 6.

  • antao 81 posts 371 karma points
    Feb 20, 2014 @ 16:08
    antao
    0

    Hey Dan, 

    Thanks for the input! It was valuable, but I'm still getting the SQL exception. I've re-runned the generated script for data couple of times, because when created, SQL doesn't really know the dependencies on the umbraco schema. 

    I don't seem to find the table cmsPropertyTypeGroup which is rather strange. I think this website was upgraded in the past from a 4.7.x version. Oh boy... this is going to be painfull :(

  • Dan Lister 416 posts 1974 karma points c-trib
    Feb 20, 2014 @ 16:19
    Dan Lister
    1

    The generate scripts task should output your schema in a way that dependencies will be handled correctly.

    It sounds to me like your database hasn't been upgraded from v4 to v6. Have you got the source of the original v4 site? If so, I'd see if it works against that.

  • antao 81 posts 371 karma points
    Feb 21, 2014 @ 08:45
    antao
    0

    Sorry for the late reply... That was actually the problem, the v6 database was hidden behind a not very discoverable name and I was still generating scripts on the v4 database. 

    Thanks for the help Dan. #H5YR

    I will still today edit that wiki with more information.

Please Sign in or register to post replies

Write your reply to:

Draft