Wednesday, August 29, 2018

Testing SQL connection using file.udl trick

Besides the usual
>telnet SQLname 1433

One can create a file and open it (note: show the extention in your File Explorer settings)
TestDatabase.udl 


Source
https://dougrathbone.com/blog/2013/11/18/testing-connectivity-to-microsoft-sql-server-without-any-tools-installed

Friday, August 24, 2018

Set Default template for SSMS New Query button by editing SQLFile.sql




  1. Go to SQL install path, for me it's "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql"
  2. Edit the SQLFile.sql in Admin mode
  3. Type in whatever you want for default
  4. Save and try in SSMS [New Query] button



Source
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b56b9ed6-1786-4ad6-87c9-7e4e81068672/how-to-set-the-default-query-for-the-ssms-new-query-button?forum=transactsql

Friday, May 18, 2018

SQL Cluster Registry Checkpoint

Error
[sqsrvres] GetRegKeyAccessMask: Could not get registry access mask for registry key Software\Microsoft\Microsoft SQL Server\MSSQL10.HA5\Replication (status 2)).



Fix - Populate the registry to the other node

https://www.mssqltips.com/sqlservertip/3440/registry-check-pointing-in-a-windows-cluster-to-bring-sql-server-online/

https://sqlserver-help.com/2015/04/17/information-checkpoint-in-sql-server-cluster-resources/

> cluster res /checkpoints

Find your resource name to replace below
Run in cmd (Admin)

cluster res "SQL__YKF" /addcheck: "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.HA5\Cluster" 
cluster res "SQL__YKF" /addcheck: "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.HA5\MSSQLServer" 
cluster res "SQL__YKF" /addcheck: "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.HA5\Replication" 
cluster res "SQL__YKF" /addcheck: "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.HA5\Providers" 
cluster res "SQL__YKF" /addcheck: "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.HA5\SQLServerSCP" 
cluster res "SQL__YKF" /addcheck: "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.HA5\CPE" 
cluster res "SQL__YKF" /addcheck: "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.HA5\SQLServerAgent"


Tuesday, April 17, 2018

2008 Cluster install fails on newer Windows 2012/2016

Tried to install SQL 2008 R2 on Windows 2016 = fails, cluster verification fails
SQL 2014 was a-okay

PowerShell (Admin mode)
Install-WindowsFeature -Name RSAT-Clustering-AutomationServer

Error to install SQL Server 2008 on Windows 2012 – Marcelo's Spaces
https://marcelodba.wordpress.com/2014/08/17/error-to-install-sql-server-2008-on-windows-2012/

https://manjusullad.wordpress.com/2015/11/26/unable-to-install-sql-2008-on-windows-server-2012-failover-cluster/

Tuesday, August 15, 2017

SQL Server 2008 Add Cluster Node workarounds

I haven't installed/added SQL 2008 cluster node for so long, but just today I had to use 2 workarounds just to get it working. Whew

First workaround, Cluster Validation was good but SQL installer still complained
https://support.microsoft.com/en-ca/help/953748/error-message-when-you-install-sql-server-2008-on-a-windows-server-200

Setup /SkipRules=Cluster_VerifyForErrors /Action=AddNode


Second Workaround is actuall a MS Bug, where I had to comment out the pre-saved license key in the installer folder and entered it manually instead
https://digitaljive.wordpress.com/2009/06/22/%E2%80%9Cthe-current-sku-is-invalid%E2%80%9D-when-adding-second-node-to-sql-2008-cluster/

https://support.microsoft.com/en-nz/help/957459/fix-error-message-when-you-try-to-add-a-second-node-to-a-sql-server-20

Basically go to \x64 folder and modify the Defaultsetup.ini file to comment out the serial number (and paste it in during install)
;SQLSERVER2008 Configuration File
[SQLSERVER2008]
;PID="XXXXXXXXXXXXX"