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

professional microsoft sql server 2012 administration

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 (6.65 MB, 931 trang )

Professional Microsoft® SQL Server ® 2012 Administration
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2012 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-118-10688-4
ISBN: 978-1-118-28684-5 (ebk)
ISBN: 978-1-118-28218-2 (ebk)
ISBN: 978-1-118-28388-2 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011,
fax (201) 748-6008, or online at />Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifi cally disclaim all warranties, including
without limitation warranties of fi tness for a particular purpose. No warranty may be created or extended by sales or
promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work
is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional
services. If professional assistance is required, the services of a competent professional person should be sought. Neither
the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is
referred to in this work as a citation and/or a potential source of further information does not mean that the author or the
publisher endorses the information the organization or Web site may provide or recommendations it may make. Further,
readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this


work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with
standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media
such as a CD or DVD that is not included in the version you purchased, you may download this material at
. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2012933629
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress
are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other
countries, and may not be used without written permission. Microsoft and SQL Server are registered trademarks of
Microsoft Corporation. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not
associated with any product or vendor mentioned in this book.

CONTENTS
INTR
ODUCTION xxxvii
CHAPTER 1: SQL SERVER 2012 ARCHITECTURE 1
SQL Se
rver 2012 Ecosystem 1
New Important Features in 2012 2
Produ
ction DBA 2
Development DBA 2
Business Intelligence DBA and Developer 3
SQL Se
rver Architecture 4
Dat
abase Files and Transaction Log 4
SQL Native Client 5

Standard System Databases 6
Schemas 8
Synonyms 8
Dynamic Management Objects 9
SQL Server 2012 Data Types 10
Editions of SQ
L Server 17
Editio
n Overview 17
Licensing 18
Summary 20
CHAPTER 2: INSTALLING SQL SERVER 2012 BEST PRACTICES 21
Planning the Sys
tem 22
Hard
ware Options 22
Software and Install Options 27
Ins
talling SQL Server 29
New Ins
talls 30
Side-by-Side Installs 30
Upgrades 30
Unattended Installs 30
Attended Installations 36
Ins
talling Analysis Services 40
Mult
idimensional and Data Mining Mode (UDM Mode) 41
Tabular Mode 42

Ins
talling PowerPivot for SharePoint 43
Burning in the System 45


xx
CONTENTS
Post-Install Confi guration 45
Confi guring SQL Server Settings for Performance 46
tempdb 47
Confi guring SQL Server Setting for Security 49
Best Practices Analyzer (BPA) 50
SQL Server Confi guration Manager 50
Back It Up 51
Uninstalling SQL Server 51
Uninstalling Reporting Services 51
Uninstalling Analysis Services 51
Uninstalling the SQL Server Database Engine 52
Troubleshooting a Failed Install 52
Summary 52
CHAPTER 3: UPGRADING SQL SERVER 2012 BEST PRACTICES 53
Why Upgrade to SQL Server 2012? 53
Risk Mitigation — the Microsoft Contribution 54
Independent Software Vendors and SQL Community Contributions 54
Upgrading to SQL Server 2012 55
In-Place Upgrading 55
Side-by-Side Upgrade 57
In-Place Upgrade versus Side-By-Side Upgrade Considerations 58
Pre-Upgrade Steps and Tools 58
Pre-Upgrade Steps 58

Pre-Upgrade Tools 59
Backward Compatibility 67
Unsupported and Discontinued Features in SQL Server 2012 67
SQL Server 2012 Deprecated Database Features 67
Other SQL Server 2012 Changes A ecting Behavior 68
SQL Server Component Considerations 68
Upgrading Full-Text Catalog 68
Upgrading Reporting Services 68
Upgrading to 64-Bit 69
Post-Upgrade Checks 69
Poor Query Performance After Upgrade 69
Summary 70
CHAPTER 4: MANAGING AND TROUBLESHOOTING
THE DATABASE ENGINE 71
Confi guration and Administration Tools 71
SQL Server Confi guration Manager 72
Startup Parameters 73

xxi
CONTENTS
Startup Stored Procedures 77
Partially Contained Databases 78
Troubleshooting Tools 79
Dedicated Administrator Connection 79
Rebuilding the System Databases 81
Management Studio 82
Reports 82
Confi guring SQL Server in Management Studio 85
Filtering Objects 90
Error Logs 90

Activity Monitor 91
Monitoring Processes in T-SQL 96
sp_who and sp_who2 96
sys.dm_exec_connections 97
sys.dm_exec_sql_text 97
Multiserver Management 98
Central Management Servers and Server Groups 98
SQL Server Utility 99
Trace Flags 99
Getting Help from Support 101
SQLDumper.exe 101
SQLDiag.exe 102
Summary 104
CHAPTER 5: AUTOMATING SQL SERVER 105
Maintenance Plans 106
Maintenance Plan Wizard 106
Maintenance Plan Designer 109
Automating SQL Server with SQL Server Agent 111
Jobs 112
Schedules 117
Operators 118
Alerts 121
SQL Server Agent Security 126
Service Account 126
Access to SQL Agent 126
SQL Server Agent Proxies 127
Confi guring SQL Server Agent 130
General Properties 131
Advanced Properties 132
Alert System Properties 133

Job System Properties 133

xxii
CONTENTS
Connection Properties 134
History Properties 134
Database Mail 134
Architecture 135
Security 135
Confi guration 136
Archiving 140
Multiserver Administration 140
Using Token Replacement 140
Event Forwarding 143
Using WMI 143
Multiserver Administration — Using Master and Target Servers 145
Summary 146
CHAPTER 6: SERVICE BROKER IN SQL SERVER 2012 147
Asynchronous Messaging 147
SQL Service Broker Overview 148
SQL Server Service Broker Versus Other Message Queues 148
Confi guring SQL Server Service Broker 149
Enabling 149
Message Types 151
Contracts 151
Queues 152
Services 153
Routes 154
Priorities 156
Conversation Groups 156

Using SQL Server Service Broker 157
Sending Messages 157
Receiving Messages 160
Sending Messages Between Databases 161
Sending Messages Between Instances 162
External Activation 163
Summary 165
CHAPTER 7: SQL SERVER CLR INTEGRATION 167
Introduction to the CLR 167
SQL Server as a .NET Runtime Host 169
Application Domains 170
T-SQL versus CLR 170
Enabling CLR Integration 171
Creating CLR Assemblies 172
The Non-Visual Studio Way 172

xxiii
CONTENTS
Using Microsoft SQL Server Data Tools 174
Securing CLR 176
Performance Monitoring 177
Windows System Monitor 177
SQL Profi ler 178
Dynamic Management Views (DMVs) 179
CLR Integration Design Goals 180
Summary 180
CHAPTER 8: SECURING THE DATABASE INSTANCE 181
Authentication Types 181
SQL Authentication 182
Windows Authentication 183

SQL Versus Windows Authentication 183
Authorizing Securables 184
Server Securables 185
Database Securables 189
Permission Chains 190
Cross Database Permission Chains 191
Row Level Security 193
Summary 194
CHAPTER 9: CHANGE MANAGEMENT 197
Creating Solutions and Projects 198
Creating a Connection 199
Creating a Project Query 200
Policy-Based Management 200
Policy-Based Management Overview 201
Policy-Based Management Step by Step 202
Scripting Policy-Based Management 209
Policy-Based Management Implementation 210
DDL Trigger Syntax 212
Database Triggers 212
Server Triggers 217
Trigger Views 218
Scripting Overview 218
sqlcmd 219
PowerShell 223
Creating Change Scripts 225
Data-Tier Applications 225
SQL Server Data Tools 229
Version Tables 229
Summary 231


xxiv
CONTENTS
CHAPTER 10: CONFIGURING THE SERVER FOR OPTIMAL
PERFORMANCE 233
What Every DBA Needs to Know About Performance 234
The Performance Tuning Cycle 234
Defi ning Good Performance 235
Focus on What’s Most Important 236
What the Developer DBA Needs to Know About Performance 237
Users 237
SQL Statements 237
Data Usage Patterns 238
Robust Schema 238
What the Production DBA Needs to Know About Performance 238
Optimizing the Server 239
Hardware Management 241
CPU 241
x64 242
Cache 242
Hyper-threading 243
Multicore 244
System Architecture 246
Memory 248
Physical Memory 248
Physical Address Space 248
Virtual Memory Manager 249
The Page File 249
Page Faults 250
I/O 251
Network 252

Disks 252
Storage Considerations 255
Designing a Storage System 257
Large Storage System Considerations: SAN Systems 262
Server Confi guration 264
Fragmentation 269
Summary 271
CHAPTER 11: OPTIMIZING SQL SERVER 2012 273
Application Optimization 273
Defi ning a Workload 274
System Harmony Is the Goal 274
The Silent Killer: I/O Problems 274

xxv
CONTENTS
SQL Server I/O Process Model 275
Database File Placement 275
tempdb Considerations 276
Table and Index Partitioning 279
Why Consider Partitioning? 280
Creating a Partition Function 281
Creating Filegroups 284
Creating a Partition Scheme 284
Creating Tables and Indexes 285
Data Compression 290
Row Compression 290
Page Compression 291
Estimating Space Savings 293
Monitoring Data Compression 295
Data Compression Considerations 295

CPU Considerations 296
Cache Coherency 297
A nity Mask 297
Max Degree of Parallelism (MAXDOP) 300
A nity I/O Mask 301
Memory Considerations and Enhancements 302
Tuning SQL Server Memory 302
64-bit Versions of SQL Server 2012 305
Data Locality 306
Max Server Memory 307
Index Creation Memory Option 307
Minimum Memory per Query 308
Resource Governor 309
The Basic Elements of Resource Governor 309
Using Resource Governor from SQL Server 2012
Management Studio 313
Monitoring Resource Governor 314
Summary 315
CHAPTER 12: MONITORING YOUR SQL SERVER 317
The Goal of Monitoring 318
Determining Your Monitoring Objectives 318
Establishing a Baseline 318
Comparing Current Metrics to the Baseline 319
Choosing the Appropriate Monitoring Tools 319
Performance Monitor 321
CPU Resource Counters 322

xxvi
CONTENTS
Disk Activity 324

Memory Usage 330
Performance Monitoring Tools 333
Monitoring Events 335
The Default Trace 337
system_health Session 338
SQL Trace 338
Event Notifi cations 352
SQL Server Extended Events 355
Monitoring with Dynamic Management Views and Functions 376
What’s Going on Inside SQL Server? 377
Viewing the Locking Information 380
Viewing Blocking Information 380
Index Usage in a Database 381
Indexes Not Used in a Database 382
View Queries Waiting for Memory Grants 383
Connected User Information 384
Filegroup Free Space 384
Query Plan and Query Text for Currently Running Queries 385
Memory Usage 385
Bu er Pool Memory Usage 385
Monitoring Logs 386
Monitoring the SQL Server Error Log 386
Monitoring the Windows Event Logs 387
Management Data Warehouse 387
System Data Collection Sets 388
Viewing Data Collected by the System Data Collection Sets 388
Creating Your Own Data Collection Set 390
Examining the Data You Collected 392
SQL Server Standard Reports 393
System Center Management Pack 395

SQL Server Best Practice Analyzer 396
System Center Advisor 396
Summary 397
CHAPTER 13: PERFORMANCE TUNING T-SQL 399
Physical Query Processing Part One: Compilation
and Recompilation 399
Compilation 400
Recompilation 401
Tools and Commands for Recompilation Scenarios 408

xxvii
CONTENTS
Parser and Algebrizer 410
Optimization 412
Physical Query Processing Part Two: Execution 417
Database I/O Information 418
Working with the Query Plan 419
Estimated Execution Plan 420
Actual Execution Plan 424
Index Access Methods 427
Fragmentation 438
Statistics 439
Join Algorithms 440
Data Modifi cation Query Plan 443
Query Processing Enhancements on Partitioned Tables and Indexes 444
Gathering Query Plans for Analysis with SQL Trace 446
Summary 447
CHAPTER 14: INDEXING YOUR DATABASE 449
Noteworthy Index-Related Features in SQL Server 449
What’s New for Indexes in SQL Server 2012 450

Index Features from SQL Server 2008R2, SQL Server 2008,
and SQL Server 2005 452
Partitioned Tables and Indexes 455
Understanding Indexes 455
Creating Indexes 458
Why Use Both Partitioned Tables and Indexes? 459
Creating Partitioned Tables 460
Index Maintenance 461
Monitoring Index Fragmentation 462
Cleaning Up Indexes 462
Improving Query Performance with Indexes 464
Database Tuning Advisor 468
Too Many Indexes? 469
Summary 471
CHAPTER 15: REPLICATION 473
Replication Overview 473
Replication Components 474
Replication Types 476
Replication Enhancements in SQL Server 2012 478
Replication Models 478
Single Publisher, One or More Subscribers 478

xxviii
CONTENTS
Multiple Publishers, Single Subscriber 480
Multiple Publishers Also Subscribing 481
Updating Subscriber 482
Peer-to-Peer 483
Implementing Replication 484
Setting Up Snapshot Replication 484

Setting Up Distribution 484
Implementing Snapshot Replication 487
Implementing Transactional and Merge Replication 497
Peer-to-Peer Replication 498
Setting Up Peer-to-Peer Replication 498
Confi guring Peer-to-Peer Replication 499
Scripting Replication 502
Monitoring Replication 502
Replication Monitor 502
Performance Monitor 505
Replication DMVs 505
sp_replcounters 506
Summary 507
CHAPTER 16: CLUSTERING SQL SERVER 2012 509
Clustering and Your Organization 510
What Clustering Can Do 510
What Clustering Cannot Do 511
Choosing SQL Server 2012 Clustering for the Right Reasons 512
Alternatives to Clustering 512
Clustering: The Big Picture 514
How Clustering Works 515
Clustering Options 518
Upgrading SQL Server Clustering 520
Don’t Upgrade 520
Upgrading Your SQL Server 2012 Cluster In Place 520
Rebuilding Your Cluster 521
Back-Out Plan 523
Which Upgrade Option Is Best? 523
Getting Prepared for Clustering 523
Preparing the Infrastructure 523

Preparing the Hardware 524
Clustering Windows Server 2008 527
Before Installing Windows 2011 Clustering 527
Installing Windows Server 2008 Failover Clustering 528
Preparing Windows Server 2008 for Clustering 531

xxix
CONTENTS
Clustering Microsoft Distributed Transaction Coordinator 532
Clustering SQL Server 2012 534
Step by Step to Cluster SQL Server 534
Installing the Service Pack and Cumulative Updates 540
Test, Test, and Test Again 540
Managing and Monitoring the Cluster 542
Troubleshooting Cluster Problems 543
How to Approach Windows Failover Clustering
Troubleshooting 544
Doing It Right the First Time 544
Gathering Information 544
Resolving Problems 545
Working with Microsoft 545
Summary 546
CHAPTER 17: BACKUP AND RECOVERY 547
Types of Failure 548
Hardware Failure 548
Data Modifi cation Failure 548
Software Failure 550
Local Disasters 550
Making Plans 551
Backup/Recovery Plan 551

Disaster Recovery Planning 554
Creating the Disaster Recovery Plan 556
Maintaining the Plan 558
Overview of Backup and Restore 559
How Backup Works 559
Copying Databases 562
Backup Compression 570
Comparing Recovery Models 571
Choosing a Model 573
Switching Recovery Models 574
Backing Up History Tables 575
Permissions Required for Backup and Restore 576
Backing Up System Databases 577
Full-Text Backup 578
Verifying the Backup Images 578
How Restore Works 579
Preparing for Recovery 581
Recoverability Requirements 581
Data Usage Patterns 582

xxx
CONTENTS
Maintenance Time Window 583
Other High-Availability Solutions 584
Developing and Executing a Backup Plan 585
Using SQL Server Management Studio 585
Database Maintenance Plans 589
Using Transact-SQL Backup Commands 591
Managing Backups 593
Backup and Restore Performance 594

Performing Recovery 594
Restore Process 594
SQL Server Management Studio Restore 599
T-SQL Restore Command 602
Restoring System Databases 602
Archiving Data 604
SQL Server Table Partitioning 604
Partitioned View 605
Summary 606
CHAPTER 18: SQL SERVER 2012 LOG SHIPPING 607
Log Shipping Deployment Scenarios 608
Log Shipping to Create a Warm Standby Server 608
Log Shipping as a Disaster Recovery Solution 609
Log Shipping as a Report Database Solution 610
Log-Shipping Architecture 611
Primary Server 611
Secondary Server 611
Monitor Server 612
Log Shipping Process 612
System Requirements 613
Network 613
Identical Capacity Servers 613
Storage 614
Software 614
Deploying Log Shipping 614
Initial Confi guration 614
Deploying with Management Studio 616
Deploying with T-SQL Commands 624
Monitoring and Troubleshooting 624
Monitoring with Management Studio 625

Monitoring with Stored Procedures 626
Troubleshooting Approach 626

xxxi
CONTENT
S
Managing Changing Roles 6
27
Synchronizing Dependencies 627
Switching Roles from the Primary to Secondary Servers 630
Switching Between Primary and Secondary Servers 632
Redirecting Clients to Connect to the Secondary Server 632
Database Backup Plan 633
Int
egrating Log Shipping with Other High-Availability Solutions 634
SQL Server 2012 Data Mirroring 634
Windows Failover Clustering 635
SQL Server 2012 Replication 635
Remov
ing Log Shipping 636
Removing Log Shipping with Management Studio 636
Removing Log Shipping with T-SQL Commands 636
Log
-Shipping Performance 637
Upgrading to SQL Server 2012 Log Shipping 638
Minimum Downtime Approach 638
With Downtime Approach 638
Deploy Log Shipping Approach 639
Summary 639
CHA

PTER 19: DATABASE MIRRORING 641
Over
view of Database Mirroring 641
Operating Modes of Database Mirroring 643
Database Mirroring In Action 645
Preparing the Endpoints 646
Preparing the Database for Mirroring 652
Initial Synchronization Between Principal and Mirror 653
Establishing the Mirroring Session 653
High-Safety Operating Mode Without Automatic Failover 655
High-Safety Operating Mode with Automatic Failover 655
High-Performance Operating Mode 657
Database Mi
rroring and SQL Server 2012 Editions 658
Database Mirroring Catalog Views 658
sys.database_mirroring 658
sys.database_mirroring_witnesses 660
sys.database_mirroring_endpoints 660
Database Mirroring Ro
le Change 661
Automatic Failover 661
Manual Failover 664
Forced Failover 666
Database Availabilit
y Scenarios 667
Prin
cipal Is Lost 667


xxxii

CONTENTS
Mirror Is Lost 668
Witness Is Lost 669
Mirror and Witness Are Lost 669
Monitoring Database Mirroring 670
Monitoring Using System Monitor 670
Monitoring Using Database Mirroring Monitor 672
Setting Thresholds on Counters and Sending Alerts 676
Troubleshooting Database Mirroring 678
Troubleshooting Setup Errors 678
Troubleshooting Runtime Errors 679
Automatic Page Repair 680
Preparing the Mirror Server for Failover 681
Hardware, Software, and Server Confi guration 681
Database Availability During Planned Downtime 682
SQL Job Confi guration on the Mirror 684
Database TRUSTWORTHY Bit on the Mirror 684
Client Redirection to the Mirror 684
Mirroring Multiple Databases 685
Database Mirroring and Other High-Availability Solutions 686
Database Mirroring versus Clustering 687
Database Mirroring versus Transactional Replication 687
Database Mirroring versus Log Shipping 687
Database Mirroring Versus Availability Groups 688
Mirroring Event Listener Setup 688
Database Snapshots 692
Summary 693
CHAPTER 20: INTEGRATION SERVICES ADMINISTRATION
AND PERFORMANCE TUNING 695
A Tour of Integration Services 696

Integration Services Uses 696
The Main Parts of Integration Services 697
Project Management and Change Control 699
Administration of the Integration Services Service 699
An Overview of the Integration Services Service 700
Confi guration 700
Event Logs 704
Monitoring Activity 705
Administration of Integration Services Packages in
Package Deployment Model 706
Using Management Studio for Package Management 706
Deployment 709

xxxiii
CONTENTS
Administration of Integration Services Packages
in Project Deployment Model 712
Confi guring the SSIS Catalog 712
Deploying Packages 714
Confi guring Packages 716
Execution and Scheduling 719
Running Packages in SQL Server Data Tools 720
Running Packages with the SQL Server Import
and Export Wizard 720
Running Packages with DTExec 720
Running Packages with DTExecUI (Package
Deployment Model) 721
Running Packages with the Execute Package Tool
(Project Deployment Model) 722
Scheduling Execution with SQL Server Agent 723

Running Packages with T-SQL 725
Applying Security to Integration Services 725
An Overview of Integration Services Security 725
Securing Packages in Package Deployment Model 726
Summary 728
CHAPTER 21: ANALYSIS SERVICES ADMINISTRATION
AND PERFORMANCE TUNING 729
Tour of Analysis Services 730
MOLAP Components 731
Tabular Model Components 732
Analysis Services Architectural Components 732
Administering Analysis Services Server 733
Server Properties 734
Required Services 735
Analysis Services Scripting Language 736
Administering Analysis Services Databases 737
Deploying Analysis Services Databases 737
Processing Analysis Services Objects 741
Backing Up and Restoring Analysis Services Databases 745
Synchronizing Analysis Services Databases 748
Analysis Services Performance Monitoring and Tuning 749
Monitoring Analysis Services Events 749
Creating Traces for Replay 750
Using Flight Recorder for After-the-Fact Analysis 751
Management of Analysis Services MOLAP Model Storage 752
Storage Modes 752

xxxiv
CONTENTS
Partition Confi guration 753

Designing Aggregations in the MOLAP Model 755
Applying Security to Analysis Services in the MOLAP Model 758
Server Role 758
Database Role 758
Database Role Permissions 760
Applying Security to Analysis Services in the Tabular Model 762
Summary 763
CHAPTER 22: SQL SERVER REPORTING SERVICES
ADMINISTRATION 765
SQL Server Reporting Services Confi guration Manager 765
The Service Account 768
The Web Service URL 769
Reporting Services Databases 771
The Report Manager URL 773
E-mail Settings 774
Execution Account 775
Encryption Keys 776
Scale-out Deployment 777
Report Server Properties 778
General Properties Page 779
Execution Properties Page 780
History Properties Page 781
Logging Properties Page 781
Security Properties Page 782
Advanced Properties Page 783
The Report Execution Log 784
Report Builder 786
Report Manager 795
Managing Report Manager 796
Managing Reports 803

Summary 814
CHAPTER 23: SQL SERVER 2012 SHAREPOINT 2010 INTEGRATION 815
Components of Integration 815
PowerPivot 816
Reporting Services 818
Power View 819
Service Application Architecture 820
Data Refresh 820

xxxv
CONTENTS
Using Data Connections in Excel 820
PerformancePoint Data Refresh 826
Visio Services Data Refresh 827
PowerPivot Data Refresh 829
Summary 836
CHAPTER 24: SQL AZURE ADMINISTRATION
AND CONFIGURATION 837
Introduction to SQL Azure 837
SQL Azure Architecture 838
Client Layer 838
Services Layer 838
Platform Layer 839
Infrastructure Layer 839
Confi guring SQL Azure 839
Server and Database Provisioning 840
Throttling and Load Balancing 844
Confi guring SQL Azure Firewalls 845
Connecting to SQL Azure 847
Administering SQL Azure 848

Creating Logins and Users 848
Assigning Access Rights 850
Working with SQL Azure 850
Backups with SQL Azure 852
Object Explorer for SQL Azure 852
What’s Missing in SQL Azure 854
Summary 855
CHAPTER 25: ALWAYSON AVAILABILITY GROUPS 857
Architecture 858
Availability Group Replicas and Roles 858
Availability Modes 859
Types of Failover Supported 859
Allowing Read-Only Access to Secondary Replicas 860
Availability Group Example 862
Confi gure a New Availability Group 862
Confi gure an Existing Availability Group 870
Availability Group Failover Operation 872
Suspend an Availability Database 873
Resume an Availability Database 874
Client Application Connections 874

xxxvi
CONTENTS
Active Secondary for Secondary Read-Only 875
Read-Only Access Behavior 876
Secondary Replica Client Connectivity 876
Performance 878
Backup on the Secondary Replica 879
Evaluate Backup Replicas Metadata 880
AlwaysOn Group Dashboard 881

Monitoring and Troubleshooting 883
Summary 884
INDEX 885

INTRODUCTION
SQL SERVER 2012 REPRESENTS A SIZABLE jump forward in scalability, performance, and usability
for the DBA, developer, and business intelligence (BI) developer. It is no longer unheard of to have
40-terabyte databases running on a SQL Server. SQL Server administration used to just be the job
of a database administrator (DBA), but as SQL Server proliferates throughout smaller companies,
many developers have begun to act as administrators and BI developers as well. In addition, some of
the new features in SQL Server are more developer-centric, and poor confi guration of these features
can result in poor performance. SQL Server now enables all roles through signifi cantly improved
data tools experiences, better security integration, and drastic improvements in data integration,
administration, availability, and usability. Professional Microsoft SQL Server2012 Administration
is a comprehensive, tutorial-based book to get you over the learning curve of how to confi gure and
administer SQL Server 2012.
WHO THIS BOOK IS FOR
Whether you’re an administrator or developer using SQL Server, you can’t avoid wearing a DBA
hat at some point. Developers often have SQL Server on their own workstations and must provide
guidance to the administrator about how they’d like the production confi gured. Oftentimes, they’re
responsible for creating the database tables and indexes. Administrators or DBAs support the
production servers and often inherit the database from the developer.
This book is intended for developers, DBAs, and casual users who hope to administer or may
already be administering a SQL Server 2012 system and its business intelligence features, such as
Integration Services. This book is a professional book, meaning the authors assume that you know
the basics about how to query a SQL Server and have some rudimentary concepts of SQL Server.
For example, this book does not show you how to create a database or walk you through the
installation of SQL Server using the wizard. Instead, the author of the installation chapter provides
insight into how to use some of the more advanced concepts of the installation. Although this book
does not cover how to query a SQL Server database, it does cover how to tune the queries you’ve

already written.
HOW THIS BOOK IS STRUCTURED
This book follows the same basic path of previous editions, with one major change. The author team
has been selected specifi cally to focus on their areas of expertise. The authors are the same people
seen at major conferences and delivering top-tier services for topics such as performance tuning,
business intelligence, database design, high availability, PowerShell, and even SQL Azure! This
approach has led to unprecedented focus on quality and content with even better access to folks at
Microsoft to drive the content in this new release of SQL Server. Hundreds of Connect items were

xxxviii
INTRODUCTION
fi led and resolved as a direct result of the work of this author team pushing for higher quality for
you. Connect is the primary method for industry professionals and SQL Server MVPs to provide bug
reports and vote on feature requests from Microsoft. It’s a great outlet for improving the product.
This edition of the book covers all the same great information covered in the previous edition, but
with loads of new content added for SQL Server 2012, which includes numerous new features to
improve the DBA’s life. In short, the new version of SQL Server focuses on improving your effi ciency,
the scale of your server, and the performance of your environment, so you can do more in much less
time, and with fewer resources and people. The following is a brief description of each chapter.
Chapter 1: SQL Server 2012 Architecture — The book starts off with a review of the new
architecture changes and focuses on the overall components that make up SQL Server 2012.
Chapter 2: Installing SQL Server 2012 Best Practices — This chapter reviews the different
ways to install SQL Server 2012 and covers best practices for the process.
Chapter 3: Upgrading SQL Server 2012 Best Practices — This chapter covers upgrading to
SQL Server 2012 and best practices to keep in mind while upgrading. Choosing the best
upgrade method, requirements, and benefi ts of upgrading are also covered.
Chapter 4: Managing and Troubleshooting the Database Engine — This chapter focuses
on the database engine and working through challenges as they arise. It also covers
management and tools appropriate for the task.
Chapter 5: Automating SQL Server — This chapter focuses on automation throughout the

SQL Server 2012 world including jobs, PowerShell, and other ways to automate.
Chapter 6: Service Broker in SQL Server 2012 — Service Broker is a great tool to handle
messaging inside the database. This chapter covers setup, operations, and management of
Service Broker.
Chapter 7: SQL Server CLR Integration — SQL Server and .NET work together inside the
Common Language Runtime. This chapter focuses on integrating .NET and the CLR with
SQL Server, including assemblies and other options.
Chapter 8: Securing the Database Instance — Security is critical in the database engine.
This chapter helps you outline and implement your security plan.
Chapter 9: Change Management — Managing change is paramount to operational stability.
This chapter focuses on features in SQL Server that support change management.
Chapter 10: Confi guring the Server for Optimal Performance — Confi guring and setting
up your server properly is important for maximizing application and database performance.
This chapter discusses storage, server options, and other settings critical to system
performance.
Chapter 11: Optimizing SQL Server 2012 — This chapter covers topics that help the reader
review and analyze performance. It also focuses on settings and confi guration items that
improve SQL Server performance.
Chapter 12: Monitoring Your SQL Server — SQL Server is critically important to make
sure you keep performance where it needs to be. This chapter covers the important aspects
and tools used to monitor SQL Server 2012.

INTRODUCTION
xxxix
Chapter 13: Performance Tuning T-SQL — Writing effi cient and effective T-SQL is
important to have good application performance and scalability. This chapter explains how
to optimize your T-SQL to make it more effi cient. It focuses on how SQL Server’s engine
and internals read and execute your queries. You then learn how to take advantage of areas
where this process can be tweaked and best practices can be leveraged.
Chapter 14: Indexing Your Database — Indexing is critical to successful database

performance. This chapter discusses considerations and strategies for effective indexing for
your database.
Chapter 15: Replication — Replication is a key feature in SQL Server for keeping tables
and databases in sync and supporting applications. This chapter will cover the types of
replication, how to set them up, and the pros and cons of each.
Chapter 16: Clustering SQL Server 2012 — Clustering has been improved again in SQL
2012 and this chapter takes the reader through the setup, confi guration, and testing of your
clustered confi guration.
Chapter 17: Backup and Recovery — Backup and recovery is critical to the success of a
continuity plan and operational achievement. This chapter outlines the options in SQL
Server for backups and recoveries, and provides recommendations to make the most of these
features.
Chapter 18: SQL Server 2012 Log Shipping — This chapter goes through setup,
confi guration, and administration of log shipping.
Chapter 19: Database Mirroring — There is more functionality in this release for
availability than ever before. This chapter covers new and existing features to help you keep
your systems online for your organization.
Chapter 20: Integration Services Administration and Performance Tuning — Integration
is the key to making sure systems stay in sync. This chapter focuses on administering and
tuning this great feature in SQL Server.
Chapter 21: Analysis Services Administration and Performance Tuning — Analysis Services
is the Online Analytical Processing (OLAP) product of choice and cannot be ignored by
data administrators. This chapter helps you get prepared.
Chapter 22: SQL Server Reporting Services Administration — Reporting Services is often
administered by the DBA and this book prepares you no matter what your role to handle
those Reporting Services challenges.
Chapter 23: SQL Server 2012 SharePoint 2010 Integration — SharePoint is a bigger part of
SQL Server than ever. This chapter covers what you need to know about how SharePoint
2010 integrates with SQL Server so you can be prepared to interact with that team or take
on some SharePoint database administration responsibilities yourself.

Chapter 24: SQL Azure Administration and Confi guration — This chapter introduces the
reader to SQL Server Azure and gets you up and running on this exciting new cloud platform.
Chapter 25: AlwaysOn Availability Groups — This chapter focuses on the availability
group feature in Always On. These groups allow you to control instances and servers
as groups and assign prioritization and additional fl exibility to how failover and high
availability are handled in your environment.

×