没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Microsoft
®
Foreword by David Campbell
Microsoft Technical Fellow
SQL Server
®
2008 Internals
Paul S. Randal, Kimberly L. Tripp,
Conor Cunningham, Adam Machanic, and Ben Nevarez
Kalen Delaney
PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright © 2009 by Kalen Delaney
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: 2008940524
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 office or contact Microsoft Press International directly at
fax (425) 936-7329. Visit our Web site at www.microsoft.com/mspress. Send comments to mspinput@microsoft.com.
Microsoft, Microsoft Press, Access, Active Directory, Excel, MS, MSDN, Outlook, SQL Server, Visual SourceSafe, Win32,
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 fictitious. 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: Sally Stickney
Project Editor: Lynn Finnel
Editorial Production: S4Carlisle Publishing Services
Technical Reviewer: Benjamin Nevarez; Technical Review services provided by Content Master, a member of CM Group, Ltd.
Cover: Tom Draper Design
Body Part No. X15-32079
v
Contents at a Glance
1 SQL Server 2008 Architecture and Confi guration . . . . . . . . . . . . . 1
2 Change Tracking, Tracing, and Extended Events . . . . . . . . . . . . . 75
3 Databases and Database Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
4 Logging and Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
5 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
6 Indexes: Internals and Management . . . . . . . . . . . . . . . . . . . . . . 299
7 Special Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
8 The Query Optimizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
9 Plan Caching and Recompilation . . . . . . . . . . . . . . . . . . . . . . . . . 525
10 Transactions and Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
11 DBCC Internals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
A04C626249.indd v 2/11/2009 2:31:36 PM
vii
Table of Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xix
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxi
1 SQL Server 2008 Architecture and Confi guration . . . . . . . . . . . . . 1
SQL Server Editions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
SQL Server Metadata. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Compatibility Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Catalog Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Other Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Components of the SQL Server Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Observing Engine Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
The Relational Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
The Storage Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
The SQLOS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
NUMA Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
The Scheduler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
SQL Server Workers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Binding Schedulers to CPUs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
The Dedicated Administrator Connection (DAC) . . . . . . . . . . . . . . . . . . . . 27
Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
The Buffer Pool and the Data Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Access to In-Memory Data Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Managing Pages in the Data Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
The Free Buffer List and the Lazywriter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Checkpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Managing Memory in Other Caches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Sizing Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Sizing the Buffer Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
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/
What do you think of this book? We want to hear from you!
A05T626249.indd vii 2/16/2009 3:22:16 PM
viii Table of Contents
SQL Server Resource Governor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Resource Governor Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Resource Governor Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Resource Governor Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
SQL Server 2008 Confi guration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Using SQL Server Confi guration Manager. . . . . . . . . . . . . . . . . . . . . . . . . . 54
Confi guring Network Protocols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Default Network Confi guration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Managing Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
SQL Server System Confi guration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Operating System Confi guration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Trace Flags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
SQL Server Confi guration Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
The Default Trace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Final Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
2 Change Tracking, Tracing, and Extended Events . . . . . . . . . . . . . 75
The Basics: Triggers and Event Notifi cations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Run-Time Trigger Behavior. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Change Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Change Tracking Confi guration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Change Tracking Run-Time Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Tracing and Profi ling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
SQL Trace Architecture and Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Security and Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Getting Started: Profi ler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Server-Side Tracing and Collection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Extended Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Components of the XE Infrastructure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Event Sessions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Extended Events DDL and Querying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
3 Databases and Database Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
System Databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
tempdb. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
The Resource Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
msdb. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
A05T626249.indd viii 2/16/2009 3:22:16 PM
剩余749页未读,继续阅读
xuwedo2003
- 粉丝: 31
- 资源: 196
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页