SQL Azure: Timeout expired - sql

we have some cloud Services hosted in Windows Azure and also some Azure SQL database. At night (during 4:00 - 6:00 utc) there are running some Jobs to import data into database. Since some weeks all the Jobs fails with an timeout expired exception of the database. If I run the Jobs later (during 7:00 - 9:00 utc) on my local machine within the Emulator, all Jobs work without any Problems on the same database.
At the mport time is no much traffic from our site on the database server. The monitoring of the manage portal shows that there are not many open Connections, no throttled ones and no connection errors. There are much more traffic during my local runs.
The sys.event_log do not contains any errors or other possible issues.
Are there any logs or other Options to get more Information about why the Jobs failed at night?
Update
It seems, that the SQL Azure Server ignores the command timeout property. The Jobs start at 4:30 UTC and stops with an timeout exception at 4:37. But the query, which gets an timeout, has an command timeout of 1200 (20 minutes). And before starting the command, there are some downloads from an ftp-server, file parsing and other SQL queries.

Just to note that SQL Azure isn't a full version of MS SQL and does have some limitations. Most notable limitation is the infrastructure that its built on. Your SQL Azure DB will be hosted on a Small Instance server that has shared resource with hundreds of other users. Although there is a fair use policy on the machines it does take time for the servers to kick in.
My suggestion would be to have some way of determining if the Job is actually starting or if the connection pool is timing out prior to starting the job. I.E. create a jobs table that is inserted into to say its started and have this as the first action on your job.
Alternatively you could think about migrating to a VM setup in Azure. This is where you have a Small or Medium instance VM with a fully fledged version of MS SQL Server running on it. That way you can run your jobs against the server correctly and control you connection pooling more appropriately.

Related

SQL timeouts in ASP.NET after server migration

We have several ASP.NET WebForm sites running on IIS. We switched hosting providers and migrated all of the sites and databases.
After the migration, we are getting timeouts in several places in several sites after 30 seconds. Some are LINQ queries, some are MS Reports, some stored procs.
The code and web.configs were copied directly, so there should be no difference except for the SQL and IIS versions and configurations.
We went from SQL Server 2014 to SQL Server 2019 now running on Windows Server 2019.
IIS server is also on a 2019 server.
In SQL Server, 'Allow remote connections' is checked with a remote query timeout of 600 seconds.
I have added 'Connection Timeout=120' to the connection string in the web.config but it is still timing out after 30 seconds.
Here is an example of one of them coming from a report:
An error has occurred during report processing.
Exception has been thrown by the target of an invocation.
Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The wait operation timed out
Some of these sites are pretty old and using older methods for connecting to database. I have seen some posts about adding a timeout to the SqlCommand object, but most places we have do not use one. Some code is within a custom data layer and I don't have access to all of the source code to try adding the timeout value.
Any ideas of where this timeout may be coming from?
Any direction would be appreciated.
Any ideas of where this timeout may be coming from?
These are client-side timeouts caused by queries running longer than the SqlCommand.CommandTimeout, which defaults to 30sec.
The recommended upgrade process is to initially leave the databases at their original compatibility level after upgrade to minimize the risk of plan reversion. Then turn on Query Store to gather a performance baseline before increasing the database compatibility level. See
Change the Database Compatibility Level and use the Query Store

SQL Server Agent Not Scheduling

I am running SQL Server Standard (linux) in a docker container and the Agent is not working to any schedule (recurring, one time).
The agent itself works, I have programmed a couple jobs which are completing successfully. However, the jobs do not even start when I activate the schedule meaning there isn't even an error message to review or record in the job activity monitor. Below is my configuration:
sql server job properties
I corrected the timezone issue by passing the proper environment variable, America/Toronto did not not pass properly, so I used America/New_York.

Lock request timeout Exceeded

I have a dotnet exe app in a server which runs in sql server. during the factory production time my application were unable to connect to db for 1 to 2 minutes and then it gains connectivity at this unresponsive time when i accessed sql server management studio, i got the below error:
Taken from the answer over here.
This usually happens when there are too many open transactions that are blocking read access to your database server. You can try restart your server which will usually solve the issue.

How to prevent port timeouts for large remote queries from SQL Server?

I have an unixODBC connection from a linux-based SAP HANA database trying to pull massive amounts of data from another SQL Server 2012 database. Every now and then though I get "Login timeout expired" errors and I also notice via netstat that while the connection reaches "ESTABLISHED" status, it just closes out after about 10 seconds. The issue doesn't happen every time, and I've already done all kinds of due diligence on the network side and found no issues on that end.
Is there anything that can be done on the SQL Server configuration so that the connection doesn't time out?
The current remote query timeout is 600 seconds and remote login time-out is 30 seconds.
I also read in the following link that increasing "Connection timeout" setting in SQL Server helps but how do I change it, it's grayed out.
You are right to note that you need to change the remote query timeout setting to 0.
This link give pretty neat answer to your question. There are ways for doing it via both the SQL Server management Studio, and the command line. However, you need to first login with a user that has the required permissions.

SQL Server 2014 Standard 2014 no access and bad preformance

My company looks after a server which is running SQL Server 2014 Standard Edition. The main application database on the server is replicated out to about 20 subscribers. The server has only been in operation for about a week and at the time of setting it up we moved the existing database and replication across from the old server. At that time we also changed the recovery model from Simple to Full.
The performance of the server hasn't been particularly good so far, even though it has 24 logical processors and 32 GB of RAM. However it seems to be SQL Server that has been performing badly due to locks etc. according to the event logs.
This morning we couldn't access any tables in Management Studio and after a period of time we decided to try restarting the service. The service did not seem to stop properly and we were forced to restart the server. After restarting the server everything seemed fine until we tried to expand out the 'Databases' tab in Management Studio. It just says 'expanding...' in the UI and after several minutes brings up a timeout error message. After clicking ok on this message we can browse all the system databases as normal but the main application database is not shown.
One of the problems that has come to light is that the log file has grown extremely large (over 1 TB).
This is a major problem now as you can imagine, since we cannot connect to the database to shrink the log file and no applications can connect to the database Connecting to the database using 'sqlcmd' doesn't work either. We can't 'open' the database.
Look forward to hearing if anyone has come across this before and knows of a solution.