Wednesday, 19 November 2008

SSL Security error [DBNETLIB]ConnectionOpen (SECDoClientHandshake())

This particular resolution is one of its own kind their could have been other possibilites for his error message to raise, generally it comes if you have Expired Certificates or invalid Certificates on the Server for the user account or the computer account, delete the unwanted Certificates on the server and then try to start SQL or Connect should work

Other times this message comes if you had encryption enabled for the Server sometime but no more now, but then internally we are still finding the certificate somehow, though you anyways dont need the SSL certificate, so go to the following Registry and check for the Certificate value it should be EMPTY, but if it has ThumbPrint value of the Certifcate it is a problem, go ahead and make the change for Certificate value set to 0

HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib REG_SZ Certificate=0

Coming back to this unique problem:

Problem Description:
===============
Customer trying to enable SSL encryption for sql server connections on server
Customer went through the steps detailed in article 276553 (http://support.microsoft.com/?id=276553).

From one client (sql-td01) Customer is able to connect to the SQL Server 2000 using encrypted connections {he has forced encryption from the Client configuration, this client box where its working is a Windows 2003 SP1 box}. From Customers own desktop workstation {Windows XP sp2}, along with that of one of customers Clients box {Windows 2000} they are unable to connect to the SQL Server through encrypted connections.

They consistently receive the following error:
[DBNETLIB]SSL Security error[DBNETLIB]ConnectionOpen (SECDoClientHandshake()).
Customer has checked and re-checked and re-re-checked that his local workstation trusts the same root certificate authority (plus all intermediary issuing authorities) as does sql-td01 {the SQL Server}.
The certificate chains are identical on both machines.

Customer Enabled odbc tracing and attempted to login again from his local box. The log of that attempt is enclosed. It contains the following information:

osql -Sact-dd01 2764-1a88 EXIT SQLDriverConnectW with return code -1 (SQL_ERROR) HDBC 009A1830 HWND 00000000 WCHAR * 0x74329A38 [ -3] "******\ 0" SWORD -3 WCHAR * 0x74329A38 SWORD 2 SWORD * 0x00000000 UWORD 0
DIAG [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error (18)
DIAG [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (SECDoClientHandshake()). (271)
Operating System:Windows 2003 : where the Encrypted Client connections are working
Operating System: Windows XP Sp2 and Windows 2000 SP4 where the Client connections are not working using Encryption, though if the encryption is not enabled the connections will flow fine


Cause
=====
The cause is a DBNETLIB.DLL {Remember this is not a COM DLL}, the version compatibility of this DLL on the XP and Windows 2000 is the possible culprit, i dont think it is a BUG

Resolution
==========
1)
Check the for the following DLL's version on the Windows 2003 SP1 or SP2 Box
C:\WINDOWS\system32\DBNETLIB.DLL
Version: 2000.86.1830.0 {Windows 2003 SP1}

2)
Now Check the Version for the same DLL on the Windows XP Sp2 and Windows 2000 Sp4 box
In My case the Windows XP SP2 had the following version of the DBNETLIB.DLL
Version: 2000.85.1117.0

3)
The Windows 2000 SP4 box had the follwoing DLL version in my case
Version: 2000.85.1064.0

4)
So what i did was, i copied the DLL Version: 2000.86.1830.0 from the Windows 2003 SP1 box to the Windows Xp SP2 box and also to the Windows 2000 SP4 Box

Went to the following location on the Windows XP Sp2 box:

c:\windows\system32 and renamed the existing DBNETLIB.DLL to DBNETLIB.DLL.OLD
After that pasted the copied DLL version 2000.86.1830.0 on the XP Sp2 box in the following location c:\windows\system32\DBNETLIB.DLL {2000.86.1830.0} after that did a refresh and saw that the Version got back to the older version that is 2000.85.1117.0. Made a check in the DLLCACHE {c:\windows\system32\DLLCACHE} and saw that the DBNETLIB.DLL was present there and was having the Version 2000.85.1117.0 {so whenever the connection was made, this DLL from the cache was picked}, hence First paste the DBNETLIB.DLL {with version 2000.86.1830.0} in the DLLCACHE and then replace the actual DLL inside the c:\windows\system32.

Do a refresh and see if the DLL version is Showing as 2000.86.1830.0 on the XP Sp2 Box.
After this again try to connect to the SQL Server from this Client box {Make sure that Force Encryption is Checked in the Client Configuration}

The above resolved the issue with the SSL encryption errors, and the Secured channel is established

5)
Repeat the above Steps for a Windows 2000 SP4 box, and this should help in getting past through the problem

NOTE: Never try to Register this DLL, also it wont let you as well, as it is not a COM DLL, also replacing this DLL will never break anything as it is a System DLL and the version is upgraded through MDAC

Tuesday, 29 July 2008

Microsoft SQL Server 2005: Some issues with Installations and Service packs

Problem Description
===================
You are trying to install Client tools on a standalone machine and it fails with the following errors:While configuring the Work Station components:

"Microsoft document explorer" "cannot find one or more components. please reinstall the application"Click Ok and then you get

"Microsoft Visual Studio Macros" ""cannot find one or more components. please reinstall the application"

Click OK and then you get
---------------------------Microsoft SQL Server 2005 Setup---------------------------There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. ---------------------------OK ---------------------------
After this the complete Setup Rolls back and it fails going further


SOLUTION
========

Here are the steps we followed to get this resolved

1) Error in the Summary.txt

Sumary.txt shows {under 90/Setupbootstrap}===========================================Machine : E-CONTESTProduct : Workstation Components, Books Online and Development ToolsError : There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. --------------------------------------------------------------------------------Machine : E-CONTEST Product : Microsoft SQL Server 2005 Tools Product Version : 9.00.1399.06 Install : Failed Log File : C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files\SQLSetup0011_E-CONTEST_Tools.log Error Number : 1603 --------------------------------------------------------------------------------
SQL Server Setup failed. For more information, review the Setup log file in %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Summary.txt.
Also looked at the Tools log to figure out the actual cause==============================================Set_CommitFlag called successfully.CommittedPerfTime Stop: Set_CommitFlag : Tue Mar 25 23:51:42 2008MSI (s) (2C:A8) [23:51:43:033]: Note: 1: 1722 2: SqlWbSetup.5F46584E_060D_4BCB_ADEE_BD15A7BFCC2A 3: D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe 4: /setup MSI (s) (2C:A8) [23:52:06:242]: Product: Microsoft SQL Server 2005 Tools -- Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action SqlWbSetup.5F46584E_060D_4BCB_ADEE_BD15A7BFCC2A, location: D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe, command: /setup
Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action SqlWbSetup.5F46584E_060D_4BCB_ADEE_BD15A7BFCC2A, location: D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe, command: /setup MSI (s) (2C:A8) [23:52:06:398]: Executing op: Header(Signature=1397708873,Version=301,Timestamp=947502671,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=3)MSI (s) (2C:A8) [23:52:06:398]: Executing op: DialogInfo(Type=0,Argument=1033)

Conclude:-
=======

**************************************************************************************************The Error message is very clear, while firing the Sqlwb.exe /setup the issue occurred
**************************************************************************************************

2) The error kept on coming and based on the Tools log we went ahead and tried to run the .MSI package directly from the Tools Setup
%Tools\Setup\SQLrun_tools.msi and this time also the setup failed and the pop ups were the same, we decided to do the following:

3) Run the setup from SQLrun_tools.msi and when the pop-up mentioned below comes up
Microsoft SQL Server 2005 Setup
---------------------------
There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.
---------------------------OK
***********************DONT CLICK OK***********************

4) Go to CMD prompt and then browse till the IDE folder in the Drive where you are installing {\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE} and tried to manually start Sqlwb.exe /Setup along with a Filemon on the background but it failed with a different value
{Filemon is important here}
0xc0000135
You can download a Filemon from sysinternals Site

5) Then we opened the File mon and saw the following which we collected
=========================================================
304 1:45:44 AM cmd.exe:5716 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe SUCCESS Attributes: A 306 1:45:44 AM cmd.exe:5716 DIRECTORY D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\ SUCCESS FileBothDirectoryInformation: SqlWb.exe 308 1:45:44 AM cmd.exe:5716 OPEN D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe SUCCESS Options: Open Access: 001000A1 309 1:45:44 AM cmd.exe:5716 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe SUCCESS Attributes: A 310 1:45:44 AM cmd.exe:5716 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe SUCCESS Length: 819928 311 1:45:44 AM SqlWb.exe:5716 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe BUFFER OVERFLOW FileNameInformation 312 1:45:44 AM SqlWb.exe:5716 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe SUCCESS FileNameInformation 313 1:45:44 AM cmd.exe:5716 OPEN D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Manifest SUCCESS Options: Open Access: 001200A9 314 1:45:44 AM cmd.exe:5716 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Manifest SUCCESS Length: 1076 315 1:45:44 AM cmd.exe:5716 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Manifest SUCCESS Length: 1076 316 1:45:44 AM cmd.exe:5716 OPEN D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Config SUCCESS Options: Open Access: 001200A9 317 1:45:44 AM cmd.exe:5716 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Config SUCCESS Length: 337 318 1:45:44 AM cmd.exe:5716 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Config SUCCESS Length: 337 322 1:45:44 AM csrss.exe:1260 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Manifest SUCCESS Attributes: A 323 1:45:44 AM csrss.exe:1260 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Config SUCCESS Attributes: A 324 1:45:44 AM csrss.exe:1260 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Manifest SUCCESS Attributes: A 436 1:45:44 AM cmd.exe:5716 CLOSE D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Manifest SUCCESS 437 1:45:44 AM cmd.exe:5716 CLOSE D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Config SUCCESS 438 1:45:44 AM cmd.exe:5716 CLOSE D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe SUCCESS 439 1:45:44 AM SqlWb.exe:5452 OPEN D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE SUCCESS Options: Open Directory Access: 00100020 440 1:45:44 AM SqlWb.exe:5452 QUERY INFORMATION D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe.Local\ NOT FOUND Attributes: Error 441 1:45:44 AM SqlWb.exe:5452 QUERY INFORMATION C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474 SUCCESS Attributes: D 442 1:45:44 AM SqlWb.exe:5452 OPEN C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474 SUCCESS Options: Open Directory Access: 00100020 443 1:45:44 AM SqlWb.exe:5452 OPEN C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474\ATL80.DLL NOT FOUND Options: Open Access: 00100021 444 1:45:44 AM SqlWb.exe:5452 OPEN C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474\ATL80.DLL NOT FOUND Options: Open Access: 00100020 488 1:45:48 AM SqlWb.exe:5452 CLOSE C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474 SUCCESS 489 1:45:48 AM SqlWb.exe:5452 CLOSE D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE SUCCESS

Here is the problem
===================
443 1:45:44
AM SqlWb.exe:5452 OPEN C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474\ATL80.DLL NOT FOUND Options: Open Access: 00100021 444 1:45:44 AM SqlWb.exe:5452 OPEN C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474\ATL80.DLL NOT FOUND

4) The sqlwb needs this dll called ATL80.dll under WinSxS folder, looks like the DLL is not found

5) We Clicked on search and tried to find the DLL at customers end it gave the following location:
C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_6e805841

6)We then checked with the one where its unable to find the DLL
C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474\ATL80.DLL NOT FOUND

Cause
======
Here is the problem, the DLL when searched by sqlwb.exe is been searched at C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474
And when we got to this folder the ATL80.dll is not present
But the DLL is present at the following place: C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_6e805841
But this is not refrenced by SQlwb.exe and if you closely look the version is also different

Folder where the DLL is currently present is:
=============================================
Folder:C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_6e805841 and DLL version: 8.0.50727.42 DLL name ATL80.DLL

Folder looked when SQLwb runs is:
================================
Folder: C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474: and Dll version: 8.0.50727.762 DLL name ATL80.DLL

Checked in the Folder the folder is empty
We then went into another box and searched for the same version of DLL for ATL80.dll that is 8.0.50727.762

We got it from one different working box and we replaced the ATL80.dll from there to this
Problematic box in the following folder:
C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_CBB27474

Things started to work after that..........

Sunday, 23 March 2008

Introduction to SQL Server 2000 Administrative Tools

Microsoft SQL Server 2000 is a full-featured relational database management system (RDBMS) that offers a variety of administrative tools to ease the burdens of database development, maintenance and administration. In this article, we'll cover six of the more frequently used tools: Enterprise Manager, Query Analyzer, SQL Profiler, Service Manager, Data Transformation Services and Books Online. Let's take a brief look at each:

Enterprise Manager is the main administrative console for SQL Server installations. It provides you with a graphical "birds-eye" view of all of the SQL Server installations on your network. You can perform high-level administrative functions that affect one or more servers, schedule common maintenance tasks or create and modify the structure of individual databases.

Query Analyzer offers a quick and dirty method for performing queries against any of your SQL Server databases. It's a great way to quickly pull information out of a database in response to a user request, test queries before implementing them in other applications, create/modify stored procedures and execute administrative tasks.

SQL Profiler provides a window into the inner workings of your database. You can monitor many different event types and observe database performance in real time. SQL Profiler allows you to capture and replay system "traces" that log various activities. It's a great tool for optimizing databases with performance issues or troubleshooting particular problems.
Service Manager is used to control the MSSQLServer (the main SQL Server process), MSDTC (Microsoft Distributed Transaction Coordinator) and SQLServerAgent processes. An icon for this service normally resides in the system tray of machines running SQL Server. You can use Service Manager to start, stop or pause any one of these services.

Data Transformation Services (DTS) provide an extremely flexible method for importing and exporting data between a Microsoft SQL Server installation and a large variety of other formats. The most commonly used DTS application is the "Import and Export Data" wizard found in the SQL Server program group.

Books Online is an often overlooked resource provided with SQL Server that contains answers to a variety of administrative, development and installation issues. It's a great resource to consult before turning to the Internet or technical support.