Apply SQL Server service pack In a Single Step using Command Prompt

SQL Server Patching

I’m going to share something that I use whenever I patch a server, as I am fairly sure that it will help anyone else who has to patch SQL Server on a regular basis. Especially those of us who manage large SQL Server estates.

Applying SQL Service Pack can be performed by Using Command Prompt in a Silent mode.

  1. Create folder D:\install on the windowsbox or create this folder on a fileserver.
  2.  Download SQL Server 20XX Service Pack X (SQLServer20XXSPX-KBXXXXXX-XXX-LLL.exe) from Microsoft Siteand save the file to D:\install or on to the network shared drive.
  3. Click on the Start button on the task bar, click run, type the command CMD.exe, open this by Run as Administrator ,which opens the MS-DOS shell command prompt.
  4. Now root the command prompt directory to D:\Install directory as SQL SP is placed on this location.

If your SQL SP is network Share and you want to copy the file to local target server , then we use Robocopy method from command prompt to copy the file

Execute below Robocopy command in Command Prompt for copying a File:

Robocopy “\\NetworkShare\Folder\SPX” “D:\Install\SPX” /MIR

After copying the file run below command in Command Prompt for Clustered Instances:

“D:\Install\SPX\SQLServer20XX-KBXXXXXX-x64.exe” /SkipRules=Cluster_IsOnlineIfClustered /action=Patch /allinstances /qs /IAcceptSQLServerLicenseTerms

The above command will patch for all Instances installed on the Machine or WindowsBox.

Run below command in Command Prompt for Standalone Instances :

D:\Install\SPX\SQLServer20XXSPX-KBXXXXXXX-x64-ENU.exe /allinstances /quiet

The above command will patch for all Instances installed on the Machine or WindowsBox.

If you want to install a Service pack to Specific Instance from command prompt use below command :

D:\Install\SPX\SQLServer20XXSPX-KBXXXXXXX-x64-ENU.exe /instancename=YourInstanceName /quiet

The /quiet switch runs the update in unattended mode in the background .

Hope this  post saves your time for installing sql service pack and it helps you a lot.

 

 

 

 

 

 

 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.