作者:empty 页数:2498 出版社:empty |
This is the industry's most comprehensive and useful guide to SQL Server 2008 and 2008 R2. It presents start-to-finish coverage of SQL Server's core database server and management capabilities, plus complete introductions to Integration, Reporting, and Analysis Services, application development, and much more. Four expert SQL Server administrators, developers, and consultants have packed this book with real-world information, tips, guidelines, and samples drawn from their own extensive experience creating and managing complex database solutions. Writing for intermediate-to-advanced-level SQL Server professionals, they focus on the product's most complex and powerful capabilities, and its newest tools and features. For example, you'll find invaluable information on administering SQL Server more efficiently, analyzing and optimizing queries, implementing data warehouses, ensuring high availability, and tuning performance. The accompanying CD-ROM contains an extraordinary library of practical tools and information including sample databases and all code examples. Whether you're responsible for SQL Server 2008 analysis, design, implementation, support, administration, or troubleshooting, no other book offers you this much value. * Understand the Microsoft SQL Server 2008 environment, R2's newest features, and each edition's capabilities * Manage SQL Server 2008 more effectively with SQL Server Management Studio, the SQLCMD command-line query tool, and Powershell * Efficiently manage security, users, backup/restore, replication, Database Mail, and database objects-from tables and indexes to stored procedures and triggers * Increase availability with clustering, database mirroring, and other features * Use new Policy-Based Management to centrally configure and operate SQL Server throughout the organization * Use SQL Server Profiler to capture queries and identify bottlenecks * Improve performance by optimizing queries, design more effective databases, and manage workloads with the new Resource Governor * Develop applications using SQL Server 2008's enhancements to T-SQL and SQLCLR, .N ET integration, LINQ to SQL, XML, and XQuery * Make the most of Analysis Services, Integration Services, and Reporting Services-especially Microsoft's new R2 reporting improvements * Improve data security using Column-level and Transparent Data Encryption CD-ROM includes: *15 additional chapters * Code samples, scripts, and databases utilized within the book * Free version of SQL Shot (performance & tuning software)
Author:Ray RankinsPaul T. BertucciChris GallelliAlex T. Silverstein
Introduction.
Part I Welcome to Microsoft SQLServer
1SQLServer 2008 Overview..
2What's New in SQLServer 2008.
Part II SQLServer Tools and Utilities
Part III
Examples of SQLServer Implementations..
SQLServer Management Studio.
SQLServer Command-Line Utilities.
6SQLServer Profiler.
SQLServer Administration
SQLServer System and Database Administration..
8Installing SQLServer 2008.
9Upgrading to SQLServer 2008.
10Clent Installation and Configuration.
11Security and User Administration.
12Data Encryption..
13Security and Compliance..
14Database Backup and Restore..
15Database Mail..
16SQLServer Scheduling and Notification.o.
17Administering SQLServer 2008 with Power Shell.
18SQLServer High Availability.
19Replication..
20Database Mirroring.
21SQLServer Clustering..
22Administering Policy-Based Management.
Part IV Database Administration
23Creating and Managing Databases..
24Creating and Managing Tables.
25Creating and Managing Indexes..
26Implementing Data Integrity.
27Creating and Managing Views in SQLServer.
28 Creating and Managing Stored Procedures..
Creating and Managing User-Defined Functions.
30Creating and Managing Triggers-..
31Transaction Management and the Transaction Log.
32Database Snapshots..
33
Database Maintenance.
Part V SQLServer Performance and Optimization
34DataStructures, Indexes, and Performance.
35Understanding Query Optimization..
36Query Analys ls..
37Locking and Performance..
38Database Design and Performance.
39Monitoring SQLServer Performance..
40Managing Workloads with the Resource Governor..
41A Performance and Tuning Methodology-.
Part ViSQLServer Application Develop-
ment
42What's New for Transact-SQL in SQLServer 2008..
Transact-SQL Programming Guidelines, Tips, and Tricks..
44
Part I Welcome to Microsoft SQLServer
Advanced Stored Procedure Programming and Optimization-..
455QL Server and the NET Framework.
46SQL CLR:Developing SQLServer Objects in.NET..
47Using XML in SQLServer 2008..
48SQLServer WebServices.
495QL Server Service Broker.
50SQLServer Full-Text Search..
51SQLServer 2008 Analysis Services..
525QL Server Integration Services..
53SQLServer 2008 Reporting Services-
54Managing Linked and Remote Servers.
55Con llg uring, Tuning, and Optimizing SQLServer Options.
56SQLServer Disaster Recovery Planning..
TableofContents
5QL Server 2008 Overview
SQLServer Components and Features.
SQLServer 2008R 2 Editions.
SQLServer Licensing Models..
Summary.
2 What's New in SQLServer 2008
New SQLServer 2008 Features..
The SQLServer Database Engine.
SQLServer 2008 Administration and Management Tools.
Replication.
Database Mirroring..
Full-Text Search..
SQLServer Integration Services{SSIS 1..
SQLServer Analysis Services(SSAS) .
SQLServer Reporting Services IS SRS) ..
SQLServer Service Broker..
SQLServer 2008 Standard Edition..
SQLServer 2008 Enterprise Edition..
Differences Between the Enterprise and
Standard Editions of SQLServer.
Other SQLServer 2008 Editions..
Web Edition.
Developer Edition Licensing.
Express Edition Licensing..
Compact Edition 3.5 Licensing.
Choosing a Licensing Model.
Mixing Licensing Models..
Passive Server/Failover Licensing.
Virtual Server Licensing..
Multiple Instances of SQLServer.
New Storage Features..
New DataTypes.
New Transact-SQL Constructs.
New Performance Features.
New Security Features..
.New Database Administration Features..
New SQLServer Management Studio Features..
Power Shell Integration.
New Premium SQLServer Editions.
SQLServer Utility for Multiserver Management.
Power Pivot for Excel and SharePoint..
New Reporting Services Features.
SQLServer Management Studio.
Dynamic Management Views..
Database Mir to ring--.
SQL CLR Enhancements..
Replication Enhancements..
5QL Server Integration Services Enhancements..
Service Broker Enhancements..
Analysis Services Enhancements..
Installation Enhancements..
Deprecated Features..
OLTP ERP Example..
OLTP ShoppingCart Example..
DSS Example One a i.
DSS Example Two..
DSS Example Three..
Window Management..
Integrated Help.
Registered Servers..
Object Explorer.rn
Activity Monitor..
Development Tools.
Summary..
What's New in SQLServer Command-Line Utilities..
The sql cmd Command-Line Utility.
The dta Command-Line Utility..
The table diff Command-Line Util ty.
The be p Command-Line Utility.
The sql diag Command-Line Uti ity-.
The sql serv r Command-Line Ut ity..
Creating Traces..
Saving and Exporting Traces..
Defining Server-Side Traces.
SQLServer 2008 Enhancements.
Summary.
3 Examples of SQLServer Implementations
Application Terms.
OLTP Application Examples..
DSS Application Examples..
5ummary..
4 SQLServer Management Studio
Part II SQLServer Tools and Utilities
What's New in SSMS..
The T ntegrated Environment..
Administration Tools..
5QL Server Command-Line Utilities
Summary.
Contents
vii
LogFile Viewer.
SQLServer Utility.
The Query Editor.
Managing Projects in SSMS..
Events.aio.
DataColumn 5..
Filters a..
Saving Trace Output to a File.
Saving Trace Output to a Table..
Saving the Profiler GUI Output..
Importing Trace Files, ..
Integrating SSMS with Source Control..
Using SSMS Templates.
T-SQL Debugging..
Multiserver Queries.
Executing the sql cmd Utility..
Using Scripting Variables with sql cmd..
6
SQLServer Profiler
What's New with SQLServer Profiler.
SQLServer Profiler Architecture.
Executing Traces and Working with Trace Output..
Replaying TraceD at.
Importing a TraceFile into aT race Table..
Analyzing Trace Output with the Database Engine Tuning Advisor 138
Monitoring Running Traces..153
Stopping Server-Side Traces..155
Profiler Usage Scenar los.
Summary.
Installation Requirements.
Installation Walkthrough..
Contents
Analyzing Slow Stored Procedures or Queries..
Deadlocks.
Identifying AdHoc Queries..
Identifying Performance Bottlenecks.
Monitoring Auto-Update Statistics..
Monitoring Application Progress..
The master Database.
The resource Database..
The model Database..
The msdb Database..
The distribution Database.
The tempdb Database..
Maintaining System Databases.
Compatibility Views.
Catalog Views..i.
Information Schema Views.n.o..
Dynamic Management Views.
Useful System Stored Procedures.o.
Hardware Requirements.
Software Requirements..
Install Screens, Step by Step.
Upgrading Using a Configuration File.
What's New in Client Installation and Configuration.
Clent/Server Networking Considerations.
Clent Install at.
Client Configuration.
ClientData Access Technologies.
Part II SQLServer Administration
7 SQLServer System and Database Administration
What's New in SQLServer System and Database Administration .. 165
System Administrator Respons t bilities.166
System Databases.166
System Tables.170
System Views.171
System Stored Procedures.181
5ummary.183
8 Installing SQLServer 2008185
What's New in Installing SQLServer 2008..185
Installing SQLServer Using a Configuration File..212
Other Options Avaiable in the SQLServer Install at on Center . 211
Running an Automated or Manual Install..217
Installing Service Packs and Cumulative Updates..
Slipstream Installations..
Summary..
9 Upgrading to SQLServer 2008
What's New in Upgrading SQLServer.
Using the SQLServer Upgrade Advisor(UA) .
Destination:SQLServer2008orSQLServer2008R2-.
Slipstreaming Upgrade..
Upgrading Other SQLServer Components..
Summary.
10 Client Installation and Configuration
Summary.
Installing SPl from the CommandLine.
GettingStarted with the UA..
The Analysis Wizard.
The Report Viewer.
Side-by-Side Migration..
Upgrading In-Place.
..p grading from SQLServer 7or SQLServer 6.5.
Upgrading Analysis Services.
Upgrading Reporting Services.
Server Network Protocols..
The Server Endpoint Layer.
The Role of SQL Browser.
Installation Requirements.
Installing the Client Tools..
Installing SNAC.
Client Configuration Using S SCM.
Connection Encryption.
Provider Choices..
Driver Choices..
WhatsNew in Security and User Administration..
An Overview of SQLServer Security.
Authentication Methods..
Managing Principals.
Managing Securable s..
Managing Permissions.
Managing SQLServer Logins..
Managing SQLServer Users..
Managing Database Roles.i..
Managing SQLServer Permissions.
The Execution Context..
Summary.
What's New in Data Encryption..
An Overview of Data Security..
An Overview of Data Encryption.
SQLServer Key Management.
Column-Level Encryption.
13 Security and Compliance
Windows Authentication Mode..
Mixed Authentication Mode..
Setting the Authentication Mode..
Logins..
SQLServer Security:Users.
User/Schema Separation..
Roles..
Using SSMS to Manage Logins.
Using T-SQL to Manage Logins..
Using SSMS to Manage Users.
Using T-SQL to Manage Users..
Using SSMS to Manage Database Roles n.
Using T-5QL to Manage Database Roles..
Using 5SMS to Manage Permissions.
Using T-5QL to Manage Permissions.
Explicit Context Switching.
Implicit Context Switching..
Extensible Key Management..
Encrypting Columns Using a Passphrase..
Ener yp ting Columns Using a Certificate.
Transparent Data Encryption..
What's New in Database Backup and Restore.
Developing a Backup and Restore Plan.
Types of Backups.
Recovery Models.
Backup Devices.
Implementing Transparent Data Encryption..
Managing TDE in SSMS.
Backing Up TDE Certificates and Keys.
Limitation sofT DE..
Full Database Backups..
Differential Database Backups..
Partial Backups.o ou
Differential Partial Backups..
File and File group Backups.
Copy-Only Backups..
Transaction Log Backups.
Full Recovery.
Bulk-Logged Recovery..
Simple Recovery..
Disk Devices.
Tape Devices.
Network Shares..
Media Sets and Families.
Creating Backup Devices..
Column-Level Encryption Versus Transparent Data Encryption.
Summary..
Exposure and Risk.
Across the LifeCycle.
The Security Big Picture.
Identity Access Management Components.
Compliance and SQLServer..
SQLServer Auditing..
Setting Up Auditing vi aT-SQL..
SQL Injection Is Easy to Do..
Summary..
Full Database Backups Only.
Full Database Backups with Transaction Log Backups.
Differential Backups..
Partial Backups..
File/File group Backups..
Mirrored Backups..
Copy-Only Backups.
Compressed Backups..
System Database Backups..
Restores with T-SQL..
Restoring by Using SSMS.
Restore Information..
Restoring to a Different Database.
Restoring a Snapshot..ao..
Restoring a Transaction Log..
Restoring to the Point of Failure..
Restoring to a Point in Time..
Online Restores..
Restoring the System Databases.
Frequency of Backups.
Using a Standby Server us oo..
Snapshot Backup so in ii ssi
Considerations for Very Large Databases.
Maintenance Plan 5..
Creating Mail Profiles and Accounts.
Using T-SQL to Update and Delete Mail Objects.
Sending and Receiving with Database Mail..
Using SQLServer Agent Mail
Related Views and Procedures..
Summar..
What's New in Scheduling and Notification..
Configuring the SQLServer Agent..
Viewing the SQLServer Agent ErrorLog..
SQLServer Agent Security.
Managing Operators.
Managing Jobs..
Managing Alerts.
Scripting Jobs and Alerts.
Multiserver Job Management.
Event Forwarding.
Setting System-wide Mail Settings..
Testing Your Setup..
The Service Broker Architecture.
Sending Em all..
Receiving Email.
Job Mail Notifications..
Alert Mail Notifications..
Viewing the Mail Configuration Objects.
Viewing Mail Message Data..
Configuring SQLServer Agent Properties.
Configuring the SQLServer Agent Startup Account.
Configuring Email Notification.
SQLServer Agent Proxy Account.
Defining Job Properties.
Defining Job Steps..
Defining Multiple Jobs Steps..
Defining Job5chedules..
Defining Job Notifications.
Viewing Job History..
Defining Alert Properties.
Defining A lett Responses.
Creating a Master Server..
Enlisting Target Servers.
Creating Multiserver Jobs..
Summary
What's New with Power Shell..
Overview of Power Shell..
Power Shell Scripting Basics.
Power Shell in SQLServer 2008.
18 SQLServer High Availabl ty
Start Using Power Shell Now.
Common Terminology..
Object-Based Functionality.
5QL Server Management Objects..
WMl..
Installing Power Shell..
Power Shell Console.
Scriptable and Interactive..
Default Security..
Execution Policy..
Profiles.
Built-in Help Features..
A Few Basic Cmd lets..
Creating a Power ShellScript..
Adding Comments.
Variables.o..
Escaping Characters.
Special VariableS_..
Joining Variables and Strings..
Passing Arguments.
Using Param.
Arrays a..
Operators..
Conditional Statements..
Functions.
Looping Statements.
Filtering Cmd lets.
Formatting Cmd lets..
Dealing with CSV Files..
Dealing with Dates and Times..
-What lf/-Confirm Parameters.
Adding Power Shell Support.
Accessing Power Shell..
5QL Server Power Shell..
SQL Provider..
SQL Cmd lets..
SQLServer Agent Support.
Step-By-Step Examples.
Summat y..
What's New in High Availability..
What Is High Availability 7.
The Fundamentals of HA.
General Tasks..
Scheduling Scripts.
Common OS-Related Tasks..
SQLServer-Specific Tasks.
Using the Provider.
Creating a Database Table.
Performing a Database Backup.
Checking Server Settings.
Checking the Database Usage.
Getting Table Properties.
CmdletExample:Invoke-SqlCmd..
CmdletExample:Invoke-PolicyEvaluation.
Joining Columns..
Retrieving an Entry..
Hardware Factors..
Backup Considerations..
OperatingSystem Up gta des..
Vendor Agreements Followed..
Training Kept UptoDate..
Quality Assurance Done Well..n..
Standards/Procedures Followed..
Server Instance Isolation..
Microsoft Cluster Services(MSCS) .
SQL Cluster ng.a..
Data Replication..
Log Shipping.
Database Mirroring..
Combining Failover with Scale-Out Options.
Mic to soft Virtual Server 2005..
Virtual Server 2005 and Disaster Recovery.
Building Solutions with One or More HA Options.
Other HA Techniques That Yield Great Result..
High Availability from the Windows Server Family Side.
Summary.
What's New in Data Replication..
What Is Replication?..
The Publisher, Distributor, and Subse riber Magazine Metaphor..
Replication Scenarios..
Subscriptions.
Replication Agents.
Planning for SQLServer Data Replication..14
5QL Server Replication Types..
Basing the Replication Design on User Requirements..
Setting Up Replication.
5cripting Replication..
Monitoring Replication..
20 Database Mirroring
Publications and Articles.
Filtering Articles.
The Central Publisher Replication Model..
What's New in SQLServer Clustering..
How Microsoft SQLServer Clustering Works..
The Central Publisher with Remote Dist n but or Replication Model . 557
The Publishing Subscriber Replca tion Model..558
The Central Subscriber Replication Model..559
The Multiple Publishers with Multiple
Subscribers Replication Model..559
The Updating Subscribers Replication Model.560
The Peer-to-Peer Replication Model..561
Anonymous Subscriptions(Pull Subscriptions) ..563
The Distribution Database.564
The Snapshot Agent.566
The Log Reader Agent..569
The Distribution Agent.569
The Merge Agent..570
Other Specialized Agents..571
Autonomy, Timing, and Latency of Data.572
Methods of Data Distribution.573
Snapshot Replication.574
Transactional Replication.574
Merge Replication.575
Data Chat acteristics..578
Creating a Distributor and Enabling Publishing..580
Creating a Publication.584
Horizontal and Vertical Filtering.592
Creating Subscriptions.594
Replication Monitoring SQL Statements..
Monitoring Replication within SQLServer Management Studio .. 606
Summar..
What's New in Database Mirroring..
What Is Database Mirroring?..
Roles of the Database Mirroring Configuration..
Setting Up and Configuring Database Mirroring..
Te sing Failover from the Principal to the Mirror.
Client Setup and Configuration for Database Mirroring..
Migrate to Database Mirroring 2008asFastas You Can..
Using Replication and Database Mirroring Together.
Using Database Snapshots from a Mirror for Reporting..
Summary..
New and Improved Peer-to-Peer Replication.
The Performance Monitor.
Replication in Heterogeneous Environments.
Backup and Recovery in a Replication Configuration..
Some Thoughts on Performance..
Log Shipping..
Data Replication and Database Mirroring for
Fault Tolerance and High Availab iht y.
Copy-on-Write Technology..
When to Use Database Mirroring..
Playing Roles and Switching Roles.
Database Mirroring Operating Modes.
Getting Ready to Mirror a Database.
Creating the Endpoints..
Granting Permissions..
Creating the Databas con the Mirror Server.
Identifying the Other Endpoints for Database Mirroring .. 632
Configuring Database Mirroring by Using the Wizard.633
Monitoring aM it ro red Database Environment.mai an..639
Removing Mirro nng..643
Understanding MSCS.658
Extending MSCS with NLB..662
How MSCS Sets the Stage for SQLServer Clustering.663
Installing SQLServer Clustering.
Summary.
Introduction to Policy-Based Management..
Policy-Based Management Concepts..
Implementing Policy-Based Management.
Configuring SQLServer Database Disks.
Installing Network l nterface s.
Installing MSCS..
Installing SQLServer.
Failure of aNode.
The Connection Test Program for a SQLServer Cluster .. 681
Potential Problems to Watch Out for with SQLServer Clustering . 684
Facets amo
Conditions.a..a..693
Policies au..
Categories u.n.
Targets.
Execution Modes.694
Central Management Servers..
Creating a Condition Based on a Facet..
Creating a Policy.
Creating a Category..
Evaluating Policies..
Importing and Exporting Policies.
Sample Policy TemplateslElia
Evaluating Recovery Models.
Implementing Surface Area Configuration Checks..
5QL Server Health Checks.m.
Ensuring Object Naming Conventions.
Checking BestPractices Compliance..
Database Files..
Creating Databases..
Setting Database Options..
Managing Databases..
What's New in SQLServer 2008..
Creating Tables.
Defining Col urn ns..
Defining Table Location.
Defining Table Constraints..
Modifying Tables.nntr
Dropping Tables.
Using Partitioned Table.
22 Administering Policy-Based Management
Part IV Database Administration
23 Creating and Managing Databases
Sample Templates and Real-World Examples.
Policy-Based Management BestPractices.
Summary.
What'New in Creating and Managing Databases..
Data Storage in SQLServer..
Summary..
Jta tant..742
tmi.747
Primary Files..
Secondary Files..
Using File groups.
Using Partitions.
Transaction LogFiles.
Using SSMS to Create a Database..
Using T-SQL to Create Databases..
The Database Options..
Using T-SQL to Set Database Options..
Retrieving Option Information.
Managing File Growth.
Expanding Databases..
Shrinking Databases.
Moving Databases..
Restoring a Database Backup to a New Location.
Using ALTER DATABASE.
Detaching and Attaching Databases.
Using Object Explorer to Create Tables iono.
Using Database Diagrams to Create Tables..
Using T-SQL to Create Tables..
DataTypes.a..
Column Properties..
Using T-SQL to Modify Tables.
Using Object Explorer and the Table Designer to Modify Tables .. 769
Using Database Diagrams to Modify Tables..772
.Creating a Partition Function..776
Creating a Partition Scheme.778
Creating a Partitioned Table.779