SQL Server: Understanding, Configuring, and Troubleshooting Log Shipping

Learn how to correctly configure and use SQL Server log shipping, including troubleshooting common problems. This course is applicable to all versions of SQL Server and is aimed at DBAs, developers, and system administrators.
Course info
Rating
(13)
Level
Beginner
Updated
Oct 31, 2017
Duration
1h 33m
Table of contents
Course Overview
Introduction
Log Shipping Overview
Log Shipping Preparation Tasks
Configuring Log Shipping
Monitoring and Troubleshooting Log Shipping
Migrating Data Using Log Shipping
Description
Course info
Rating
(13)
Level
Beginner
Updated
Oct 31, 2017
Duration
1h 33m
Description

SQL Server log shipping is a very useful technology for high availability and disaster recovery, as well for general purpose database movement, migration, and upgrades. In this course, SQL Server: Understanding, Configuring, and Troubleshooting Log Shipping, you'll first learn the basics of log shipping, its capabilities, and its limitations. Next, you'll learn how to prepare an environment for log shipping, and then how to configure log shipping, using either SQL Server Management Studio or T-SQL scripts. You'll learn how to monitor a log shipping environment and troubleshoot common problems, and finally you'll learn how to use log shipping for data migration and upgrading a database to a new version of SQL Server. When you've finished this course, you'll have the skills and knowledge to start configuring, using, and troubleshooting log shipping.

About the author
About the author

Glenn works as a Principal Consultant at SQLskills.com. He has been a SQL Server MVP since 2007, and he is also an Adjunct Faculty member at University College - University of Denver. He is the author of the book SQL Server Hardware (Redgate 2011), and he wrote chapters for both SQL Server MVP Deep Dives books.

More from the author
More courses by Glenn Berry
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
My name is Glenn Berry, and welcome to my course: SQL Server: Understanding, Configuring, and Troubleshooting Log Shipping. I'm a principal consultant with SQLskills, and this topic is one that I feel very passionate about. In the course of my career as a database administrator and consultant, I have used SQL Server log shipping extensively for basic HA/DR usage, and for migration purposes. Even though log shipping is a tried and tested technology, it is still a very useful technique to help achieve your RPO and RTO goals. I want to help give you the best practices and tools that you can use to have a smooth log shipping experience. I also want to show you how to properly configure and test your system to ensure an easy log shipping implementation. We will also cover how to migrate your existing data to a new system with virtually no downtime. If you work with SQL Server in any capacity, whatever your level, this course is relevant to you. Experience using SQL Server 2005 or newer is helpful along with a basic understanding of how SQL Server works. I hope you'll join me as we explore the world of SQL Server log shipping, with SQL Server: Understanding, Configuring, and Troubleshooting Log Shipping, here on Pluralsight.

Log Shipping Overview
Log Shipping Overview. In this module, we're going to cover log shipping operations in a lot more detail. Then we'll get into disaster recovery capabilities that you have with log shipping, and reporting capabilities that you have available with log shipping, and finally, how to use delayed log restores with log shipping. Log shipping operations. There's several key operations that occur to make log shipping work. The first one is backing up the transaction log on your primary server instance for each one of your log ship databases, and this is something that has to happen anyways when you're in the full recovery model. So now with log shipping, you're going to have a SQL agent job that backs up the transaction log for each one of your log ship databases on the primary server instance, and typically with log shipping, it's going to go to a file share on another server, not the primary server instance. The next operation is copying that transaction log backup file from that file share or wherever else it got backed up to, to the secondary server instance. So you'll have an agent job that runs on the secondary server instance that does that. Next, you have an operation where you have to restore the transaction log backup files that have been copied to the secondary server to the log ship databases that are running on the secondary server. So you'll have an agent job running on the secondary server instance that does this, according to whatever schedule that you set up. Finally, you're going to have to monitor log shipping with an agent job on your monitor server instance if you have one; otherwise, you can have it running on either your primary server instance or your secondary server instance, but typically in a best practice setup, you want to have a separate instance that's going to do all your monitoring.

Log Shipping Preparation Tasks
Log shipping preparation tasks. There are a number of things you're going to have to do before you can configure a log shipping partnership. This includes selecting the servers that are going to be involved in log shipping, configuring the settings and security necessary for log shipping, preparing the primary instance, preparing the secondary instances, and you might have more than one, and then finally, preparing the monitor instance. Select servers for log shipping. You're going to have go through and figure out what servers are going to be used for what part of the log shipping partnership. First, you have your primary instance, and that's where your principal workload is running right now before you've instituted log shipping, so that's sort of obvious. So that's going to be your primary instance, and then you might have one or more secondary instances where you have the log ship copy of your primary database running on another instance of SQL Server on another physical server or virtualized instance of SQL Server. And then finally, you're going to have the monitor instance, and this is an optional component, and it should ideally be running on another instance of SQL Server that's separate from the primary instance or any of the secondary instances. But that's not strictly required, and so if you do decide to have a monitor server, you've got to decide whether it's going to be a separate instance or not and then what server it actually will be.

Monitoring and Troubleshooting Log Shipping
Monitoring troubleshooting log shipping. There are a number of different ways of monitoring your log shipping setup. These include looking at the transaction log shipping status report in Management Studio, querying the SQL Server Error Log with T-SQL. You can also look at the log shipping history tables and query against them, and you can run the monitoring stored procedures that are built into the system. We're also going to talk about some of the common problems you often run into with log shipping in production. Monitoring prerequisites. If you're going to have a monitor server, you have to add it when you actually configure log shipping for the first time. If you add the monitor server later, you're going to have to remove and replace your log shipping setup, so you really want to do it when you set up log shipping in the first place; and a monitor server can't be changed without removing log shipping. So again, having a monitor server is something you need to plan for and implement when you first set up log shipping for each one of your databases. But keep in mind that one monitor server can handle multiple different databases that you log ship across different servers. Transaction log shipping status report. This is a standard report in SQL Server Management Studio that gets added when you configure log shipping. It calls the sp_help_log_shipping_monitor stored procedure in MSDB, and you want to run it on the monitor server to get the most complete information. If you run it on either one of the other servers, you're only going to see that server's view of what's going on. So, here's an example of what it looks like, and you can see that it shows you when your last backup was, the last copy, the last restore, and some other interesting information. So this is an easy to look at report that gives you a lot of information about you having to write any queries yourself.