+1-888-365-2779
Try Now
More in this section

Forums / Deployment / Deploying 3.5 to test evironment SQL errors

Deploying 3.5 to test evironment SQL errors

4 posts, 0 answered
  1. Jay
    Jay avatar
    25 posts
    Registered:
    12 May 2008
    02 Dec 2008
    Link to this post
    Hi,

    We just upgraded to 3.5 sp1 everything worked well on our dev machines, when we deployed the app to our test environment and attempted to view the homepage we get this error

    CREATE UNIQUE INDEX terminated because a duplicate key was found for object name 'dbo.sf_CmsControlProperty' and index name 'PK_sf_CmsControlProperty'.  The duplicate key value is (ba9cc01f-47c3-4b3a-99a1-80ea815b08b2, AllowPaging).
    Could not create constraint. See previous errors.
    The statement has been terminated.


    Stack Trace:

    [SqlException (0x80131904): CREATE UNIQUE INDEX terminated because a duplicate key was found for object name 'dbo.sf_CmsControlProperty' and index name 'PK_sf_CmsControlProperty'.  The duplicate key value is (ba9cc01f-47c3-4b3a-99a1-80ea815b08b2, AllowPaging).
    Could not create constraint. See previous errors.
    The statement has been terminated.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
       System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) +196
       System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +269
       System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
       Nolics.ORMapper.DataProviders.SQLDataProvider.ExecSchemaChange(String change) +91
       Nolics.ORMapper.Base.OdbDataProvider.Upgrade() +97
       Telerik.Cms.Data.DefaultProvider.Initialize(String name, NameValueCollection config) +402
       Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings, Type providerType) +663
       Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings) +102
       Telerik.ManagerBase`1.SetProvider(String providerName) +201
       Telerik.ManagerBase`1..ctor(String providerName) +86
       Telerik.ManagerBase`1..ctor() +11
       Telerik.Cms.CmsWorkflowService..ctor() +23
       Telerik.Cms.CmsWorkflowService..cctor() +20
    
    [TypeInitializationException: The type initializer for 'Telerik.Cms.CmsWorkflowService' threw an exception.]
       Telerik.Cms.CmsWorkflowService.Initialize() +0
       Telerik.Cms.CmsManager.OnInitialized() +5
       Telerik.ManagerBase`1.Initialize() +507
       Telerik.ManagerBase`1..ctor(String providerName) +18
       Telerik.ManagerBase`1..ctor() +11
       Telerik.Cms.CmsManager..ctor() +5
       Telerik.Cms.Web.UrlHelper..cctor() +521
    
    [TypeInitializationException: The type initializer for 'Telerik.Cms.Web.UrlHelper' threw an exception.]
       Telerik.Cms.Web.CmsHttpModule.Init(HttpApplication context) +101
       System.Web.HttpApplication.InitModulesCommon() +66
       System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1006
       System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +259
       System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +114
       System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +350
    



    The test evironment uses a different database I ran a sql query and it seems to be there are two entires with the same guid as pointed out in the error one is for the socialbookmark and the other im not entirely sure.

    Any help would be appreciated.

    Kind Regards,

    Jay Macilquha

  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    03 Dec 2008
    Link to this post
    Hello Jay,

    This is a very strange error. We have no idea how it could be happened without manual changes in the database structure.
    The database object which is mapped to the sf_CmsControlProperty table is not changed since v3.0, so this table should not be updated from the database upgrade tool. I mean that the database should have the index PK_sf_CmsControlProperty and should try to create it from now on. Except, if the table has been modified manually, i.e. the key with name PK_sf_CmsControlProperty has been removed. Is this the case? Otherwise, why you have more than one items with the same key, even the constraint?

    In order to fix the problem now, we suggest you to remove the duplicated records from the sf_CmsControlProperty table in the database and restart the Web Site.

    Greetings,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Jay
    Jay avatar
    25 posts
    Registered:
    12 May 2008
    08 Dec 2008
    Link to this post
    Hi,

    I started removing duplicate entries but soon found this task was going to be massive as it started throwing errors for other tables with duplicate entries.

    I rolled the release back out of test and got a copy of the production database and restored this to test along with Sitefinity 3.2. Everything kicked back into life, I then tried to deploy 3.5 again, before I browsed to the homepage i started a SQL trace, the app fall over again with a very similar error

    CREATE UNIQUE INDEX terminated because a duplicate key was found for object name 'dbo.sf_Activity' and index name 'PK_sf_Activity'.  The duplicate key value is (72805905-8f76-404f-bfed-0a3f12e838dd).<br>Could not create constraint. See previous errors.<br>The statement has been terminated.

    CREATE UNIQUE INDEX terminated because a duplicate key was found for object name 'dbo.sf_Activity' and index name 'PK_sf_Activity'.  The duplicate key value is (72805905-8f76-404f-bfed-0a3f12e838dd).
    Could not create constraint. See previous errors.
    The statement has been terminated.

    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: CREATE UNIQUE INDEX terminated because a duplicate key was found for object name 'dbo.sf_Activity' and index name 'PK_sf_Activity'.  The duplicate key value is (72805905-8f76-404f-bfed-0a3f12e838dd).
    Could not create constraint. See previous errors.
    The statement has been terminated.

    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): CREATE UNIQUE INDEX terminated because a duplicate key was found for object name 'dbo.sf_Activity' and index name 'PK_sf_Activity'.  The duplicate key value is (72805905-8f76-404f-bfed-0a3f12e838dd).
    Could not create constraint. See previous errors.
    The statement has been terminated.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
       System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) +196
       System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +269
       System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
       Nolics.ORMapper.DataProviders.SQLDataProvider.ExecSchemaChange(String change) +91
       Nolics.ORMapper.Base.OdbDataProvider.Upgrade() +97
       Telerik.Workflow.NolicsWorkflowProvider.Initialize(String name, NameValueCollection config) +412
       Telerik.Workflow.ObjectManager`1.InstantiateProvider(ProviderSettings providerSettings, Type providerType) +716
       Telerik.Workflow.ObjectManager`1.InstantiateProviders(ProviderSettingsCollection configProviders, IDictionary`2 providers, Type providerType) +146
       Telerik.Workflow.ObjectManager`1.Initialize() +545
       Telerik.Workflow.ObjectManager`1..ctor(String provider) +12
       Telerik.Workflow.WorkflowRuntime.Initialize() +120
       Telerik.Workflow.WorkflowRuntime.get_Instance() +43
       Telerik.Cms.CmsWorkflowService..ctor() +37
       Telerik.Cms.CmsWorkflowService..cctor() +20
    
    [TypeInitializationException: The type initializer for 'Telerik.Cms.CmsWorkflowService' threw an exception.]
       Telerik.Cms.CmsWorkflowService.Initialize() +0
       Telerik.Cms.CmsManager.OnInitialized() +5
       Telerik.ManagerBase`1.Initialize() +507
       Telerik.ManagerBase`1..ctor(String providerName) +18
       Telerik.ManagerBase`1..ctor() +11
       Telerik.Cms.CmsManager..ctor() +5
       Telerik.Cms.Web.UrlHelper..cctor() +521
    
    [TypeInitializationException: The type initializer for 'Telerik.Cms.Web.UrlHelper' threw an exception.]
       Telerik.Cms.Web.CmsHttpModule.Init(HttpApplication context) +101
       System.Web.HttpApplication.InitModulesCommon() +66
       System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1006
       System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +259
       System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +114
       System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +350
    


    The Trace stopped at this line:
    ALTER TABLE [dbo].[sf_Activity] ADD CONSTRAINT [PK_sf_Activity] PRIMARY KEY ([ID])

    We havent touched any of the sitefinity tables, there is no reason too.

    I will keep on investigating any further help would be appreciated.

    Kind Regards,

    Jay
  4. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    10 Dec 2008
    Link to this post
    Hello Jay,

    The errors are really very strange and uncommon. Could you try to reproduce the problem on your local web site?
    If you replicate it, please send us your project (database, web.config and the project custom files) in the support ticket you have opened on the same topic, and we will investigate the issue locally. Otherwise, let us know about the result your investigation brings to.

    All the best,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered