Patching SQL Server is an ongoing process. Service packs and cumulative updates are being regularly released, in order to apply possible bug fixes as well as provide additional functionality. This article, suggests a procedure for how to patch a standalone SQL Server instance.
First Patch SQL Server on the TEST Environment
First, always patch the respective SQL Server on the Test environment.
Here’s the suggested procedure:
- Plan ahead – inform application owners – get approvals
- Stop all application/services that connect to the SQL Server instance
- Backup server (OS)
- Backup all user databases
- Backup the system databases: master, model, msdb
- Backup the resource database via file system – copy files to a safe location (use the query in the appendix below to find resource database’s files location)
- Install patches
- Reboot server
- Make sure that SQL Server and related services are started
- Start application/services that connect to the SQL Server instance
- Certify that everything works well on the Test server after the installation of patches is completed.
- You need to get acceptance by all affected parties (i.e. IT users, application owners, etc.).
- If there is a problem, you will have to troubleshoot in order to resolve it
- In the unfortunate case where you cannot resolve the problem, as a last resort, you can follow a rollback procedure which involves the following but is not limited to:
- Uninstall the patch(es) previously installed
- Restore the system databases as well as the resource database (both data and log files)
- Reboot the server
- Check if everything is back to normal, that is the state of SQL Server just before the patching started
- If there is still a problem, restore server (OS) from the backup taken prior to start the process
- Check if all user databases are OK. If not, restore them from the backup taken prior to start the patching process.
- Check again if everything OK
Strengthen your SQL Server Administration Skills – Enroll to our Online Course!
Check our online course on Udemy titled “Essential SQL Server Administration Tips”
(special limited-time discount included in link).Via the course, you will learn essential hands-on SQL Server Administration tips on SQL Server maintenance, security, performance, integration, error handling and more. Many live demonstrations and downloadable resources included!
When to Proceed with Patching SQL Server on Production
If everything is OK on the TEST environment after the patching and you have the green light to proceed with patching Production (i.e. approvals/acceptance by business users/application owners, etc.), then you may follow the same steps as above for the Production standalone server (note: make sure you get approval for an adequate amount of downtime and also take into consideration possible unexpected problems during the patching process).
Tip: T-SQL Script to Find the Location of SQL Server Resource Database
By running the below T-SQL script, you can find the location of the Resource Database of your SQL Server instance(s).
USE master; GO SELECT 'ResourceDB' AS DBName , [name] AS DBFile, [filename] AS FilePath FROM sys.sysaltfiles WHERE dbid = 32767; GO
Featured Online Courses:
- AI Essentials: A Beginner’s Guide to Artificial Intelligence
- SQL Server 2022: What’s New – New and Enhanced Features
- Working with Python on Windows and SQL Server Databases
- Introduction to Azure Database for MySQL
- Boost SQL Server Database Performance with In-Memory OLTP
- Introduction to Azure SQL Database for Beginners
- Essential SQL Server Administration Tips
- SQL Server Fundamentals – SQL Database for Beginners
- Essential SQL Server Development Tips for SQL Developers
- Introduction to Computer Programming for Beginners
- .NET Programming for Beginners – Windows Forms with C#
- SQL Server 2019: What’s New – New and Enhanced Features
- Entity Framework: Getting Started – Complete Beginners Guide
- Data Management for Beginners – Main Principles
- A Guide on How to Start and Monetize a Successful Blog
Read Also
- How to Patch a SQL Server Failover Cluster
- How to Add a Database to a SQL Server Availability Group Using T-SQL
- SQL Server Installation and Setup Best Practices
- How to Fix SQL Server Agent Not Showing in a Failover Cluster
- Top 10 SQL Server DBA Daily Tasks List
- The feature you are trying to use is on a network resource that is unavailable
- The “Public” Database Role in SQL Server
- Encrypting a SQL Server Database Backup
- Learn Azure Data Lake Analytics by Example
- Azure Cosmos DB: Learn by Example
- How to Create an Azure SQL Server Virtual Machine
- How to Backup a SQL Server Database from On-Premises to Azure Storage
- SQL Server Versions Currently Supported and their End Dates
- What are SQL Server Statistics and Where are they Stored?
- How to Resolve: The feature “Scale-out deployment” is not supported in this edition of Reporting Services
- … more
Featured Database Security and Administration Tool: DBA Security Advisor
DBA Security Advisor: Secure your SQL Server instances by scanning multiple instances against a rich set of security checks, and by getting recommendations and remediation steps.
Subscribe to our newsletter and stay up to date!
Subscribe to our YouTube channel (SQLNetHub TV)
Easily generate snippets with Snippets Generator!
Secure your databases using DBA Security Advisor!
Check our latest software releases!
Check our eBooks!
Rate this article:
Reference: SQLNetHub.com (https://www.sqlnethub.com)
© SQLNetHub
Artemakis Artemiou is a seasoned Senior Database and AI/Automation Architect with over 20 years of expertise in the IT industry. As a Certified Database, Cloud, and AI professional, he has been recognized as a thought leader, earning the prestigious Microsoft Data Platform MVP title for nine consecutive years (2009-2018). Driven by a passion for simplifying complex topics, Artemakis shares his expertise through articles, online courses, and speaking engagements. He empowers professionals around the globe to excel in Databases, Cloud, AI, Automation, and Software Development. Committed to innovation and education, Artemakis strives to make technology accessible and impactful for everyone.