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

Designing SQL Server Databases for .NET Enterprise Servers

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 (4.91 MB, 753 trang )

1 YEAR UPGRADE
BUYER PROTECTION PLAN
SQL SERVER 2000
FOR
DESIGNING
DATABASES
FREE Monthly
Technology Updates
FREE Downloadable
HTML
FREE Membership to
Access.Globalknowledge
Robert Patton, MCDBA, MCSD, MCSE+I, MCP+I
Jennifer Ogle, MCSE, MCNE, Oracle DBA
TECHNICAL EDITOR and CONTRIBUTOR:
Travis Laird, MCSE, MCDBA, A+, Network+, i-Net+, CIW
“This book is a solid introduction to a critical
component of the Windows 2000 Server family. It
will be a valuable title in your IT library.”
—Richard Martin, Database Administrator and Windows DNA
Developer, MCP+I, MCSE, MCSD, MCDBA, MCT
Dominion Technology Group, Inc.
.
net ENTERPRISE SERVERS
®

With over 1,500,000 copies of our MCSE, MCSD, CompTIA, and Cisco
study guides in print, we have come to know many of you personally. By
listening, we've learned what you like and dislike about typical computer
books. The most requested item has been for a web-based service that
keeps you current on the topic of the book and related technologies. In


response, we have created

, a service that
includes the following features:

A one-year warranty against content obsolescence that occurs as
the result of vendor product upgrades. We will provide regular web
updates for affected chapters.

Monthly mailings that respond to customer FAQs and provide
detailed explanations of the most difficult topics, written by content
experts exclusively for us.

Regularly updated links to sites that our editors have determined
offer valuable additional information on key topics.

Access to “Ask the Author”™ customer query forms that allow
readers to post questions to be addressed by our authors and
editors.
Once you’ve purchased this book, browse to
www.syngress.com/solutions.
To register, you will need to have the book handy to verify your
purchase.
Thank you for giving us the opportunity to serve you.

114_SQL_FM 1/2/01 2:59 PM Page i
114_SQL_FM 1/2/01 2:59 PM Page ii
DESIGNING
SQL SERVER 2000
DATABASES

FOR
.NET ENTERPRISE
SERVERS
114_SQL_FM 1/2/01 2:59 PM Page iii
Syngress Publishing, Inc., the author(s), and any person or firm involved in the writing, editing, or production
(collectively “Makers”) of this book (“the Work”) do not guarantee or warrant the results to be obtained from the
Work.
There is no guarantee of any kind, expressed or implied, regarding the Work or its contents. The Work is sold
AS IS and WITHOUT WARRANTY. You may have other legal rights, which vary from state to state.
In no event will Makers be liable to you for damages, including any loss of profits, lost savings, or other inci-
dental or consequential damages arising out from the Work or its contents. Because some states do not allow
the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not
apply to you.
You should always use reasonable case, including backup and other appropriate precautions, when working
with computers, networks, data, and files.
Syngress Media® and Syngress® are registered trademarks of Syngress Media, Inc. “Career Advancement Through
Skill Enhancement™,” “Ask the Author™,” “Ask the Author UPDATE™,” “Mission Critical™,” and “Hack
Proofing™” are trademarks of Syngress Publishing, Inc. Brands and product names mentioned in this book are
trademarks or service marks of their respective companies.
KEY SERIAL NUMBER
001 58PPL99DSE
002 LSKDJ9878M
003 C3N44T8FQ7
004 KJ675HCC25
005 QCUCA94D26
006 PF62XD2G73
007 DT74HH52A4
008 LKJFARY343
009 65SKNSDAD5
010 6487FPS25N

PUBLISHED BY
Syngress Publishing, Inc.
800 Hingham Street
Rockland, MA 02370
Designing SQL Server 2000 Databases for .NET Enterprise Servers
Copyright © 2001 by Syngress Publishing, Inc. All rights reserved. Printed in the United States of America.
Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or dis-
tributed in any form or by any means, or stored in a database or retrieval system, without the prior written per-
mission of the publisher, with the exception that the program listings may be entered, stored, and executed in a
computer system, but they may not be reproduced for publication.
Printed in the United States of America
1 2 3 4 5 6 7 8 9 0
ISBN: 1-928994-19-9
Copy edit by: Darlene Bordwell Index by: Robert Saigh
Technical edit by: Travis Laird Page Layout and Art by: Shannon Tozier
Project Editor: Maribeth Corona-Evans Co-Publisher: Richard Kristof
Distributed by Publishers Group West
114_SQL_FM 1/2/01 2:59 PM Page iv
v
Acknowledgments
We would like to acknowledge the following people for their kindness and support
in making this book possible.
Richard Kristof, Duncan Anderson, Jennifer Gould, Robert Woodruff, Kevin
Murray, Dale Leatherwood, Rhonda Harmon, and Robert Sanregret of Global
Knowledge, for their generous access to the IT industry’s best courses, instructors
and training facilities.
Ralph Troupe, Rhonda St. John, and the team at Callisma for their invaluable
insight into the challenges of designing, deploying and supporting world-class
enterprise networks.
Karen Cross, Lance Tilford, Meaghan Cunningham, Kim Wylie, Harry Kirchner,

Bill Richter, Kevin Votel, Brittin Clark, and Sarah MacLachlan of Publishers Group
West for sharing their incredible marketing experience and expertise.
Mary Ging, Caroline Hird, Simon Beale, Caroline Wheeler, Victoria Fuller,
Jonathan Bunkell, and Klaus Beran of Harcourt International for making certain
that our vision remains worldwide in scope.
Anneke Baeten, Annabel Dent, and Laurie Giles of Harcourt Australia for all their
help.
David Buckland, Wendi Wong, Daniel Loh, Marie Chieng, Lucy Chong, Leslie Lim,
Audrey Gan, and Joseph Chan of Transquest Publishers for the enthusiasm with
which they receive our books.
Kwon Sung June at Acorn Publishing for his support.
Ethan Atkin at Cranbury International for his help in expanding the Syngress
program.
Joe Pisco, Helen Moyer, and the great folks at InterCity Press for all their help.
v
114_SQL_FM 1/2/01 2:59 PM Page v
vi
From Global Knowledge
At Global Knowledge we strive to support the multiplicity of learning styles
required by our students to achieve success as technical professionals. As
the world's largest IT training company, Global Knowledge is uniquely
positioned to offer these books. The expertise gained each year from pro-
viding instructor-led training to hundreds of thousands of students world-
wide has been captured in book form to enhance your learning experience.
We hope that the quality of these books demonstrates our commitment to
your lifelong learning success. Whether you choose to learn through the
written word, computer based training, Web delivery, or instructor-led
training, Global Knowledge is committed to providing you with the very
best in each of these categories. For those of you who know Global
Knowledge, or those of you who have just found us for the first time, our

goal is to be your lifelong competency partner.
Thank your for the opportunity to serve you. We look forward to serving
your needs again in the future.
Warmest regards,
Duncan Anderson
President and Chief Executive Officer, Global Knowledge
114_SQL_FM 1/2/01 2:59 PM Page vi
vii
Contributors
Robert A. Patton (MCDBA, MCSD, MCSE+I, MCP+I) is a Software
Engineer specializing in Microsoft Windows DNA applications using
Interdev and Visual Basic with Windows 2000 and SQL Server. He is cur-
rently a Senior Applications Developer at PurchasingFirst.com in Dublin,
OH and, in his position there, has done work for First Union National
Bank, Corporate Strategic Services, the Midland Life Insurance Company,
and Sykes Enterprises. Robert attended the University of Chicago, where
he studied Public Policy. He earned his Bachelor of Science degree in
Software Engineering from The Ohio State University. He lives in Dublin,
OH with his wife Jenny and their sons Michael and Alex.
Jennifer Ogle (MCSE, MCP+I, MCNE, Oracle DBA) is Owner and President
of Radioactive Frog Web Designs, Inc. (www.radfrog.com), which specializes
in contract Web site design and development and database administration.
Jennifer has over 20 years of experience in the IT industry, specializing in
government, scientific, and manufacturing applications. Her recent assign-
ments include SQL and Oracle development for Hoover Materials Handling
Group and Lockheed Martin. In addition to her extensive software and
hardware experience, she has programmed with Java, Visual Basic, and
Visual InterDev, among many others. Jennifer lives with her husband Kent
in Knoxville, TN.
Sean Campbell (MCSE, MCDBA, MCSD, MCT) is an Owner of 3 Leaf

Solutions, LLC. He has worked in the education field for 7 years, with 5
years focused on IT training and consulting. Sean has worked with SQL
Server since version 6. He has developed custom training and delivered
MOC training for a number of years on SQL Server and other development
technologies and has authored numerous Microsoft TechNet sessions on
topics such as supporting SQL and upgrading to SQL Server 2000.
Sean’s consulting experiences have run the gamut from database
administration and application upgrades to .NET development. Sean has
been working on projects with Microsoft since early Beta releases of SQL
Server 2000 and has focused on SQL Server 2000’s administration and
implementation enhancements.
114_SQL_FM 1/2/01 2:59 PM Page vii
viii
Mark Horninger (A+, MCSE+I, MCSD, MCDBA) is President and Founder
of Haverford Consultants, Inc. (www.haverford-consultants.com), located in
the suburbs of Philadelphia, PA. He develops custom applications and
system engineering solutions, specializing primarily in Microsoft operating
systems and Microsoft BackOffice solutions. Mark has over 12 years of
computer consulting experience and has passed 26 Microsoft certified
exams. During his career, Mark has worked on many extensive projects
including database development using SQL 6.5, SQL 7, and SQL 2000;
application development; training; embedded systems development; and
Windows NT and 2000 project rollout planning and implementations. Mark
lives with his wife Debbie and two children in Havertown, PA.
Steve Maier (MCSD) is a Senior Software Engineer for Heidelberg Digital
L.L.C. (www.us.heidelberg.com), located in Rochester, NY. He develops
custom PostScript drivers for Microsoft operating systems. Steve has 10
years of computer programming experience in DOS, Windows, and UNIX.
During his career, Steve has done database development, manufacturing
application development, driver development, and game development. He

has also worked on FDA-approved medical software and has taught a
variety of college classes including programming, system analysis, and PC
repair. Steve lives with his wife Lisa and two children in Rochester, NY.
Henk-Evert Sonder (CCNA) has over 15 years of experience as an Infor-
mation and Communication Technologies (ICT) professional, building and
maintaining ICT infrastructures. In recent years, he has specialized in inte-
grating ICT infrastructures with business applications and the security
that comes with it. Currently, Henk works as a Senior Consultant for a
large Dutch ICT solutions provider. His company, IT Selective, helps
retailers get e-connected. Henk has also contributed to other Syngress
books, including the E-mail Virus Protection Handbook (ISBN: 1-928994-
23-7).
Scott Delaney (MCSD, MCDBA, MCSE) is a Senior Consultant with
TurnAround Solutions (www.turnaroundsolutions.com), a leading e-com-
merce consulting and product development firm based in Australia.
TurnAround has a core client list including blue chips and multinationals
and is known for its well-trained staff, processes, and quality development.
In addition to his database work with SQL Server and Oracle, Scott also
develops custom C++ and Java solutions. His current pet project is the
114_SQL_FM 1/2/01 2:59 PM Page viii
ix
development of SayIT, a full-featured speech synthesis package for use by
people who have lost the ability to speak due to illnesses such as ALS or
stroke. Scott lives in Tasmania, Australia with his wife Paula.
John Iwasz (MCSD) has over 5 years consulting experience developing
custom applications. He specializes in n-tier and Web development using
Microsoft technologies. John recently wrote an article on the IIS Metabase
for ASP Today. During his career, John has worked on enterprise-wide pro-
jects as well as commercial development. His has designed and developed
Web site front ends, middle tier components, and determined database

architecture. John lives in Philadelphia, PA.
Melissa Craft (CCNA, MCSE, Network+, MCNE, Citrix CCA) is Director of
e-Business Offering Development for MicroAge Technology Services.
MicroAge is a global systems integrator headquartered in Tempe, AZ.
MicroAge provides IT design, project management, and support for dis-
tributed computing systems. Melissa is a key contributor to the business
development and implementation of e-business services. As such, she
develops enterprise-wide technology solutions and methodologies focused
on client organizations. These technology solutions touch every part of a
system’s lifecycle—from network design, testing, and implementation to
operational management and strategic planning.
Melissa holds a bachelor’s degree from the University of Michigan and
is a member of the IEEE, the Society of Women Engineers, and American
MENSA, Ltd. Melissa currently resides in Glendale, AZ with her family,
Dan, Justine, and Taylor. Melissa is the author of Syngress Publishing’s
best-selling Managing Active Directory for Windows 2000 Server (ISBN:
1-928994-07-5).
Cameron Wakefield (MCSD, MCP) is a Senior Software Engineer at
Computer Science Innovations, Inc. (www.csihq.com) in Melbourne, FL,
where he develops custom software solutions ranging from satellite com-
munications to data-mining applications. His development work spans a
broad spectrum including Visual C++, Visual Basic, COM, ADO, ASP,
Delphi, CORBA, and UNIX. Cameron also develops software for a Brazilian
hematology company as well as business-to-business Web applications. He
also teaches Microsoft certification courses for Herzing College (AATP). He
has passed 10 Microsoft certification exams. Cameron’s formal education
was in computer science with a minor in math at Rollins College. He lives
in Rockledge, FL with his wife Lorraine and daughter Rachel.
114_SQL_FM 1/2/01 2:59 PM Page ix
x

Bret Stateham (CNE, MCSE, MCSD, MCDBA, MCT) is the Owner of Net
Connex Technology Training and Consulting, L.L.C. (www.netconnex.com)
in San Diego, CA. Bret’s background includes extensive networking, devel-
opment, and training experience. His most recent projects have involved
custom training, database development and administration, XML schema
development and standardization, custom application development, and
countless hours developing Active Server Pages-based Web solutions. Bret
and his wife Lori live in San Diego, CA.
Technical Editor and Contributor
Travis Laird (MCSE, MCDBA, A+, Network+, i-Net+, CIW) has extensive
experience in a broad range of technology subjects ranging from network
design and support through software design and development. Travis has
worked on numerous e-commerce and line-of-business solutions based on
Microsoft technologies including Windows 2000, Visual Basic, IIS, and SQL
Server.
Travis currently works as an Independent Consultant in the New York
City area. He recently designed and developed a Web-based e-commerce
solution allowing a client to reach global markets with over 30,000 prod-
ucts. He attended Syracuse University and graduated with a Bachelor of
Science degree in Finance and Management Information Systems. Travis
lives in Westchester, NY and enjoys traveling with his ever-supportive
fiancée Maria.
114_SQL_FM 1/2/01 2:59 PM Page x
Contents
xi
Introduction xxvii
Chapter 1 SQL Server 2000 Overview
and Migration Strategies 1
Introduction 2
Overview of SQL Server 2000: A .NET Enterprise Server 3

The Future of Windows DNA: Microsoft.NET 4
New and Enhanced Features of SQL Server 2000 8
XML Support 10
Development Tools and Technologies 14
Query Analyzer 14
New Data Types 15
Indexed Views 16
Trigger Enhancements 16
Referential Integrity Enhancements 17
User-Defined Functions 18
Index Enhancements 18
Shared Session Information 19
Collation Support 19
Extended Properties 20
Meta Data Services 20
Analysis Services 20
OLAP Enhancements 21
Data Mining 22
SQL Server Administration 23
Windows 2000 Active Directory Integration 24
Scalability and Availability 24
Scalability Enhancements 25
Distributed Partitioned Views 26
Fail-Over Clustering 26
Log Shipping 27
Data Transformation Services 27
Replication Services 28
Active Directory Integration 29
114_SQL_TOC 1/2/01 4:09 PM Page xi
xii Contents

Queued Updating Subscribers 29
Multiple Server Instance Support 29
Web and Internet Standards Support 31
Web Access Using Hypertext Transfer Protocol 31
Secure Sockets Layer 31
SQL Server 2000 Versions, Features, and Requirements 32
Common Edition Requirements 33
SQL Server Licensing and Pricing 34
Enterprise Edition 35
Hardware Requirements and Capacity Limits 35
Operating System Compatibility 36
Standard Edition 36
Hardware Requirements 36
Software and Operating System Compatibility 37
Personal Edition 37
Hardware Requirements 37
Software and Operating System Compatibility 38
Developer Edition 38
SQL Server 2000 Desktop Engine 39
SQL Server 2000 Windows CE Edition 39
Should You Migrate to SQL Server 2000? 41
How Will SQL Server 2000 Benefit My Organization? 42
Will SQL Server 2000 Fit into My Organization? 43
Steps to a Successful SQL Server Migration 43
Planning a SQL Server Migration 44
Determine Existing and Future
Application Requirements 45
Inventory Existing Database Servers 45
Train Database Administrators and Support Personnel 45
Next Steps to Successful SQL Server Migration 46

Migrating to SQL Server 2000 46
Upgrading from SQL Server 6.5: Active/Passive Mode 49
Upgrading from SQL Server 6.5: Active/Active Mode 50
Upgrading from SQL Server 7.0: Active/Passive Mode 50
Upgrading from SQL Server 7.0: Active/Active Mode 50
Summary 52
FAQs 54
Chapter 2 Installing and Configuring SQL Server 2000 57
Introduction 58
Planning a SQL Server Installation 59
Installation Requirements 60
Hardware Requirements 60
Software Requirements 61
SQL Server Licensing 62
114_SQL_TOC 1/2/01 4:09 PM Page xii
Contents xiii
Installation Options 63
Local vs. Remote Installation 63
Creating Service Accounts for SQL Server 65
Changing User Accounts 66
Disk Imaging Support 67
Answer File for Automated Installations 67
Multiple Server Instances 68
Collation Options 68
Upgrading to SQL Server 2000 69
Installing SQL Server 71
Standard Installation 71
Advanced Installation 75
Configuring Cluster Support 75
Unattended Installation 76

Configuration Options and Settings 76
SQL Server Properties 76
Server Network Utility 86
Client Network Utility 87
SQL Server Agent 89
SQL Mail 90
Summary 92
FAQs 92
Chapter 3 SQL Server Scalability and Availability 93
Introduction 94
Scaling Up vs. Scaling Out 94
TPC Benchmarks 97
SQL Server Fail-Over Clustering 98
SQL 2000 Fail-Over Clustering Architecture 99
Planning for SQL Server Clustering 99
Clustering Capabilities and Requirements 100
Microsoft Cluster Service 101
System Area Networks 101
Shared Disks 102
Log Shipping 102
Implementing Fail-Over Clustering 102
Setting Up Network Adapters 103
Setting Up Shared Disks 103
Setting Up MSCS on NT 4.0 104
Setting Up MSCS on Windows 2000
(Advanced Server/Datacenter Server) 104
Upgrading to SQL Fail-Over Clustering 105
Setting Up SQL Server 2000 Fail-Over Clustering 108
Distributed Partitioned Views 109
Federated Servers 109

Data Partitioning 111
114_SQL_TOC 1/2/01 4:09 PM Page xiii
xiv Contents
Creating Distributed Partitioned Views 111
Creating Linked Servers 111
Partitioning Your Data 112
Creating a Distributed View 112
Using and Updating a Distributed View 113
Log Shipping 115
Setting Up Log Shipping 116
Monitoring Log Shipping 120
Indexed Views 121
Requirements for an Indexed View 122
Creating an Indexed View 124
Summary 124
FAQs 125
Chapter 4 Designing and Creating SQL Server Databases 127
Introduction 128
SQL Server 2000 Architecture 128
Relational Databases 129
SQL Server System Databases 131
Master 132
TempDB 132
msdb 133
Model 134
Pubs 134
Northwind 135
Physical Storage Architecture 135
Filegroups 136
Data Files 137

Transaction Logs 137
Indexes 138
SQL Server Services 139
SQL Server Service 139
SQL Server Agent Service 142
Microsoft Distributed Transaction Coordinator Service 142
Microsoft Search Service 143
MSSQLServerADHelper Service 143
MSSQLServerOLAPService 143
Creating SQL Server Databases 144
Designing Your Database Solution 144
Database Modeling 145
Designing the Physical Database 146
The Disk Subsystem 146
Capacity and Growth Planning 148
Creating and Configuring Your Database 151
Getting Started 151
114_SQL_TOC 1/2/01 4:09 PM Page xiv
Contents xv
Using the Create Database Wizard 153
Create Database Wizard: Name the Database
and Specify Its Location 155
Create Database Wizard: Name the Database Files 155
Create Database Wizard: Define the
Database File Growth 156
Create Database Wizard: Name the
Transaction Log Files 156
Create Database Wizard: Define the
Transaction Log File Growth 157
Create Database Wizard: Completing the

Create Database Wizard 158
Configuring Your Database 158
Southwind Properties | Filegroups 161
Southwind Properties | Data Files 162
Southwind Properties | Transaction Log 164
Southwind Properties | Options 164
Southwind Properties | Permissions 168
Reviewing the Southwind Configuration 168
Using T-SQL to Create and Alter a Database 169
Monitoring and Maintenance 171
Database Maintenance Plan Wizard 171
Maintenance Plan Wizard: Select Databases 172
Maintenance Plan Wizard: Update Data
Optimization Information 172
Maintenance Plan Wizard: Database Integrity Check 174
Maintenance Plan Wizard: Specify the
Database Backup Plan 175
Maintenance Plan Wizard: Specify the
Backup Disk Directory 175
Maintenance Plan Wizard: Specify the
Transaction Log Backup Plan 176
Maintenance Plan Wizard: Specify Transaction
Log Backup Disk Directory 177
Maintenance Plan Wizard: Reports to Generate 177
Maintenance Plan Wizard: Maintenance Plan History 178
Maintenance Plan Wizard: Completing
Your Maintenance Plan 178
Database Modeling Tools 180
Entity-Relationship Diagrams 180
SQL Server Database Designer 184

Summary 186
FAQs 188
114_SQL_TOC 1/2/01 4:09 PM Page xv
xvi Contents
Chapter 5 Database and Server Security 189
Introduction 190
Planning SQL Server Security 190
Understanding SQL Server Security 191
C2 Certification 193
Administration Access and Server Security 194
Configuring the SQL Server 2000 Service Accounts 194
Securing the SQL Server 2000
Executable and Data Files 197
Object and Data Security 197
Securing Login Access to SQL Server 198
Assigning Privileges to Perform Serverwide Operations 199
Granting Access to Databases 199
Grouping Users into Database Roles 200
Using Views, Stored Procedures, and
User-Defined Functions to Simplify Security 201
Network Communications Security 201
Security Options in SQL Server 202
Understanding the Windows Authentication Mode 202
Understanding the SQL Authentication Mode 205
Database Users, Roles, and Permissions 206
Selecting a Security Mode 207
SQL Server and Windows Authentication 207
Windows-Only Authentication Mode 210
Logins 210
Adding New Windows Logins 210

Server Roles 216
Fixed Roles 216
Database Users 218
Adding New Database Users 219
The Guest User Account 221
Assigning User Permissions 222
Database Roles 225
Fixed Roles 225
User-Defined Roles 227
Implementing Database and Server Security 231
The Scenario 231
User Authentication 232
Operating System Administrative Access 233
Windows 2000 233
SQL Server Logins 234
Assigning Permissions 234
Adding Users to Database Roles 234
Assigning Permissions to Users and Roles 235
114_SQL_TOC 1/2/01 4:09 PM Page xvi
Contents xvii
Network Communications Security 236
Multiprotocol Encryption 236
SSL Support 237
IPSec in Windows 2000 239
Summary 239
FAQs 240
Chapter 6 Administration and Active Directory Integration 243
Introduction 244
Windows 2000 Active Directory Integration 244
Registering SQL Servers in Active Directory 246

SQL Server Properties 246
sp_ActiveDirectory_SCP 248
Registering Databases in Active Directory 249
Database Properties 249
SQL Replication Services and Active Directory 249
SQL Server 2000 Replication 250
Registering Publications in Active Directory 257
Locating and Using Publications in Active Directory 258
Analysis Services and Active Directory 260
Registering Analysis Servers in Active Directory 261
Tools and Techniques for SQL Server Administration 262
Windows 2000 Active Directory 262
Active Directory Users and Computers 263
Microsoft Management Console 265
SQL Server Enterprise Manager 266
SQL Server MMC Snap-Ins 273
Moving and Copying SQL Server Databases 275
Enterprise Manager 277
Copy Database Wizard 278
Detaching and Attaching Databases 281
Linked Servers 282
Distributed Queries 284
Database Maintenance Tools 284
DBCC 285
Database Maintenance Plans 286
Maintenance Plan Wizard 286
SQL-DMO 288
Automating Administrative Tasks 290
SQL Server Agent 290
Alerts and Operators 290

SQL Mail 290
Setting Up Operators 292
Defining Alerts 292
Summary 293
FAQs 294
114_SQL_TOC 1/2/01 4:09 PM Page xvii
xviii Contents
Chapter 7 SQL Server Backup and Recovery 295
Introduction 296
Planning and Implementing a Successful Backup
and Recovery Strategy 296
Determining Data Recovery Requirements 296
Frequency of Database Changes 297
Cost of Data Loss and Availability 298
Planning for Hardware Failure 299
The Tape Unit 299
The Disk Unit 300
The Server 301
The Network 301
Selecting a Backup Strategy 302
Backup Strategy Options 302
Database Backup Options 304
Backup Storage 307
Determining Storage Requirements 307
Backup Storage Media 311
Media Sets, Media Families, and Multiple Drives 313
Secure Offsite Storage 315
Sample Backup Scheme 315
Creating a Recovery Strategy 317
Backup and Restore Tools and Techniques 319

The Create Database Backup Wizard 319
The Database Maintenance Plan Wizard 320
Transact-SQL 321
Backing Up SQL Server Databases 322
Performing a Database Backup 323
Backing Up System Databases 335
Restoring SQL Server Databases 344
Restoring a Database Backup 344
Restoring System Databases 348
Database Options and Settings 352
Testing Your Backup and Recovery Strategy 354
Summary 355
FAQs 356
Chapter 8 Microsoft English Query and Full-Text Search 359
Introduction 360
Overview of English Query 360
What’s New in English Query? 362
More Powerful Applications 363
Installing English Query 364
Installing English Query 364
114_SQL_TOC 1/2/01 4:09 PM Page xviii
Contents xix
Installation Requirements 365
Creating an English Query Application 366
Planning Your English Query Application 366
Understanding Users’ Questions 366
Creating an English Query Project 367
English Query Project Components 368
English Query SQL Project 369
Creating an English Query SQL Project

Using the SQL Project Wizard 370
English Query OLAP Project 371
The English Query Model 373
Building and Deploying Your English Query Application 376
Implementing Web-Based English Query Applications 376
Testing Your English Query Application 377
Putting It All Together 379
Creating a Web-Based English Query Solution 379
An Overview of Full-Text Search 381
File Filtering 381
Full-Text Search Architecture 382
Microsoft Search Service 382
Performance Considerations for Full-Text Indexes 383
Enabling Full-Text Search 387
Creating a Full-Text Catalog 387
Enabling a Database for Full-Text Search 388
Enabling a Table for Full-Text Search 388
Enabling a Column for Full-Text Search 389
Creating a Full-Text Index on the Products Table
in the Northwind Database 390
Building the Full-Text Index 391
Querying Full-Text Indexes 393
FREETEXT and FREETEXTTABLE 393
CONTAINS and CONTAINSTABLE 395
Administering Full-Text Catalogs and Indexes 398
Backing Up Full-Text Catalogs 399
Populating Full-Text Indexes 401
Scheduling Index Rebuilds 402
Summary 403
FAQs 404

Chapter 9 Importing and Exporting Data 407
Introduction 408
Overview of Data Import and Export Tools 408
Data Transformation Services 410
What’s New in DTS? 410
Data Transformation Services Architecture 412
Packages 413
114_SQL_TOC 1/2/01 4:09 PM Page xix
xx Contents
Tasks 413
Transformations 414
Connections 415
Package Workflow 415
Security in DTS Packages 416
DTS Performance Considerations 417
Creating and Editing DTS Packages 419
Creating a Simple Package 419
DTS Import/Export Wizard 420
Copying a Table Between Databases 421
DTS Designer 422
Creating a Data Connection 422
Creating a Task 423
Saving DTS Packages 427
Saving to a SQL Server 427
Saving to Meta Data Services 428
Saving to a DTS Package File 428
Saving to a Visual Basic Script File 429
Executing DTS Packages 429
Executing a Package in the DTS Designer Interface 430
Executing a Package in SQL Enterprise Manager 430

Executing a Package Using the dtsrun.exe Utility 430
Executing a Package Using the dtsrunui.exe Utility 432
Executing a Package Programmatically in Visual Basic 432
The Bulk Copy Program 433
Using BCP 436
SQL-DMO BulkCopy 440
Using the BulkCopy Object 440
The BULK INSERT Command 444
Using BULK INSERT 445
Choosing a Data Import and Export Method 447
Import/Export Job Requirements 447
Existing Data Format 448
Frequency of Import or Export Task 448
Data Manipulation Tasks 448
Performance Considerations 449
Summary 449
FAQs 450
Chapter 10 SQL Server Analysis Services 453
Introduction 454
Online Analytical Processing and Data Mining 454
OLTP vs. OLAP vs. Data Warehousing 455
Data Mining 458
New Features in Analysis Services 459
114_SQL_TOC 1/2/01 4:09 PM Page xx
Contents xxi
OLAP Enhancements 459
Cubes 459
Storage Locations 459
Actions 459
Access from Client Applications 460

Dimensions 460
Security 460
Integrating the Add-Ins 461
Data-Mining Capabilities 461
The Analysis Services Architecture 461
Analysis Server 461
Analysis Manager 462
Cubes 464
Mining Models 465
PivotTable Service 466
Decision Support Objects 466
Installing Analysis Services 466
Analysis Services Requirements 467
Installing Analysis Services for the First Time 467
Upgrading from Earlier Versions 468
Designing and Building an OLAP Solution 469
Designing and Building a Data Warehouse 469
Normalization vs. Denormalization 470
Components of a Data Warehouse 470
Populating Data Warehouses 470
Using DTS to Transform and Load Data 471
Creating an Analysis Services Database 474
Create a Database and Data Source 474
Designing and Building Cubes 475
Using the Cube Wizard 475
Editing Cubes 479
Data Security in Cubes 479
Defining Measures and Dimensions 480
Understanding Measures and Dimensions 480
Creating and Editing Measures and Dimensions 480

Using Your OLAP Solution 482
Querying Cubes 482
HTTP Cube Access 483
Multidimensional Expressions 483
Data Mining in SQL Server 485
Mining Models 485
Relational Data-Mining Models 485
OLAP Data-Mining Models 486
Data Mining Algorithms 486
Creating and Editing Data-Mining Models 486
114_SQL_TOC 1/2/01 4:09 PM Page xxi
xxii Contents
Mining Model Wizard 487
OLAP Mining Model Editor 488
Using Data-Mining Models 488
Data-Mining Training 488
Data-Mining Model Browser 489
Multidimensional Expressions for Data Mining 491
OLE DB for Data Mining 491
Security in Analysis Services 492
Users and Groups 492
Roles 492
Data Security 493
Implementing Security in Analysis Services 493
Accessing Analysis Services Over the Web 494
Configuring IIS for Analysis Services 494
Performance Tuning and Optimization 495
Usage Analysis Wizard 495
Usage-Based Optimization Wizard 496
Summary 496

FAQs 498
Chapter 11 Using XML with SQL Server 499
Introduction 500
Overview of XML and SQL Server Support 500
What Is XML? 500
The Benefits of XML 501
Working with XML 502
XML Documents 502
Extensible Stylesheet Language 504
XML Data-Reduced Schemas 505
XML Path Language 506
XML Support and Limitations in SQL Server 509
Additional XML Resources on the Web 509
W3C.org 510
Biztalk.org 510
XML.org 510
MSDN.Microsoft.com/XML 510
HTTP and URL Query Support 510
Configuring IIS for HTTP Query Support 510
Creating a Database Virtual Directory in IIS 511
Querying SQL Server Using HTTP 512
Supported Query Methods Using HTTP 513
Executing SQL Using HTTP 513
Creating an XML Query Template 515
Executing XML Query Templates 516
XPath Queries 518
114_SQL_TOC 1/2/01 4:09 PM Page xxii
Contents xxiii
Overview of XPath Queries and SQL Server Limitations 518
XPath Limitations in SQL Server 519

Additional Information on the
XML Path Language Specification 519
XPath Data Types and Conversions 519
Using XPath Queries 520
Select…For XML 522
FOR XML Syntax and Use 522
Limitations of FOR XML 525
XML Views 525
XML Data-Reduced Schemas 526
Mapping XML Data to Database Tables and Columns 529
SQL Server XML View Mapper 530
Using the SQL Server View Mapper 530
Using and Updating XML Data 534
Updategrams 534
Downloading SQL Server 2000
XML Updategrams Support 534
Understanding Updategrams 535
T-SQL OPENXML Statement 536
sp_xml_preparedocument
and sp_xml_removedocument 536
ActiveX Data Objects 539
XML Support in ADO 2.6 539
Summary 543
FAQs 544
Chapter 12 Database Replication Techniques
and Configuration 545
Introduction 546
SQL Server Replication Architecture 546
Publisher 546
Subscriber 547

Distributor 547
Publication 547
Article 547
Subscription 548
SQL Server Agent 548
Replication Agents 548
New Replication Features in SQL Server 549
Replication Compatibility 550
Previous Versions of SQL Server 550
Heterogeneous Publishers and Subscribers 551
Heterogeneous Subscribers 551
Heterogeneous Publishers 552
114_SQL_TOC 1/2/01 4:09 PM Page xxiii
xxiv Contents
Designing for Database Replication 552
Replication Requirements 552
Data Location 552
Data Modification 552
Connection Bandwidth and Availability 553
Application and Database Design Considerations 553
Minimize Potential Conflicts 554
Table RowGuid and Identity Values 555
Replication Methods in SQL Server 560
Transactional Replication 560
Queued Updating Subscribers 561
Merge Replication 561
Snapshot Replication 563
Selecting a Replication Method 564
Configuring SQL Server Replication 565
Enabling Server Publishing 565

Assigning a Distributor Server 565
Creating Publications 566
Create Publication Wizard 567
Adding Subscribers 569
Push vs. Pull Subscriptions 569
Replicating Data Over the Internet 571
Replicating Via a Virtual Private Network 571
Replicating through Microsoft Proxy Server 571
Replication Via FTP 573
Configuring a Publisher or Distributor
to Listen on TCP/IP 573
Configuring a Publication to Allow
Subscribers to Retrieve Snapshots Using FTP 574
Configuring a Subscription to Use FTP
to Retrieve a Snapshot 575
Dealing with Replication Conflicts 575
Replication Conflict Viewer 576
Viewing Conflicts 577
Row-Level vs. Column-Level Conflict Tracking 577
Resolving Conflicts 577
Default Resolvers vs. Custom Resolvers 579
SQL Server CE Edition Replication Features 580
Windows CE Subscribers 581
Replication and Active Directory Integration 582
Registering Publications in Active Directory 582
Browsing and Subscribing to
Publications in Active Directory 584
Replication Performance Considerations 585
Hardware Upgrades 586
114_SQL_TOC 1/2/01 4:09 PM Page xxiv

×