1. Trang chủ
  2. » Công Nghệ Thông Tin

Brad’s Sure Guide to SQL Server Maintenance Plans- P4 doc

5 289 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 452,76 KB

Nội dung

16 Goals of this Book As I cover how to use the Maintenance Plan Wizard and Maintenance Plan Designer in this book, I have tried to keep the following goals in mind: • to keep the book at a level that most non-professional DBAs can understand • not only to cover the mechanics of how to use the Maintenance Plan Wizard and Maintenance Plan Designer, but also to offer practical advice on how best to maintain your databases • to provide an easy-to-read, tutorial approach to learning • to offer lots of best practices from the real world. SQL Server Editions Covered in this Book This book covers the use of the Maintenance Plan Wizard and the Maintenance Plan Designer for SQL Server 2005 and SQL Server 2008, including both the Standard and Enterprise editions. If you are running SQL Server 2005, you should be on Service Pack 2 or later, as Service Pack 2 introduced some changes in the Maintenance Plan Wizard and Maintenance Plan Designer which make it closer in functionality to SQL Server 2008. All the screenshots and examples are from SQL Server 2008, which, on occasion, varies from SQL Server 2005. When there are significant differences, I will point them out. SQL Server 2000 and earlier is not covered because Maintenance Plans changed substantially between SQL Server 2000 and SQL Server 2005. Although the implementation changed quite a bit, the database maintenance recommendations I make in this book still apply to SQL Server 2000 and earlier. 17 Chapter 1: Why is Database Maintenance Important? More times than I can count, I have seen a company install SQL Server databases without first creating any form of maintenance plan. These servers hum merrily along with nary a problem. That is, until there is a problem. At this point, query performance drops drastically or servers run out of disk space or, in extreme cases, databases become corrupt. And oh, by the way, nobody ever bothered to set up a backup plan, so there are no backups to restore. Oops! The goal of implementing a database maintenance plan is to help prevent the kinds of problems just described. If implemented correctly, a database maintenance plan can help ensure that a SQL Server's databases perform adequately and, if there should be a problem, provide the necessary backups to minimize the loss of any data. Another benefit of implementing a database maintenance plan is that it helps to prevent, or to catch early, many different kinds of database-related problems. By being proactive with a good maintenance plan, time spent troubleshooting problems after the fact is often reduced. In this chapter, we'll review some of the most important database maintenance tasks with which a DBA must be concerned, such as database backups and integrity checks, which will be included in virtually every database maintenance plan. We'll then consider the four major tools available to implement these maintenance tasks. We'll focus on the two tools that are at the heart of this book, namely the database Maintenance Plan Wizard and the Maintenance Plan Designer, but we will also consider the options of using T-SQL scripting and PowerShell scripting. The Scope of Database Maintenance If you were to ask ten different DBAs to define "database maintenance," you would probably get ten different answers. The problem is that the term "database maintenance" is not clearly defined within the DBA community. Taken literally, the term refers to the maintenance of SQL Server databases. However, most DBAs confer on the term a more general meaning, encompassing maintenance of not only the databases, but also the SQL Server instances on which they reside, the OS, and the physical box on which SQL Server runs. Every part of the larger SQL Server environment needs to be carefully managed and maintained in order to assure a high level of performance and availability. However, for the Chapter 1: Why is Database Maintenance Important? 18 purposes of this book, I am going to interpret the term quite literally, and define it as follows: Definition: Database maintenance plan A database maintenance plan is a set of specific, proactive tasks that need to be performed regularly on databases to ensure their adequate performance and availability. In other words, this book focuses solely on databases and on how to use the Maintenance Plan Wizard and the Maintenance Plan Designer to do basic database maintenance. Important as they are, this book does not cover other issues surrounding the health of the broader SQL Server ecosystem. As such, while everything in this book is important, it is only a subset of all the things that a DBA needs to do to maintain healthy SQL Servers. For more information on these broader topics, do an Internet search on "SQL Server Best Practices" to find additional information. My goal in this book, indeed the goal of the Maintenance Plan Wizard and Designer, is to cover those critical database maintenance tasks that, as a bare minimum, should be applied to all databases, to ensure adequate performance and availability. Is "adequate" as opposed to "optimal" performance good enough? This, ultimately, is a business decision, based on the nature of the business function that a given database supports, and on the amount of time, resources, and money that the organization is prepared to invest. If an organization doesn't have the resources (or isn't willing to expend them) then, up to a point, it has to accept slower performance and lower availability from its SQL Servers. This is a perfectly rational choice. Many SQL Server instances, especially those with small databases or a small number of users, often don't need to be "optimized to perfection" for performance, or even to be highly available. If a query takes 15 seconds to return a result, or if a database goes down for a couple of hours, or even a day, the organization will continue to function. In such cases, the Maintenance Plans covered in this book will suce to ensure that the databases operate smoothly, and with acceptable performance. They will also be well suited to the main target audience of this book; namely accidental DBAs, or full-time DBAs who are just starting out, and who manage smaller non-mission-critical SQL Server installations. The same argument does not hold for databases that support mission-critical business functions. In these cases, you will also need to invest time in creating more flexible and powerful maintenance plans, probably using T-SQL or PowerShell scripting, rather than using the Database Maintenance Wizard and Designer. Of course, organizations that choose to have highly performing and highly available SQL Servers have to make a large resource investment to attain this goal. There is no right or wrong maintenance plan; just different choices based on different needs. Chapter 1: Why is Database Maintenance Important? 19 Dierent Approaches to Database Maintenance There are many different ways that DBAs can choose to perform database maintenance. In this section, we'll take a look at four of these options, including their pros and cons. This should allow you to determine which option is best suited to your particular needs. As noted earlier, the focus of this book is on the first two of these tools: the Maintenance Plan Wizard and the Maintenance Plan Designer. Maintenance Plan Wizard The Maintenance Plan Wizard is one of two tools that SQL Server provides to create Maintenance Plans. A note on terminology SQL Server uses the term "Maintenance Plan" (note the capitalization) to refer to a database maintenance plan created using either the Maintenance Plan Wizard or the Maintenance Plan Designer. Under the covers, each Maintenance Plan takes the form of an SSIS package, which is then scheduled to run under one or more SQL Server Agent jobs, and will perform the various tasks that make up a database maintenance plan. We'll cover this in more detail in Chapter 3. The goal of the Maintenance Plan Wizard is to guide you, step by step, through the creation of a Maintenance Plan, without the need to do any coding, thus making the whole process easy and quick. While the Wizard doesn't include every possible database maintenance feature or option, it does include the core database maintenance tasks that all DBAs should be performing on their SQL Servers. As such, it is often an appropriate tool for the part- time/accidental DBA, or even for full-time DBAs. For example, if the databases are small, the number of users is low, high server availability is not required, and there are available maintenance windows, then this tool is more than adequate in most cases. Chapter 1: Why is Database Maintenance Important? 20 It also has the following advantages: • The resulting Maintenance Plan can be modified and extended, if necessary, using the Maintenance Plan Designer. Many DBAs use the Wizard to create their "base" Maintenance Plan, and then use the Designer to tweak it. • The tool includes an option to create Multiserver Maintenance Plans, meaning that you can create Maintenance Plans for multiple servers in a single step. However, this feature is awkward to configure and has some backwards compatibility problems, so it may not work for all SQL Server environments. As such, I tend to avoid using it. The same feature is available in the Maintenance Plan Designer and is discussed briefly in Chapter 16 (though it has the same drawbacks). In many ways, the Maintenance Plan Wizard does attain its goal of easing the creation of database maintenance plans. However, it falls short in some areas, and can cause problems for the incautious. The Wizard assumes that you fully understand every option that it offers to you, and how each affects your databases. If you don't understand the options, and you guess at their meaning, it is very easy to create a Maintenance Plan that performs terribly. Unfortunately, the Wizard is not smart enough to prevent you making these poor choices. However, in this book, I will fully explain all these options so that you can use the tool to its full advantage, and avoid such performance issues. As useful as the tool can be, DBAs must be fully aware of what it can and can't do. Having created a few Maintenance Plans with the Wizard, some novice DBAs confidently assume that that their databases are fully maintained. As we have already discussed, the Maintenance Plan Wizard only performs core maintenance tasks, rather than every possible database maintenance task that should be considered for a given database or server. For example, just because you create backups with the Wizard, this does not ensure that the backups are good (restorable), or that they have been moved off the server to protect them should the SQL Server instance experience a disk failure. Such tasks (other examples are covered a little later in this chapter) have to be done outside of the Maintenance Plan Wizard. The Wizard also has the following specific shortcomings: • Limited number of database maintenance options. If you need database maintenance options that are not provided, you'll have to resort to T-SQL or PowerShell scripts, or to use scripts for some tasks and the Wizard for others. • Lack of granularity. For example, the Maintenance Plan Wizard can't determine which indexes need to be rebuilt, and which ones don't need to be rebuilt, and therefore has to rebuild them all. As such, it often takes more time to execute a Maintenance Plan created with the Wizard than a custom plan created using T-SQL or PowerShell scripts. • Inability to run multiple tasks. Each type of maintenance task within a single Maintenance Plan can only be configured to run once within that Plan. This can make . Designer. Maintenance Plan Wizard The Maintenance Plan Wizard is one of two tools that SQL Server provides to create Maintenance Plans. A note on terminology SQL Server uses the term " ;Maintenance. things that a DBA needs to do to maintain healthy SQL Servers. For more information on these broader topics, do an Internet search on " ;SQL Server Best Practices" to find additional information. My. Maintenance Plan Wizard and the Maintenance Plan Designer for SQL Server 2005 and SQL Server 2008, including both the Standard and Enterprise editions. If you are running SQL Server 2005, you should

Ngày đăng: 04/07/2014, 23:20

TỪ KHÓA LIÊN QUAN