Brad’s Sure Guide to SQL Server Maintenance Plans By Brad M.. This book is sold subject to the condition that it shall not, by way of trade or otherwise, be lent, re-sold, hired out, or
Trang 2Brad’s Sure Guide to SQL Server
Maintenance Plans
By Brad M McGehee
First published by Simple Talk Publishing 2009
Trang 3Copyright Brad M McGehee 2009
ISBN 978-1-906434-33-5
The right of Brad M McGehee to be identified as the author of this work has been asserted by him in accordance with the Copyright, Designs and Patents Act 1988
All rights reserved No part of this publication may be reproduced, stored or introduced into a retrieval system, or transmitted, in any form, or by any means (electronic, mechanical, photocopying, recording or otherwise) without the prior written consent of the publisher Any person who does any unauthorized act
in relation to this publication may be liable to criminal prosecution and civil claims for damages This book is sold subject to the condition that it shall not, by way of trade or otherwise, be lent, re-sold, hired out, or otherwise circulated without the publisher’s prior consent in any form other than which it
is published and without a similar condition including this condition being imposed on the subsequent publisher
Cover Image by Paul Vlaar
Edited by Tony Davis
Typeset & Designed by Matthew Tye & Gower Associates
Copy Edited by Gower Associates
Trang 4Table of Contents
About the Author xiii
Acknowledgements xiii
Introduction 14
Who Should Read this Book 15
Goals of this Book 16
SQL Server Editions Covered in this Book 16
Chapter 1: Why is Database Maintenance Important? 17
The Scope of Database Maintenance 17
Different Approaches to Database Maintenance 19
Maintenance Plan Wizard 19
Maintenance Plan Designer 21
T-SQL Scripts 22
PowerShell Scripts 24
Core Maintenance Plan Tasks 24
Backup Databases 25
Verify the Integrity of a Database 25
Maintain a Database's Indexes 26
Maintain Index and Column Statistics 26
Remove Older Data from msdb 27
Remove Old Backups 27
What's Outside the Scope of the Maintenance Plan Wizard and Designer? 27
Trang 5Summary 28
Chapter 2: Before you Create any Maintenance Plans… 29
How to Configure Database Mail 30
How to Configure a SQL Server Agent Operator 43
Summary 46
Chapter 3: Getting Started with the Maintenance Plan Wizard 47
Exploiting the Full Potential of the Wizard 48
Investigating Existing Maintenance Plans 48
Creating a Maintenance Plan 50
Starting the Maintenance Plan Wizard 50
Scheduling Maintenance Tasks 51
Overview of Maintenance Tasks 54
Selecting Core Maintenance Tasks 57
Maintenance Task Order 58
Configuring Individual Tasks 60
Report Options 69
Completing the Wizard 71
A Closer Look at Maintenance Plan Implementation 74
Testing Your Maintenance Plan 77
Summary 81
Chapter 4: Task Scheduling 82
Scheduling: General Considerations 82
Avoid Scheduling Tasks During Busy Periods 82