I’ve been testing the process of importing a CRM Organization created against a SQL 2005 database into a SLQ 2008 database and I was pleased to find that the import worked like a charm once I overcame an issue related to Reports.
At first, the issue was not obvious to me since the error I saw in the log file was the following:
“Error| Import Organization (Name=CRMTestNew, Id=3052bc2b-97f1-df11-aab3-001e0bdd41d0) failed with Exception:
System.InvalidOperationException: ExecuteNonQuery requires an open and available Connection. The connection’s current state is closed.”
Based on the above error, I assumed there was a timeout issue so I made the recommended changes to the registry and config files, restarted the machine and tried again without success. After trying the import a couple of times without success, I searched the Internet for solutions and came across this post on the Dynamics Forum that helped.
After taking a closer look at the log file related to the import, I noticed that a report was listed just before the error. Although the report did not appear to have any error related to it, I tried the solution recommended, deleted the report from the database and tried again but the import still failed. In reviewing the log file again, I found a different report just before the error so I deleted that report as well and this time the import was successful.
In the event that this helps someone, below is the error message, error log location and file name:
Path = C:\Documents and Settings\LoggedOnUserRunningTheImport\Application Data\Microsoft\MSCRM\Logs
File name = crm40dmsnapin.log
Error| Import Organization (Name=CRMTestNew, Id=3052bc2b-97f1-df11-aab3-001e0bdd41d0) 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 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.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)
14:35:53|Warning| Attempting to cancel a long running process: ProgressWizard. This might leave the data in an invalid state and the application might not function correctly.
07:32:34|Warning| Attempting to cancel a long running process: FinishWizard. This might leave the data in an invalid state and the application might not function correctly.