Thursday, November 30, 2017

Slipstream service pack, patch or cumulative updates with sql installation for 2012 and 2014

Slipstream service pack, patch or cumulative updates with sql installation for 2012 and 2014:
There are two scenario when we want to install SQL Server from scracth :
  1. There are service pack or updates which is required to add after installation.
  2. Or sql installation fails with some error and to resolve the issue Microsoft has released some cumulative updates.
In both the scenario we can install sql with all updates simultaneously using slipstream method, because you don’t want to first install the RTM version of the product and then manually patch the instance with the Service Packs, Cumulative Updates or Hotfixes that you think are needed
The method would be:
  1. Download SQL Server 2012/2014 media.
  2. Download all the needed SPs, CUs and Hotfixes that you want to “embed” and put all of the .exe files in one directory. (make sure they are executable files not in zipped format(unzip if not done already))
  3. Launch the setup.exe from CMD by issuing the command:
Setup.exe /Action=Install /UpdateEnabled=TRUE /UpdateSource=”path_to_the_directroy_where_the_hotfixes_are”
So let’s assume SQL installation setup file is in D:\SQL2014\ folder and hotfixex could be in same directory
D:\ Fixes\      Or  keep updates in same software path to ease copy method in next machine D:\SQL2014\updates folder
We can go to command prompt change current path to software path (D:\SQL2014\) and run below command as per update path in updatesource parameter:
Setup.exe /Action=Install /UpdateEnabled=TRUE /UpdateSource="D:\Fixes"
Setup.exe /Action=Install /UpdateEnabled=TRUE /UpdateSource=".\Updates"
No more it is required to manually start every single Service Pack then Cumulative update and Security Hotfix you need! Now you just put all of those in a folder and “point” SQL Server’s setup to that folder. 

Thursday, November 23, 2017

Find service account and status of SQL Service using TSQL

Since SQL server 2008R2 we can use DMV (sys.dm_server_services) to get service account  information, It gives us information about the current state of the services related to SQL Server that are currently installed.
SELECT  servicename,
FROM    sys.dm_server_services AS ;
In SQL 2008 R1 and 2005 there is way to use registry read command to get same information.
EXEC master.dbo.xp_regread
    @sa OUTPUT;