The timeout period elapsed prior to completion of the operation or the server is not responding in SQL Server 2008 R2 - sql

One of my Windows login is trying to connect to SQL Server 2008 R2 Express; he is facing this issue:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
This Issue appears only once a day i.e. when the initial request is made to connect to the server.
I have tried with my SA login but I didn’t find any issue for the first time login in a day.
He has tried connecting to SQL Server with server name as well as IP address but that hasn’t solved the issue.
Can anyone please resolve this issue?
Thanks in advance.

This thread seems to describe your problem:
http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/58bd9c4d-0572-4567-8e32-82a7fd600022
Yes, i have fixed this problem.
My windows server 2008 was configured to reject SASL LDAP binds (see
warning 2886).
Since i have configured my server to not reject such binds, sql server
2008 connections work correct.
or
I was able to solve the problem of not being able to connect on the
first attempt by configuring the instance of SQL Server to listen on a
static port and adding an exception for that port to the firewall.
You could look here for info.
Less likely, but it's also possible you have Auto_Close enabled.
When set to ON, the database is shut down cleanly and its resources
are freed after the last user exits. The database automatically
reopens when a user tries to use the database again.
When set to OFF, the database remains open after the last user exits.

Related

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 does not exist or access denied (intermittently)

I use a Microsoft Access 2010 front end with linked tables on an SQL Server 2012 installation. Local network.
When Access Starts, a VBA script runs which connects to the SQL server and performs some checks.
I recently upgraded from SQL Server 2008 to 2012, that's when the connection between client and Server started to fail intermittently.
When the connection between my client and the server fails, I see a generic message "SQL Server does not exist or access denied". This is covered in a Microsoft support article http://support.microsoft.com/kb/328306. The potential causes detailed in that article do not match the trouble I am encountering.
This connection issue is intermittent. The trouble arises about 3 times a week and lasts for about 30 minutes at a time. Between these 30 minute failures, the the system works perfectly.
My Current VBA Connection String: (have tried several, trouble persists with all of them):
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.Open "Provider=SQLOLEDB;Server=Server3.companydomain.local;Database=My_Database;Trusted_Connection=Yes"
I hope that I can find something in the SQL Server Logs (which I do have access to) but I do not know which Log file to investigate.
I do not have a direct answer to your question, but I believe you could start by exploring the IP and ports on which the SQL server is listening to...Is is possible that the machine using DHCP to assign IP for the DB server as well? In this case I guess it could happen when the IPs are refreshed.
We had a similar issue where multiple IPs were getting assigned on the same machine (having multiple NIC connected) which created such intermittent disruptions.
Well it's been 7 months. Here is the solution for this problem (in my case):
My secondary DNS Server was an external Server. It could not look up my database (192.168.x.x) because this is an internal address.
When My application called the Primary DNS Server to look up the SQL Server address, it worked fine. When my primary DNS was busy, and the application failed over to secondary DNS- the request would time out. There are many reasons someone may see this error. That is the reason I was seeing it.
It's a little strange, but I've found I get this error when I don't have proper "CLOSE DB CONNECTION" type code on my site. And then when too many users hit the site, I start getting this error.
Solution: Do a hard Close of DB connections, after every db call. Yes, most DB Connectors have cleanup routines, but it's not enough under heavy load.
Also, implement a high DB connection limit in the web.config

Issues connecting to sql server from outside domain

I am having issues connecting to sql server either through SSMS or my C# application.
One thing to note is that I am out of my work domain. But I have in the past worked from home before and didn't had any issues. Maybe once but I restarted and it worked. But it's not working today.
Microsoft SQL Server ERROR 2
Establish whether the correct port is open and listening (TCP port 1433 by default) you may need to speak to your network administrator for this.
The SQL Server Browser Service may also need to be running.
If not the above then perhaps an authentication issue...
Finally managed to fix it. Logged on to sql server configuration manager and under sql server services I noticed that all the services were stopped. Just started the SQL Server (MSSQLSERVER) manually and everything is back to normal.
Thank you everyone for your time and input. Much appreciated.

Has anybody ever used QaasWall to prevent brute force attacks?

We suffered a brute force attempt on our SQL database yesterday and obviously want to prevent this from happening again. The bot or whatever it was was trying to log into the sa account about 30 times a second so in the first instance we have changed the sa account and restricted the IP range that can access SQL via windows firewall. We are also considering disabling the sql server browser and changing the default port.
The problem is none of these things will prevent malicious log in attempts.
I came across a piece of open source software called QaasWall and wondered if anybody had used it and whether it is reputable.
Here is a link to the project site: http://sourceforge.net/projects/qaaswall-window/
Any other tips on how to restrict the number of server log in attempts would be greatly appreciated.
Many thanks.
Clayton.
The best solution is completely disabling access to the database from all hosts which do not need it. E.g. by binding to localhost if the DB is only accessed locally or blocking any connections to the IP/port used by the DB in your firewall.
TheifMaster is correct...the SQL Slammer was really vicious, but installing SQL Server SP3 or SP4 fixed the vulnerability in the sql server listner that this worm exploited. When you install SQL Server 2000 Pre-SP3 from disk your server will get pinged to death...this is why I disable the network connections while installing SQL Server until I can get it fully updated.
I recently installed QAAS Wall on one of my W2003 Servers and it works, but I'm having some difficulties getting the whitelist to work property. It keeps blocking access from one of my database servers.

Sql Server Agent Required For Remote Connections?

I'm connecting to a remote sql server instance with the following connection string
"Network Library=DBMSSOCN;Data Source=xx.xxx.x.xxx,1433;Initial Catalog=MyDatabase;User Id=MyUserId;Password=MyPassword;Connect Timeout=120;"
Sql Server Browser is running
Local and remote connections are allowed using TCP/IP only
The application randomly fails to connect citing the following SqlException
TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Code to connect as follows
using (SqlConnection connection = new SqlConnection(m_ConnectionString))
{
connection.Open(); // falls over here
}
I thought about Firewall config on port 1433 but why would the Firewall sometimes permit connections and sometimes not?
Is Sql Server Agent required to be running? And if so why as the description of Sql Server Agent on MSDN is not obvious in this respect?
Thanks!
EDIT: Tried adding an explicit rule on the Firewall to open up 1433 and so far so good, but could be randomness again so hard to say if I fix or not yet
No, SQL Server Agent does not need to be running. SQL Server agent is only needed to execute scheduled tasks on the SQL server.
This is probably a network issue. Can you ping the server? If so, try to ping it continuously with /t and see if all packets arrive.
It could also be a problem with the SQL server load. Is the server idle or under load?
Could you test the application locally on the SQL server or on the same LAN to see if the problem persists?
Well you don't need SQL Server Agent running now, the error suggest you are getting a timeout from the scenario.
There are various reasons why you may be blocked. Perhaps the firewall is configured to allow only a certain number of connections at a port at one time. Or the database itself is limiting the number of connections. Your internet is slow and you are hitting the 120 seconds timeout. The list goes on. :)
Your SQL Server database is going to sleep. The first time you try to connect to it, it has to restart and your connection times out.
Make sure the option "Auto Close" is set to "False". This prevents it from shutting itself down after the last connection is closed.
http://itknowledgeexchange.techtarget.com/sql-server/auto-close-is-almost-as-bad-as-auto-grow/