Thursday, June 19, 2014

A network-related or instance-specific error occurred while establishing a connection to SQL Server

Error: 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Fix-:

The error refers that the SQL Remote connection is not working.
1) Check if SQL Server and SQL services are up and running. From the server where SQL is installed, try to connect to SQL using SQL Management Studio. 
2) If that works, from a remote server, try to connect to SQL Server/SQL instance using SQL Server Management Studio. 
You might get this error - i my case, SQL is SQL 2005









Here is what you have to do......

If you are running SQL 2005
a) Check if "SQL Server Browser" server is running. Start it if it is now.
b) Open "SQL Server Surface Area Configuration" and check if both 
    > Click "Surface Area Configuration for Services and Connections"
    > Click on "Remote Connections"
    > Local and Remote Connection should be enabled
c) Check SQL Server Configuration Manager for TCP/IP and Port configurations

If you are running SQL 2008 or SQL 2012
a) Check if "SQL Server Browser" server is running. Start it if it is now.
b) Check SQL Server Configuration Manager for TCP/IP and Port configurations


R.Hari.

Tuesday, June 17, 2014

SQL 2012 Upgrade - "Rule 'Previous Upgrade' failed." Error

SQL upgrade to SQL 2012 had failed at the first attempt and it gives error- "Rule 'Previous Upgrade' failed. A previous upgrade that failed was detected. To retry the upgrade, remove the upgraded feature that failed, and then run the upgrade again."  -on re-attempt.

Fix-1 - correct and the best way


1) Open a command prompt and navigate to 2012 install directory
For me it is D:\SQL2012Sp1\
2) Run the command “setup.exe /Action:RunDiscovery” as per the screenshot below


3) It opens the report in a web page like the one below

4) So here it shows
Database Engine Services = Version 11.0.2100.60
Full-Text and Semantic Extractions for Search = Version 11.0.2100.60
Installed but same time they do exist in Windows 2008 also because last upgrade failed.

So we need to un-install these two before we attempt to upgrade Windows 2008 again.
You can do it via below mentioned commands or using the GUI un-install window.

5) Setup.exe /Action=Uninstall /Instanceid=MSSQL11.MSSQLSERVER /Features=SQL /Q
Make sure that you change /Incanceid and /Features based on your Discovery Report.
In the command above command “/Features  = SQL” will remove Engine, Replication, Full Text and Data Quality this is what I had to run as Database Engine and Full-Text Search are the once listed in my Discovery Report.
You can use like “/FEATURES=SQL,AS,RS,IS,Tools” if you also have SSAS, SSRS, SSIS or SQL Tools listed in the discovery report.
6) Once it is removed, run the discovery report again to make sure that the 2012 features are completely removed and run the upgrade again.

Fix-2 (If Fix 1 is't helpful)


Here is what you have to do

1) Open Regedit
2) Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
3) Check though the Keys and look for "SQL Server 2012 Database Engine Service"

4) Once found, match "DisplayVersion" and "InstanceId" with the discovery report to double check.
5) Once that's confirmed, open "ModifyPath" and copy the value to a note pad










6) Add /X in the string
Note: /X is for uninstall
7) Open a command prompt and run the command











8) Yes to confirm and uninstall the product.

I my example, have to uninstall Full-Text Search also so,

1) Refresh the regedit screen and you will not be able to see "SQL Server 2012 Database Engine Service" now
2) I have to look for "SQL Server 2012 Full text search" and i found it here




















3) I have copied the Modify path and ran the uninstall command with /X switch to uninstall Full Text search also.

That's it!
Now we should be able to run 2012 upgrade again.

Good Luck!
R.Hari.