title: SQL Timeouts in CRM 4.0 - import of customizations fail
body: <p>When importing customizations to CRM 4.0, the import fails with a message "generic SQL error". Digging a bit deeper the error message is really that a timeout has occured. The same error occurs when trying to create a new entity.</p>
  
  <p>I increased the timeout as suggested in the link below, but the timeout occured anyway - it just took longer time to happen.</p>
  
  <p><strong>Increasing the timeout:</strong></p>
  
  <blockquote>
    <p>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM\OLEDBTimeout</p>
    
    <p>This value does not exist by default, and if it does not exist then the default value will be 30 seconds. To change it, add the registry value (of type DWORD), and put in the value you want (measured in seconds). Then you have to recycle the CrmAppPool application pool for the change to take effect </p>
    
    <p><a href="https://community.dynamics.com/product/crm/crmtechnical/b/crmdavidjennaway/archive/2008/09/04/sql-timeouts-in-crm-generic-sql-error.aspx" rel="nofollow">https://community.dynamics.com/product/crm/crmtechnical/b/crmdavidjennaway/archive/2008/09/04/sql-timeouts-in-crm-generic-sql-error.aspx</a></p>
  </blockquote>
  
  <p>The SQL profiler displays a set of inserts and updates related to the metadata in CRM, and then a call to the stored procedure <pre>exec p_RecreateIndexes</pre></p>
  
  <p>This call is apparently the culprit and never completes in a timely fashion (30+ minutes now and not completed yet). This is an existing test instance of CRM and is quite extensively used and filled with lots of data. Creating new entities has never before taken this long. Just in case, I have run the asyncoperation cleaning scripts from MS. It did not have any visible effect.</p>
  
  <p>Is there any way to find the reason for the delay in this procedure, or some other solution I can try?</p>