Microsoft SQL Server 2008 - Managing Command Timeout - sql-server

We have a powerbuilder application which connects to SQL Server 2008 database. We have some reports which run around 3-4 hours. This is via a procedure invoked from the application code. when this long report runs, the application is getting disconnected from the database after 1 hour 40 minutes.
We have the below timeout parameters set in the connection string from application:
Connect timeout = 6000, TimeOut = 6000,CommandTimeOut = 6000
When we increased the CommandTimeOut Parameter to a higher value, the reports were completed with out database disconnect. But the performance was reduced. ie the reports are taking more time when we increased the value of CommandTimeout parameter in the connection string.
Could you please let me know what is the best solution for this issue.

Related

Logic App - When connecting to on prem sql server: The gateway did not receive a response from 'Microsoft.Web' within the specified time period

I have a sql server database which has around 15 stored procedures and 4,73,000 tables. Every month the number of tables gets increased by around 500.
I have created a logic app and added a sql server action to execute a stored procedure which is available in this database. But when I am trying to see if the logic app is pointed to correct stored procedure from the designer view it is giving me the below exception. Also see the below screen shot.
The gateway did not receive a response from 'Microsoft.Web' within the specified time period.
When I verified the logs of on prem data gateway, the below exception is logged there.
Microsoft.Data.Mashup.MashupHostingException (0x80004005): Timeout expired. The timeout period elapsed prior to completion of the operation.
I tried to increase the RAM of the VM to 16GB still having the same issue.
Can anyone help me out is fixing the issue. I am unable to find the cause of the issue as well.
Thanks in advance.

what is the default value for write timeout in postgres and MSSQL database connections?

I am using different databases to run my application. Recently I increased net_write_timeout value in mysql database, As I faced some timeout errors due to that. These errors are not occurred in Postgres or Mssql database.
My question is what is the equivalent flag of net_write_timeout (Mysql) for Postgres and Mssql database.
For SQL Server there are a couple of timeouts but nothing that directly corresponds to the net_write_timeout - afaik...
The default connection timeout (time allowed to connect to an instance) is 15 seconds. The default execution timeout (time allowed to execute a query etc) is 600. Connection timeout is set on the connection string, execution timeout on the connection in code, or at the server level by sp_configure
Refs: https://msdn.microsoft.com/en-AU/library/ms189040.aspx
and http://www.connectionstrings.com/all-sql-server-connection-string-keywords/

SchemaModel.SqlSpatialIndex: Timeout expired

I am receiving a timeout error when trying to reverse engineer a SQL Server database into a Database project. We don't have any spatial indexes on the that database (I checked using this).
I don't have a timeout setting on the connection (
3/8/2016 9:46:00 AM An error was received from SQL Server while attempting to reverse engineer elements of type Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSpatialIndex: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
3/8/2016 9:46:00 AM An exception was generated.
Unable to reconnect to database: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
3/8/2016 9:46:00 AM An error was received from SQL Server while attempting to reverse engineer elements of type Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSpatialIndex: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
3/8/2016 9:46:00 AM Finished importing database.
3/8/2016 9:46:00 AM A summary of the import was saved to the following location: C:\Temp\Import From Prod 2\Import Schema Logs\Import From Prod 2_20160308024125.log
3/8/2016 9:46:00 AM Click Finish to continue...
Steps to reproduce the issue:
Open Visual Studio 2013
From the menu, click on "View" / "Sql Server Object Explorer"
Connect to a SQL Server (in our case, the UAT server) and choose a database
From the context menu of the database, choose "Create New Project"
Press "Start"
How do I figure out what is actually timing out? How do I fix this?
Can you increase the amount of available RAM? This exact error started showing up for me with schema comparisons between an existing db project and a local database. The problem was resolved when I shut down all of my applications except Visual Studio. This makes me think that my pc did not have enough resources to complete the task in the desired time when I have several apps open.
One option that worked for me was to increase the value of HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\NN.N\SQLDB\Database\QueryTimeoutSeconds and restart Visual Studio based on this. But, although successful, it was taking nearly 5 minutes to compare.
Later I discovered that we recently changed our build target to Sql Server 2016, but were still referencing a 2012 master.dacpac. I updated the reference to a 2016 master.dacpac and the compare now completes in less than a minute.

How to fix jobs conflict in transactional replication

Have two multiple geographically distributed SQL Server Databases with transactional replication.SQL Server agent sync two servers every 1 minute.After working for 10 minutes on server B (subscriber),it has an error, which lasts 10-15 minutes and corrected herself. Then again it working 10 minute and has an error. On server A (publication) I have log backup schedule it runs every 10 minutes. Maybe there is conflict between two jobs ?
SQLServerAgent Error: Request to run job XXX (from User sa)
refused because the job is already running from a request by Schedule 14 (Replication agent schedule.).
Changed database context to 'XXX'. (.Net SqlClient Data Provider)
How to fix it ?

How to prevent Data Generation Plan timeout expired error

I'm attempting to populate a DB on my local SQL2008 Server using a Data Generation Plan. However, when I run it I get:
Data generation failed because of the following exception: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.. occurred 1 time(s).
I've tried setting the Connection timeout setting in the Advanced connection properties to 120 instead of 15, but I still get the error.
How do I fix this problem?
There are roughly 40 tables involved and about 20 of those are getting 100 rows inserted while, 10 tables ~1000 rows and the rest less than 100 rows. Also, when I exclude the trouble table the script completes successfully.
Thanks!
Go to Tools menu > Options > Database Tools > Data Generator > SQL Timeout
You may have to restart Visual Studio for the change to take effect, at least I had to.
There are also other timeout values that can be configured via the Registry (QueryTimeoutSeconds, LongRunningQueryTimeoutSeoncds, LockTimeoutSeconds) though I don't understand the difference. See here.

Resources