Tải bản đầy đủ (.pdf) (661 trang)

MCTS Exam 70-432: Microsoft SQL Server 2008 — Implementation and Maintenance potx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (20.52 MB, 661 trang )

Exam 70-432: Microsoft SQL Server 2008—
Implementation and Maintenance
0BJECTIVE LOCATION IN BOOK
INSTALLING AND CONFIGURING SQL SERVER 2008
Confi gure additional SQL Server components. Chapter 1, Lessons 3 and 4
Chapter 5, Lessons 1, 2 and 3
Confi gure SQL Server instances. Chapter 1, Lesson 3
Confi gure SQL Server services. Chapter 1, Lesson 3
Install SQL Server 2008 and related services. Chapter 1, Lesson 3
Chapter 5, Lessons 1, 2 and 3
Implement database mail.

Chapter 1, Lesson 4
Confi gure full-text indexing. Chapter 5, Lessons 1, 2 and 3
MAINTAINING SQL SERVER INSTANCES
Manage SQL Server Agent jobs. Chapter 10, Lesson 2
Manage SQL Server Agent alerts. Chapter 10, Lesson 4
Manage SQL Server Agent operators. Chapter 10, Lesson 3
Implement the declarative management framework (DMF). Chapter 8, Lessons 1 and 2
Back up a SQL Server environment. Chapter 9, Lessons 1, 2 and 3
MANAGING SQL SERVER SECURITY
Manage logins and server roles. Chapter 11, Lesson 3
Manage users and database roles. Chapter 11, Lesson 3
Manage SQL Server instance permissions. Chapter 11, Lesson 4
Manage database permissions. Chapter 11, Lesson 4
Manage schema permissions and object permissions. Chapter 11, Lesson 4
Audit SQL Server instances. Chapter 11, Lesson 5
Manage transparent data encryption. Chapter 11, Lesson 6
Confi gure surface area. Chapter 8, Lessons 1, 2 and 3
Chapter 11, Lesson 2


0BJECTIVE LOCATION IN BOOK
MAINTAINING A SQL SERVER DATABASE
Back up databases. Chapter 2, Lesson 1
Chapter 9, Lesson 1
Restore databases. Chapter 9, Lessons 2 and 3
Manage and confi gure databases. Chapter 2, Lessons 2, 3 and 4
Manage database snapshots. Chapter 9, Lesson 3
Maintain database integrity. Chapter 2, Lesson 4
Maintain a database by using maintenance plans. Chapter 9, Lesson 1
PERFORMING DATA MANAGEMENT TASKS
Import and export data. Chapter 7, Lessons 1, 2, 3 and 4
Manage data partitions. Chapter 6, Lessons 1, 2, 3 and 4
Implement data compression. Chapter 3, Lesson 1
Maintain indexes. Chapter 4, Lesson 3
Chapter 5, Lessons 1, 2 and 3
Manage collations. Chapter 2, Lesson 3
MONITORING AND TROUBLESHOOTING SQL SERVER
Identify SQL Server service problems. Chapter 12, Lesson 4
Identify concurrency problems. Chapter 12, Lesson 2
Identify SQL Agent job execution problems. Chapter 10, Lesson 1
Locate error information. Chapter 12, Lesson 1
OPTIMIZING SQL SERVER PERFORMANCE
Implement Resource Governor. Chapter 13, Lesson 6
Use the Database Engine Tuning Advisor. Chapter 13, Lesson 4
Collect trace data by using SQL Server Profi ler. Chapter 12, Lesson 2
Collect performance data by using Dynamic Management Views (DMVs). Chapter 13, Lesson 5
Collect performance data by using System Monitor. Chapter 12, Lesson 1
Use Performance Studio. Chapter 13, Lesson 7
IMPLEMENTING HIGH AVAILABILITY
Implement database mirroring. Chapter 15, Lessons 1, 2 and 3

Implement a SQL Server clustered instance. Chapter 14, Lessons 1 and 2
Implement log shipping. Chapter 16, Lessons 1, 2 and 3
Implement replication. Chapter 17, Lessons 1, 2 and 3
Exam objectives The exam objectives listed here are current as of this book’s publication date. Exam objectives are
subject to change at any time without prior notice and at Microsoft’s sole discretion. Please visit the Microsoft Learning
Web site for the most current listing of exam objectives: />PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright © 2009 by Mike Hotek
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means
without the written permission of the publisher.
Library of Congress Control Number: 2008940530
Printed and bound in the United States of America.
1 2 3 4 5 6 7 8 9 QWT 4 3 2 1 0 9
Distributed in Canada by H.B. Fenn and Company Ltd.
A CIP catalogue record for this book is available from the British Library.
Microsoft Press books are available through booksellers and distributors worldwide. For further infor mation about
international editions, contact your local Microsoft Corporation offi ce or contact Microsoft Press International directly at
fax (425) 936-7329. Visit our Web site at www.microsoft.com/mspress. Send comments to
Microsoft, Microsoft Press, Excel, IntelliSense, Internet Explorer, MSDN, MSN, SharePoint, Silverlight, SQL Server, Visual
Studio, Windows, and Windows Server are either registered trademarks or trademarks of the Microsoft group of companies.
Other product and company names mentioned herein may be the trademarks of their respective owners.
The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted
herein are fi ctitious. No association with any real company, organization, product, domain name, e-mail address, logo,
person, place, or event is intended or should be inferred.
This book expresses the author’s views and opinions. The information contained in this book is provided without any
express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will
be held liable for any damages caused or alleged to be caused either directly or indirectly by this book.

Acquisitions Editor: Ken Jones
Developmental Editor: Laura Sackerman
Project Editor: Denise Bankaitis
Editorial Production: S4Carlisle Publishing Services
Technical Reviewer: Steve Kass and Umachandar Jayachandran; Technical Review services provided by
Content Master, a member of CM Group, Ltd.
Cover: Tom Draper Design
Body Part No. X15-24083
To Genilyn,
My compass in a storm and the light to show me the way home

Contents at a Glance
Introduction xxvii
CHAPTER 1 Installing and Confi guring SQL Server 2008 1
CHAPTER 2 Database Confi guration and Maintenance 37
CHAPTER 3 Tables 61
CHAPTER 4 Designing SQL Server Indexes 85
CHAPTER 5 Full Text Indexing 111
CHAPTER 6 Distributing and Partitioning Data 135
CHAPTER 7 Importing and Exporting Data 161
CHAPTER 8 Designing Policy Based Management 177
CHAPTER 9 Backing up and Restoring a Database 197
CHAPTER 10 Automating SQL Server 233
CHAPTER 11 Designing SQL Server Security 251
CHAPTER 12 Monitoring Microsoft SQL Server 307
CHAPTER 13 Optimizing Performance 367
CHAPTER 14 Failover Clustering 407
CHAPTER 15 Database Mirroring 451
CHAPTER 16 Log Shipping 483
CHAPTER 17 Replication 513

Glossary 553
Answers 561
Index 599
vii
What do you think of this book? We want to hear from you!
Microsoft is interested in hearing your feedback so we can continually improve our
books and learning resources for you. To participate in a brief online survey, please visit:
www.microsoft.com/learning/booksurvey/
Contents
Introduction xxvii
Chapter 1 Installing and Confi guring SQL Server 2008 1
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Lesson 1: Determining Hardware and Software Requirements . . . . . . . . . . 3
Minimum Hardware Requirements 3
Supported Operating Systems 4
Software Requirements 5
Lesson Summary 6
Lesson Review 6
Lesson 2: Selecting SQL Server Editions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
SQL Server Services 8
SQL Server Editions 11
Lesson Summary 15
Lesson Review 15
Lesson 3: Installing and Confi guring SQL Server Instances . . . . . . . . . . . . . 17
Service Accounts 17
Collation Sequences 18
Authentication Modes 18
SQL Server Instances 19
SQL Server Confi guration Manager 19

Lesson Summary 27
Lesson Review 27
Lesson 4: Confi guring Database Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Database Mail 28
viii
Contents
Lesson Summary 31
Lesson Review 31
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Chapter Summary 33
Key Terms 33
Case Scenario 33
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Installing SQL Server 34
Managing SQL Server Services 34
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Chapter 2 Database Confi guration and Maintenance 37
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
Lesson 1: Confi guring Files and Filegroups . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Files and Filegroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Transaction Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
FILESTREAM data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
tempdb Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
Lesson Summary 45
Lesson Review 45
Lesson 2: Confi guring Database Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Database Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Recovery Options 46
Auto Options 48
Change Tracking 50

Access 50
Parameterization 51
Collation Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Lesson Summary 53
Lesson Review 53
Lesson 3: Maintaining Database Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . .54
Database Integrity Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Lesson Summary 56
ix
Contents
Lesson Review 56
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Chapter Summary 57
Key Terms 57
Case Scenario 57
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Confi guring Databases 59
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Chapter 3 Tables 61
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61
Lesson 1: Creating Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Schemas 63
Data Types 64
Column Properties 69
Computed Columns 72
Row and Page Compression 72
Creating Tables 73
Lesson Summary 75
Lesson Review 76
Lesson 2: Implementing Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

Primary Keys 77
Foreign Keys 77
Unique Constraints 78
Default Constraints 78
Check Constraints 78
Lesson Summary 80
Lesson Review 80
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Chapter Summary 81
Key Terms 81
Case Scenario 81
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Creating Tables 82
x
Contents
Creating Constraints 83
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Chapter 4 Designing SQL Server Indexes 85
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85
Lesson 1: Index Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Index Structure 87
Balanced Trees (B-Trees) 88
Index Levels 89
Lesson Summary 91
Lesson Review 91
Lesson 2: Designing Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Clustered Indexes 93
Nonclustered Indexes 95
Index Options 97
XML Indexes 99

Spatial Indexes 99
Lesson Summary 102
Lesson Review 102
Lesson 3: Maintaining Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104
Index Management and Maintenance 104
Disabling an index 105
Lesson Summary 107
Lesson Review 107
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108
Chapter Summary 108
Key Terms 108
Case Scenario 108
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
Creating Indexes 110
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Chapter 5 Full Text Indexing 111
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111
xi
Contents
Lesson 1: Creating and Populating Full Text Indexes . . . . . . . . . . . . . . . . . 113
Full Text Catalogs 113
Full Text Indexes 114
Change Tracking 115
Language, Word Breakers, and Stemmers 116
Lesson Summary 118
Lesson Review 118
Lesson 2: Querying Full Text Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120
FREETEXT 120
CONTAINS 121
Lesson Summary 125

Lesson Review 126
Lesson 3: Managing Full Text Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127
Thesaurus 127
Stop Lists 128
Populate Full Text Indexes 128
Lesson Summary 131
Lesson Review 131
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132
Chapter Summary 132
Key Terms 132
Case Scenario 132
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133
Create a Full Text Index 133
Query a Full Text Index 133
Create a Thesaurus File 134
Create a Stop List 134
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .134
Chapter 6 Distributing and Partitioning Data 135
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135
Lesson 1: Creating a Partition Function . . . . . . . . . . . . . . . . . . . . . . . . . . . .137
Partition Functions 137
Lesson Summary 141
xii
Contents
Lesson Review 141
Lesson 2: Creating a Partition Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142
Partition Schemes 142
Lesson Summary 144
Lesson Review 144
Lesson 3: Creating Partitioned Tables and Indexes . . . . . . . . . . . . . . . . . . .146

Creating a Partitioned Table 146
Creating a Partitioned Index 147
Lesson Summary 149
Lesson Review 149
Lesson 4: Managing Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .150
Split and Merge Operators 150
Altering a Partition Scheme 150
Index Alignment 151
Switch Operator 151
Lesson Summary 156
Lesson Review 156
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157
Chapter Summary 157
Key Terms 157
Case Scenario 157
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160
Partitioning 160
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160
Chapter 7 Importing and Exporting Data 161
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161
Lesson 1: Importing and Exporting Data . . . . . . . . . . . . . . . . . . . . . . . . . . .163
Bulk Copy Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
The BULK INSERT command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
The SQL Server Import and Export Wizard 166
Lesson Summary 172
Lesson Review 172
xiii
Contents
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Chapter Summary 173

Key Terms 173
Case Scenario 173
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Import and Export Data 175
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Chapter 8 Designing Policy Based Management 177
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177
Lesson 1: Designing Policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Facets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180
Policy Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180
Policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
Policy Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
Policy Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
Central Management Server 183
Import and Export Policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183
Lesson Summary 191
Lesson Review 191
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193
Chapter Summary 193
Key Terms 193
Case Scenario 193
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .196
Implement Policy Based Management 196
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .196
Chapter 9 Backing up and Restoring a Database 197
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197
Lesson 1: Backing up Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199
xiv
Contents

Backup Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199
Full Backups 200
Transaction Log Backups 203
Differential Backups 204
Filegroup Backups 205
Partial Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205
Page Corruption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
Maintenance Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
Certifi cates and Master Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207
Validating a Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209
Lesson Summary 211
Lesson Review 211
Lesson 2: Restoring Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212
Transaction Log Internals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212
Database Restores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214
Restoring a Full Backup 214
Restoring a Differential Backup 216
Restoring a Transaction Log Backup 216
Online Restores 217
Restore a Corrupt Page 217
Restoring with Media Errors 218
Lesson Summary 222
Lesson Review 222
Lesson 3: Database Snapshots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223
Creating a Database Snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223
Copy-On-Write Technology 224
Reverting Data Using a Database Snapshot . . . . . . . . . . . . . . . . . . . . . . . . . 225
Lesson Summary 227
Lesson Review 227
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .228

Chapter Summary 228
Key Terms 228
Case Scenario 229
xv
Contents
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Backing up a Database 231
Restoring a Database 231
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Chapter 10 Automating SQL Server 233
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233
Lesson 1: Creating Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
Job Steps 234
Job Schedules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235
Job History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236
Lesson Summary 240
Lesson Review 240
Lesson 2: Creating Alerts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242
SQL Server Agent Alerts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Lesson Summary 245
Lesson Review 245
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246
Chapter Summary 246
Key Terms 246
Case Scenario 246
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248
Create Jobs 248
Create Alerts 248
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249

Chapter 11 Designing SQL Server Security 251
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251
Lesson 1: TCP Endpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252
Endpoint Types and Payloads 252
Endpoint Access 253
xvi
Contents
TCP Endpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253
TCP Protocol Arguments 253
Database Mirroring and Service Broker Common Arguments 254
Database Mirroring–Specifi c Arguments 255
Service Broker–Specifi c Arguments 255
Lesson Summary 257
Lesson Review 257
Lesson 2: Confi guring the SQL Server
Surface Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259
Surface Area Confi guration 259
Lesson Summary 261
Lesson Review 262
Lesson 3: Creating Principals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263
Logins 263
Fixed Server Roles 265
Database Users 266
Loginless Users 266
Fixed Database Roles 267
User Database Roles 268
Lesson Summary 269
Lesson Review 270
Lesson 4: Managing Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271
Securables 272

Permissions 272
Metadata Security 273
Ownership Chains 274
Impersonation 275
Master Keys 275
Certifi cates 276
Signatures 277
Lesson Summary 283
Lesson Review 283
Lesson 5: Auditing SQL Server Instances. . . . . . . . . . . . . . . . . . . . . . . . . . . .285
DDL Triggers 285
Audit Specifi cations 286
xvii
Contents
C2 Auditing 288
Lesson Summary 290
Lesson Review 291
Lesson 6: Encrypting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292
Data Encryption 292
Hash Algorithms 293
Symmetric Keys 294
Certifi cates and Asymmetric Keys 294
Transparent Data Encryption 294
Encryption Key Management 296
Lesson Summary 300
Lesson Review 300
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .302
Chapter Summary 302
Key Terms 302
Case Scenario: Designing SQL Server Security 303

Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304
Manage Logins and Server Roles 304
Manage Users and Database Roles 305
Manage SQL Server Instance Permissions 305
Manage Database Permissions 305
Manage Schema Permissions and Object Permissions 305
Audit SQL Server Instances 305
Manage Transparent Data Encryption 305
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305
Chapter 12 Monitoring Microsoft SQL Server 307
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .307
Lesson 1: Working with System Monitor. . . . . . . . . . . . . . . . . . . . . . . . . . . .309
System Monitor Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309
Capturing Counter Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Performance Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312
Lesson Summary 315
Lesson Review 315
xviii
Contents
Lesson 2: Working with the SQL Server Profi ler . . . . . . . . . . . . . . . . . . . . . 317
Defi ning a Trace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Specifying Trace Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .320
Selecting Data Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .322
Applying Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .323
Managing Traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Correlating Performance and Monitoring Data . . . . . . . . . . . . . . . . . . . . .325
Lesson Summary 330
Lesson Review 331
Lesson 3: Diagnosing Database Failures . . . . . . . . . . . . . . . . . . . . . . . . . . . .332
SQL Server Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332

Database Space Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .334
Lesson Summary 338
Lesson Review 339
Lesson 4: Diagnosing Service Failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .340
Finding Service Startup Failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .340
Confi guration Manager 340
Lesson Summary 349
Lesson Review 349
Lesson 5: Diagnosing Hardware Failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Disk Drives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Memory and Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .352
Lesson Summary 353
Lesson Review 353
Lesson 6: Resolving Blocking and Deadlocking Issues . . . . . . . . . . . . . . . .355
Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Transaction Isolation Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356
Blocked Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Deadlocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .358
Lesson Summary 362
Lesson Review 362
xix
Contents
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .363
Chapter Summary 363
Key Terms 363
Case Scenario 363
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .366
Creating a Trace Using SQL Server Profi ler to
Diagnose Performance and Deadlock Issues 366
Create a Counter Log Using System Monitor to

Diagnose Performance, Deadlock, and System Issues 366
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .366
Chapter 13 Optimizing Performance 367
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .367
Lesson 1: Using the Database Engine Tuning Advisor . . . . . . . . . . . . . . . .369
Database Engine Tuning Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .369
Lesson Summary 375
Lesson Review 375
Lesson 2: Working with Resource Governor . . . . . . . . . . . . . . . . . . . . . . . . .376
Resource Governor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
Lesson Summary 386
Lesson Review 386
Lesson 3: Using Dynamic Management Views and Functions . . . . . . . . .387
DMV Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .387
Database Statistics 388
Query Statistics 389
Disk Subsystem Statistics 390
Hardware Resources 391
Lesson Summary 393
Lesson Review 394
Lesson 4: Working with the Performance Data Warehouse . . . . . . . . . . .395
Performance Data Warehouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .395
Lesson Summary 400
Lesson Review 400
xx
Contents
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .402
Chapter Summary 402
Key Terms 402
Case Scenario 403

Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .405
Using the Performance Data Warehouse to Gather Data
for Performance Optimization 405
Using Database Engine Tuning Advisor to Gather Data
for Performance Optimization 405
Using Dynamic Management Views to Gather Data
for Performance Optimization 405
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406
Chapter 14 Failover Clustering 407
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .407
Lesson 1: Designing Windows Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
Windows Cluster Components 410
Types of Clusters 412
Security Confi guration 413
Disk Confi guration 413
Network Confi guration 414
Cluster Resources 415
Cluster Groups 416
Lesson Summary 428
Lesson Review 429
Lesson 2: Designing SQL Server 2008 Failover Cluster Instances . . . . . . .430
Terminology 431
Failover Cluster Instance Components 431
Health Checks 433
Cluster Failover 433
Lesson Summary 444
Lesson Review 444
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .445
Chapter Summary 445
Key Terms 445

Case Scenario 445
xxi
Contents
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .448
Windows Clustering 448
SQL Server Failover Clustering 449
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .449
Chapter 15 Database Mirroring 451
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .451
Lesson 1: Overview of Database Mirroring . . . . . . . . . . . . . . . . . . . . . . . . .452
Database Mirroring Roles 452
Principal Role 453
Mirror Role 453
Witness Server 453
Database Mirroring Endpoints 454
Operating Modes 455
Caching 458
Transparent Client Redirect 458
Database Mirroring Threading 459
Database Snapshots 459
Lesson Summary 462
Lesson Review 462
Lesson 2: Initializing Database Mirroring . . . . . . . . . . . . . . . . . . . . . . . . . . .464
Recovery Model 465
Backup and Restore 465
Copy System Objects 466
Lesson Summary 469
Lesson Review 469
Lesson 3: Designing Failover and Failback Strategies . . . . . . . . . . . . . . . . .471
Designing Mirroring Session Failover 471

Designing Mirroring Session Failback 472
Lesson Summary 474
Lesson Review 475
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Chapter Summary 476
Key Terms 476
Case Scenario 477
xxii
Contents
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .480
Establishing Database Mirroring 480
Creating a Database Snapshot Against a Database
Mirror 480
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .481
Chapter 16 Log Shipping 483
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .483
Lesson 1: Overview of Log Shipping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .484
Log Shipping Scenarios 484
Log Shipping Components 485
Types of Log Shipping 487
Lesson Summary 487
Lesson Review 488
Lesson 2: Initializing Log Shipping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .489
Log Shipping Initialization 489
Lesson Summary 499
Lesson Review 499
Lesson 3: Designing Failover and Failback
Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .500
Log Shipping Failover 501
Log Shipping Failback 502

Lesson Summary 505
Lesson Review 505
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .506
Chapter Summary 506
Key Terms 506
Case Scenario 507
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
Initiating Log Shipping 511
Failover and Failback Log Shipping 512
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
xxiii
Contents
Chapter 17 Replication 513
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .513
Lesson 1: Overview of Replication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .514
Replication Components 514
Replication Roles 515
Replication Topologies 516
Replication Agents 517
Agent Profi les 518
Replication Methods 519
Data Confl icts 521
Lesson Summary 524
Lesson Review 525
Lesson 2: Transactional Replication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .526
Change Tracking 526
Transactional Options 528
Transactional Architectures 530
Monitoring 532
Validation 532

Lesson Summary 536
Lesson Review 537
Lesson 3: Merge Replication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .538
Change Tracking 538
Validation 541
Lesson Summary 543
Lesson Review 543
Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .545
Chapter Summary 545
Key Terms 545
Case Scenario 546
Suggested Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .550
Transactional Replication 550
Merge Replication 551
Take a Practice Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552

×