2

Recently our SQL server which contained the SharePoint Content Database got corrupted. So we recovered the database. After that we tried to point out SharePoint System to the recovered database and we started getting the SQL Connection Error as follows:

586 Critical Unknown SQL Exception 53 occurred. Additional error information from SQL Server is included below. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) 7d631cee-e9bd-49bb-acf0-39accab7a9c2 05/02/2017 21:13:33.67 OWSTIMER.EXE (0x9EE0) 0x49C0 SharePoint Foundation Database tzku High ConnectionString: 'Data Source=SP2013DB;Initial Catalog=SharePoint_Config;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max Pool Size=100;Connect Timeout=15;Application Name=SharePoint[OWSTIMER][1][SharePoint_Config]' Partition: NULL ConnectionState: Closed ConnectionTimeout: 15
05/02/2017 21:13:33.67 OWSTIMER.EXE (0x9EE0)

When we point it to a different backup of database, it works fine. But whenever we point the server to this recovered database we get SQL connection error. We are not able to figure out the reason for this.

Thanks.

  • 2
    so you restored the content database from backup on the same sql server with same name, right? service account have permissions on newly restore db? – Waqas Sarwar MVP May 2 '17 at 17:04
  • Yes it is super admin account. It has all the access. Strangely we have some other web application with separate DB which are running fine. Those databases were also restored and they are working fine. It is just one DB which was corrupted and then we recovered it. We are not able to get it back up and running. – Raxak May 3 '17 at 2:05
1

Let's check into the steps to resolve this error.

1) SQL Server should be up and running.

Go to All Programs >> Microsoft SQL Server 20XX >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Services, and check if SQL Server service status is “Running"

In addition, ensure that your remote server is in the same network. Run “sqlcmd -L” in your command prompt to ascertain if your server is included in your network list. Find All Servers From Local Network – Using sqlcmd – Detect Installed SQL Server on Network.

enter image description here

2) Enable TCP/IP in SQL Server Configuration

When two or more SQL Servers are connected across network they do all communication using TCP/IP. The default port of SQL Server installation is 1433. This port can be changed through SQL Server Configuration Manager. TCP/IP should be enabled for SQL Server to be connected.

Go to All Programs >> Microsoft SQL Server 20XX >> Configuration Tools >> SQL Server Configuration Manager >> Select TCP/IP

Right Click on TCP/IP >> Click on Enable

enter image description here

You must restart SQL Server Services for all the changes to take effect. Right click and go to menu properties to select location where default port of SQL Server can be changed.

3) Open Port in Windows Firewall

Windows Firewall is very efficacious in protecting the Operating system from all sorts of malicious attacks. By default, many of the ports and services are refrained from running by firewall. Time and again, SQL Server ports are not open in firewall as well. All the ports on which SQL Server is running should be added to exception and firewall should filter all the traffic from those ports. As described, by default SQL Server runs on port 1433, but if default port is changed then the new port should be added to exception. If SQL Server has named instance (another instance besides default instance) is installed, SQL Server browser should also be added to the exception, as described in Step 7.

Go to Control Panel >> Windows Firewall >> Change Settings >> Exceptions >> Add Port enter image description here

enter image description here

Make the following entries in popup “Add a Port” and click OK. Name : SQL

Port Number: 1433

Protocol: Select TCP enter image description here

enter image description here

4) Enable Remote Connection

Enabling remote connection is another important, yet oft-neglected step that is frequently missed by database administrators while setting up SQL Server. If this feature is turned off SQL Server will function smoothly on local machine, but it will let another server connect to it remotely. By default this feature is ON in SQL Server 20xx.

Right click on the server node and select Properties. enter image description here

Go to Left Tab of Connections and check “Allow remote connections to this server” enter image description here

5) Enable SQL Server Browser Service

If SQL Server is not installed as default instance but instead installed as named instance and also if there is no specific TCP/IP port configured, it will give rise to the error that is being discussed in this article. If SQL Server Browser service is enabled, it will allow the server to be connected through dynamic TCP/IP port. Enabling this service is a one-time process, as on enabling it once it will apply to all the instances installed on the same server.

Go to All Programs >> Microsoft SQL Server 20XX >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Browser enter image description here

Right Click on SQL Server Browser >> Click on Enable

6) Create exception of sqlbrowser.exe in Firewall

As elucidated in Step 6, sqlbrowser service needs to be enabled for named instance. Windows Firewall may prevent sqlbrowser.exe to execute. So, it is imperative to add exception for the same in windows firewall.

Search for sqlbrowser.exe on your local drive where SQL Server is installed. Copy the path of the sqlbrowser.exe like C:\Program Files\Microsoft SQL Server\XX\Shared\sqlbrowser.exe and create the exception of the file in Firewall, as delineated in Step 3.

7) Recreate Alias

It is getting quite common to create alias of SQL Server and use it in application. This will ensure that in future if any physical SQL Server has to be moved, it will not be required to change any code or connection string. You can simply create alias with the same name pointing to different SQL Server and it will start working instantaneously. I have observed that a couple of times due to internal error while recreating alias this error was fixed.

Go to All Programs >> Microsoft SQL Server 20XX >> Configuration Tools >> SQL Native Client 10.0 Configuration >> Aliases

Delete the alias that is giving problem and recreate it with identical parameters.

enter image description here

Hope this will resolve your issue.

  • This is all good and working. As I said, other web applications which is in the same server is running perfectly after db restore. Only the one database which got corrupted is not working correctly after recovery. When we point our web application to this database we get a 404 error. – Raxak May 3 '17 at 13:28
0

Delete the web application from central admin, dont delete the content, and re create the web application, in the same content db. (Try it in test FARM first rather doing it in production directly)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.