locked
Import organization with OptimizeOrgImport throws InvalidOperationException RRS feed

  • Question

  • Are there some pitfalls when I import organization with OptimizeOrgImport=1? How this optimization works internally?

    Use case:

    1. Copy (backup/restore) organization database to testDb1.
    2. Copy (backup/restore) organization database (after some time) to testDb2.
    3. Import organization as "test1" to test environment from testDb1.
    4. Import organization as "test2" to test environment from testDb2.

    Log of the step4:

    14:46:22|   Info| Import Organization (test2)
    14:46:22|   Info| Update Organization...
    14:48:20|   Info| Update Users...
    14:48:44|  Error| Import Organization (Name=test2, Id=5b6bf941-650c-e211-b194-00155d161162) failed with Exception:
    System.InvalidOperationException: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.
       at System.Data.SqlClient.SqlConnection.GetOpenConnection(String method)
       at System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command)
       at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       at Microsoft.Crm.CrmDbConnection.InternalExecuteNonQuery(IDbCommand command)
       at Microsoft.Crm.CrmDbConnection.ExecuteNonQuery(IDbCommand command, Boolean impersonate)
       at Microsoft.Crm.CrmDbConnection.SetTransactionIsolationLevel(IsolationLevel il)
       at Microsoft.Crm.CrmDbConnection.Dispose(Boolean disposing)
       at Microsoft.Crm.SqlExecutionContext.Dispose(Boolean disposing)
       at Microsoft.Crm.SqlExecutionContext.Dispose()
       at Microsoft.Crm.Tools.Admin.ImportOrganizationInstaller.Import(Guid organizationId, String organizationUniqueName, String organizationFriendlyName, String sqlServerName, String databaseName, Uri reportServerUrl, String privilegedUserGroupName, String sqlAccessGroupName, String userGroupName, String reportingGroupName, String privilegedReportingGroupName, ICollection`1 users, MultipleTenancy multipleTenancy)

    From kb977867:


    When you use the registry entry OptimizeOrgImport and have the value of this entry set to 1, you cannot import the same organization database more than one time. 

    But how the CRM consieders that two organization databases are the same? Should my use case work? 

    I use Dynamics Crm 4.0



    • Edited by Btrat Thursday, January 17, 2013 8:08 AM
    Thursday, January 17, 2013 8:06 AM

All replies