Query timeout expired while running a request from a packaged .NET tool - sql

I am working on an application built using a .NET packaged configuration tool. There is a out of box request that in turn fires a delete SQL statement and tries to delete a row from the database. Since past few months, we are receiving the following error- [Microsoft][ODBC SQL Server Driver]Query timeout expired.
We are unable to simulate this scenario in lower environments and can see this issue only on production.
The only issue we think is there might be a deadlock issue in a situation where this delete request is deadlocking with another simultaneous insert in the table (we have a scheduled job that inserts data in a relational database from large XML-splitting data from nodes)
What can be done to resolve this? Note, indexing has been done on the tables recently that reduces the frequency for some time but it again spiked up.

Related

SQL Server Management Studio : execution timeout expired

I keep on getting a timeout in my Microsoft SQL Server Management Studio. I'm not running any code. All I am doing is trying to look at the tables within a database in the Object Explorer. I always get:
Execution Timeout Expired
I've looked at some of my settings and it says lockout of 0, meaning it should be unlimited time. I'm not even running any code. Just trying to understand what's in my database by going through the Object Explorer.
Thanks!
It depends on your work environment. But in all cases, I trust it is related to the Database but not the Studio itself.
If you are working on a server that is reached by the network by many other clients, then:
It could be a transient network problem,
High load of requests on the Server,
Deadlock or other problems related to multiprocess contention.
I suggest you troubleshoot your server in idle time, and if possible you detach the databases one by one and work to see which database is resulting in the problem. For this database, you go through the Stored Procedures and Functions and try to enhance them in terms of performance.

SQL Azure - Intermittent Long Running Query

I have a query that is intermittently running very slowly in SQL Azure
Runs in < 1 second in SSMS
Is submitted through Entity Framework through the application
Is NOT calling a stored procedure
Is passed parameters
Using DMVs determined that it runs and then enters a "Suspended" state
The wait type is indicated as IO_COMPLETION pointing towards waiting for a resource
This is in Azure so the normal server related monitoring is not available
Execution plan has been reviewed with no scans indicated
Issue will be occurring one day...all day, then with no changes to the database be cleared up the next morning
Once the issue was occurring then I couldn't login to the database for several seconds. Once I could the issue was corrected and the query performed as expected.
Any ideas on what could be causing this or other things that can be checked would be greatly appreciated!
Thanks in advance!

SQL Server 2012: A way to see if the database has been tampered with?

I have a delicate situation wherein some records in my database are inexplicably missing. Each record has a sequential number, and the number sequence skips over entire blocks. My server program also keeps a log file of all the transactions received and posted to the database, and those missing records do appear in the log, but not in the database. The gaps of missing records coincide precisely with the dates and times of the records that show in the log.
The project, still currently under development, consists of a server program (written by me in Visual Basic 2010) running on a development computer in my office. The system retrieves data from our field personnel via their iPhones (running a specialized app also developed by me). The database is located on another server in our server room.
No one but me has access to my development server, which holds the log files, but there is one other person who has full access to the server that hosts the database: our head IT guy, who has complained that he believes he should have been the developer on this project.
It's very difficult for me to believe he would sabotage my data, but so far there is no other explanation that I can see.
Anyway, enough of my whining. What I need to know is, is there a way to determine who has done what to my database?
If you are using identity for your "sequential number", and your insert statement errors out the identity value will still be incremented even though no record has been inserted. Just another possible cause for this issue outside of "tampering".
Look at the transaction log if it hasn't been truncated yet:
How to view transaction logs in SQL Server 2008
How do I view the transaction log in SQL Server 2008?
If you want to catch the changes in real time, I suggest you consider using SqlDependency. This way, when data changes, you will be alerted immediately and can check which user is using the database at the very moment (this could also be done using code).
You can use this code sample.
Coming to think about it, you can establish the same effect using a trigger and writing ti a table active users. Of course, if you are suspecting someone is tempering with data, using SqlDependency might be a better way to go with, as the data will be stored outside of the tampered database.
You can run a trace, for example a distant profiler trace, that will get all SQL queries containing the DELETE keyword. This way, nobody will be aware that queries are traced. You can also query the default trace regularly to get the last DELETE commands: Maintaining SQL Server default trace historical events for analysis and reporting

Failed to retrieve tables from database in SQL Server

I am trying to open the database in SQL Server 2012. But it is showing the following error:
Failed to retrieve data for this request.(Microsoft.SqlServer.Management.Sdk.Sft)
Additional Information:
An exception occurred while executing a Transact_SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
There is insufficient system memory in resource pool 'default' to run this query.
(Microsoft SQL Server, Error:701)
Any suggestion to resolve the problem ?
You get this error when the engine gets an OutOfMemeory exception while trying to perform an action. There isn't much you can do about this programmaticly because you are bumping up against the physical constraints of the machine that is hosting the SQL Server instance. Look at your system statistics if you still have uncommitted memory chances are you just need to increase the memory pool limit of the SQL engine. You will need an account with admin privs to do this. I have also run into this issue where query's are getting blocked at the server and queuing up, after a certain point you run out of memory to do anything and you have to restart the server so it's probably worth it to check the jobs pane and make sure you don't have a bunch of queries in the WAIT state.

SQL Server 2005 won't update rows

I currently have a SQL Server 2005 set up and has been running successfully for quite a long period of time without any issues.
As of this morning our website applications have been attempting to perform udpates on various rows. However, every time an update happens the data never gets updated in the database.
Our application's code hasn't been changed in any way, and there appears to be no errors of any kind.
Is there anything in SQL Server that can prevent updates from being performed on a database? Can the size of transaction logs prevent data from being updated on a SQL Server database? Or anything at all that can cause this strange behaviour?
We had similar behaviour on one of our servers and it was due to the log file being on a hard drive that had run out of disk space - so worth checking that.
Also check that the Autogrowth limits haven't been reached: