We recently saw some cases where customer migrated their SQL Database to Basic edition. After the migration they get the following error while attempting to publish their database via SQL Server Data Tools (SSDT) in Visual Studio 2013
Failed to import target model ...Unable to reconnect to database
Timeout Expired. The timeout period expired prior to completion of the operation or the server is not responding.
The reason why this happens is because the Publish (or Generate Script) operation reaches the CPU limit of Basic edition and ultimately times out. See below snapshot of sys.dm_db_resource_stats showing 100% CPU usage during the operation
end_time avg_cpu_percent avg_data_io_percent avg_log_write_percent
----------------------- ---------------- --------------------- ----------------------
2014-11-13 21:13:17.570 2.40 0.83 0.05
2014-11-13 21:13:02.517 100.00 0.00 0.00
2014-11-13 21:12:47.477 100.00 0.00 0.00
2014-11-13 21:12:32.430 100.00 0.00 0.00
2014-11-13 21:12:17.383 100.00 0.00 0.00
There are a couple of ways to overcome this
In the current version of SSDT there is no user interface that allows modifying the query timeout. Instead the query timeout for SSDT is controlled by the following registry keys:
The registry key path depends on the version of Visual Studio used by the customer:
For this particular issue it is advisable to check for the QueryTimeoutSeconds setting in all three locations and increase it to 600 if it is present.
Author: - Rohit Nayak (@sqlrohit)
Reviewers: - Keith Elmore, SSDT Product Group
Escalation Services, Microsoft