Following is an overview of the new features provided in SQL Server 2008: columns and column sets, row-level and page-level data compression types; Hierarchyid data type; spatial data ty
Trang 1Running SQL Server 2008 inside a virtual operating environment requires at least one
license per virtual operating environment Within each virtual operating environment, the
license allows you to run one or more instances of SQL Server 2008 The license for a
virtual operating environment can be a server/CAL license or a processor-based license If
using a processor-based license, you must purchase a processor license for each processor
that the virtual machine accesses The total number of physical and virtual processors
used by the virtual operating system environments cannot exceed the number of software
licenses assigned to that server However, if you are running Enterprise Edition and all
physical processors in the machine have been licensed, you may run an unlimited number
of virtual operating environments on that same machine
Multiple Instances of SQL Server
An option to virtualization is multi-instancing With multi-instancing, multiple copies of
SQL Server can be run concurrently in a single instance of an OS Multi-instancing for SQL
Server 2008 can take place both in a virtual environment or in a physical environment
Although multi-instancing offers a relatively high degree of isolation between copies of
SQL Server 2008, this isolation takes place at the application level (instead of at the OS
level)
In SQL Server 2008, the Workgroup and Standard Editions now allow you to run any
number of instances of the server software in one physical or virtual operating system
envi-ronment on the licensed server Previously, only the Enterprise Edition of the server license
allowed multi-instancing
Summary
This chapter examined the various platforms that support SQL Server 2008 R2 and
reviewed and compared the various editions of SQL Server 2008 that are available Which
platform and edition are appropriate to your needs depends on scalability, availability,
performance, licensing costs, and limitations The information provided in this chapter
should help you make the appropriate choice
Chapter 2, “What’s New in SQL Server 2008,” takes at closer look at the new features and
capabilities provided with the various SQL Server 2008 editions
CHAPTER 1 SQL Server 2008 Overview
Trang 2What’s New in SQL
Server 2008
New SQL Server 2008 Features SQL Server 2008
Enhancements
SQL Server 2005 provided a number of significant new
features and enhancements over what was available in SQL
Server 2000 This is not too surprising considering there was
a five-year gap between these major releases Microsoft SQL
Server 2008 is not as much of a quantum leap forward from
SQL Server 2005, but it provides a number of new features
and enhancements to further extend the performance,
relia-bility, availarelia-bility, programmarelia-bility, and ease of use of SQL
Server This chapter explores the new features provided in
SQL Server 2008 and SQL Server 2008 R2, as well as many
of the enhancements to previously available features
New SQL Server 2008 Features
So what does SQL Server 2008 have to offer over SQL Server
2005? Following is an overview of the new features
provided in SQL Server 2008:
columns and column sets, row-level and page-level
data compression
types; Hierarchyid data type; spatial data types;
user-defined table type
operators, GROUPING SETS, MERGE statement, row
constructors, table-valued parameters, INSERT over
DML, new date and time functions
statistics, FORCESEEK query hint, hash values for
Trang 3CHAPTER 2 What’s New in SQL Server 2008
finding similar queries in the plan cache, Plan Guide Successful and Plan Guide
Unsuccessful event classes, Guided/Misguided Plan Executions/sec Performance
Monitor counters, LOCK ESCALATION option for ALTER TABLE, hot-add CPUs
SQL Server Audit
Capture, Change Tracking, the Data Collector, Policy-Based Management, SQL Server
Extended Events, Resource Governor
error list window, multiserver queries, PowerShell integration
SQL Server 2008 R2 further enhances SQL Server 2008 with the following new features:
Two new premium editions to meet the needs of large-scale datacenters and data
warehouses:
SQL Server 2008 R2 Datacenter
SQL Server 2008 R2 Parallel Data Warehouse
SQL Server Utility for Multi-Server Management
PowerPivot for Excel and SharePoint
A number of new Reporting Services features including Report Builder 3.0, report
parts, shared datasets, Sparklines and data bars, indicators, calculating aggregates of
aggregates, maps, lookup functions
The following sections take a closer look at each of these new features and, where
appro-priate, provide references to subsequent chapters where you can find more information
and detail about the new features
New Storage Features
SQL Server 2008 provides a set of new features to reduce storage requirements and
improve performance
One of the new features is FILESTREAM storage FILESTREAM storage is a property that can
be applied to varchar(max) columns; it enables SQL Server applications to store
unstruc-tured data, such as documents and images, directly in the NTFS file system while still
maintaining the behavior of a database column The advantages of FILESTREAM storage
are improved performance and increased size of BLOB data, expanding from the 2GB limit
of image columns to the available space in the file system For more information on using
FILESTREAM storage, see Chapter 42, “What’s New for Transact-SQL in SQL Server 2008.”
Other storage features introduced in SQL Server 2008 are sparse columns and column sets
Sparse columns are ordinary columns that have an optimized storage format for null values
If you use sparse columns, you can also define a column set on the table that will return
all sparse columns in the table A column set is an untyped XML representation that
combines all the sparse columns of a table into a structured output For more information
Trang 4on defining sparse columns and column sets, see Chapter 24, “Creating and Managing
Tables.”
Row-level and page-level data compression also are introduced in SQL Server 2008 Data
compression helps to reduce both storage and memory requirements as the data is
compressed both on disk and when brought into the SQL Server data cache Row-level
compression isn’t true data compression but implements a more efficient storage format
for fixed-length data Page-level compression is true data compression, using both column
prefix and dictionary-based compression For more information on implementing data
compression, see Chapter 24
New Data Types
SQL Server 2008 introduces a handful of new data types Two of the most welcome of
these are the new DATE and TIME data types These new data types allow you to store
date-only and time-date-only values In addition, SQL Server now supports the DATETIME2 and
DATETIMEOFFSET data types DATETIME2 is a variation of the DATETIME data type that
supports datetime values from 0001-01-01 to 9999-12-31 23:59:59.999999
DATETIMEOFFSET supports UTC-based datetime values that are time zone aware
The new Hierarchyid data type is a common language runtime (CLR) user-defined type
(UDT) that provides a mechanism for representing and storing a tree structure in a table in
an efficient manner This data type is useful for storing data that represents a parent child,
tree-like structure such as an organizational structure or a graph of links between web
pages
Spatial data types are introduced in SQL Server 2008 as well There are two new spatial
data types: geometry and geography The geometry data type supports planar, or Euclidean
(flat-earth), data The geography data type stores ellipsoidal (round-earth) data, such as
GPS latitude and longitude coordinates These new data types support the storage and
manipulation of spatial data objects such as linestrings, points, and polygons
SQL Server 2008 also introduces a new user-defined table type that can be used as
parame-ters in stored procedures and functions, as well as for defining table variables in a batch or
the body of a stored procedure or function
For more information and examples on using the new SQL Server 2008 data types, see
Chapter 42
New Transact-SQL Constructs
What would a new SQL Server release be without new T-SQL commands and constructs to
further expand the power and capabilities of the T-SQL language? SQL Server 2008 is no
exception (although SQL Server 2008 R2 is an exception because no new T-SQL constructs
are introduced in R2) The new constructs provided in SQL Server 2008 include
performing an operation and assigning a value to a local variable (for example,
+=, *=)
Trang 5CHAPTER 2 What’s New in SQL Server 2008
grouping operations in a single query
operations on a target table based on the results of a join with a source table
inserts within a single INSERT statement Also provides the ability to use the VALUES
clause to create a pseudo table of values in a subquery or common table expression
user-defined table types Table-valued parameters enable you to pass a table variable
con-taining multiple rows of data to a stored procedure or function without the need to
create a temporary table
To coincide with the new DATE and TIME data types, SQL Server 2008 also introduces a
few new date and time functions:
DATETIMEOFFSET(7) value
representing the current UTC time
value from the stored time zone offset to the specified time zone
for the specified time zone to a DATETIMEOFFSET UTC value
For more information and examples on using the new SQL Server 2008 T-SQL constructs,
see Chapter 42
New Performance Features
SQL Server 2008 also introduces some new features and enhancements for monitoring,
managing, and improving query performance Among these new features are filtered
indexes and statistics A filtered index is a nonclustered index defined on a subset of data
using a filter predicate to index only a portion of rows in the table Filtered statistics are
statistics defined on a subset of data in the table using a filter predicate A well-designed
filtered index can improve query performance, reduce index maintenance costs, and
reduce index storage costs compared with full-table indexes, especially when columns
contain a large number of rows with null or a single value that isn’t searched on but can
skew the index and statistics For more information on creating and using filtered indexes
and statistics, see Chapter 34, “Data Structures, Indexes, and Performance.”
SQL Server 2008 provides FORCESEEK as a new table and query hint for controlling how
SQL Server optimizes a query; it forces the optimizer to use only an index seek operation
to access the data in the referenced table or view For more information on using the
FORCESEEK hint, see Chapter 35, “Understanding Query Optimization.”
Trang 6Plan guides were a feature introduced in SQL Server 2005 Plan guides can be used to
opti-mize the performance of queries when you cannot or do not want to change the text of
the query directly (for example, when queries in a third-party database application are not
performing as expected) SQL Server 2008 provides additional features related to plan
guides to make implementing and managing them easier Among these features are new
event classes (Plan Guide Successful and Plan Guide Unsuccessful) that can be monitored
via SQL Server Profiler to determine when plan guides are being applied There are also
two new Performance Monitor counters (Guided/Misguided Plan Executions/sec) that you
can use to monitor via Performance Monitor how often plan guides are being used or not
being used
SQL Server 2008 also now generates hash values for query plans in the plan cache The
sys.dm_exec_query_stats and sys.dm_exec_requests dynamic management views
(DMVs) now provide query hash and query plan hash values that you can use to help find
similar queries in the plan cache Locating similar queries can help you determine the
aggregate resource usage for similar queries and similar query execution plans so that you
can better focus your query tuning efforts and help identify which queries may get the
most benefit from using plan guides For more information on query plans and using plan
guides, see Chapter 35
To provide greater control of locking, SQL Server 2008 offers the new LOCK ESCALATION
table option This option specifies the allowed methods of lock escalation for a table The
default is AUTO, which allows the Database Engine to select the appropriate lock escalation
level for the query if a table is partitioned You can also specify TABLE to force full
table-level locking whether or not a table is partitioned A third option, DISABLE, prevents
esca-lation to a table-level lock in most cases For more details on locking and the LOCK
ESCALATION option, see Chapter 37, “Locking and Performance.”
One additional new feature in SQL Server 2008 Enterprise Edition is hot-add CPU Hot-add
CPU is the capability to dynamically add CPUs to a running system Additional CPUs can
be made available logically by online hardware partitioning, virtually through a
virtualiza-tion layer, or even physically by adding new hardware on systems that support adding
physical CPUs while the system is online Hot-add CPU, which requires hardware support,
is available only when you’re running Windows Server 2008 Datacenter or Enterprise
Edition
New Security Features
SQL Server 2005 provided the capability to encrypt data at the column level However,
this encryption was not transparent to the end users or applications Encrypting and
decrypting the data required coding changes to use the built-in encryption and decryption
functions SQL Server 2008 introduces transparent data encryption (TDE), which allows
for encrypting the entire database without affecting client applications The purpose of
TDE is to protect sensitive data in the event a database file or backup is stolen Encryption
is done in real-time at the page level as the data is written to disk and decrypted as the
data is read from disk The encryption is based on a database encryption key (DEK), which
is a symmetric key secured by using a certificate stored in the master database of the
server or an asymmetric key protected by an Extensible Key Management (EKM) module
Trang 7CHAPTER 2 What’s New in SQL Server 2008
Extensible Key Management, which is also new with SQL Server 2008, enables you to store
the keys used to encrypt data separately from the data it protects SQL Server 2008 EKM
enables the encryption keys that protect the database files to be stored in a removable
device such as a smartcard, USB device, or a software-based Extensible Key Management
(EKM)/Hardware Security Module (HSM) module EKM facilitates separation of duties by
taking key management out of the hands of the database administrators
For more information on implementing and using transparent data encryption and
exten-sible key management, see Chapter 12, “Data Encryption.”
SQL Server already provides a number of existing audit methods (SQL Trace, C2 audit
mode, DDL triggers) In addition to these, SQL Server 2008 adds an additional audit
method: SQL Server Audit SQL Server Audit, based on the new Extended Events feature,
allows you to monitor server- or database-level events or groups of events You can set up
and monitor audit events at the server or database level and audit the audit actions
them-selves For more information on SQL Server Audit, see Chapter 13, “Security and
Compliance.”
New Database Administration Features
SQL Server 2008 introduced backup compression for Enterprise Edition With SQL Server
2008 R2, backup compression is supported in Standard and all higher editions (every
edition of SQL Server 2008 and later can restore a compressed backup, however) In
addi-tion to the space savings provided by compressed backups, compressing a backup also
typically increases backup speed because it requires less device I/O However, the I/O cost
savings comes at the expense of increased CPU usage caused by the compression process
For more information on compressing backups, see Chapter 14, “Database Backup and
Restore.”
Policy-Based Management is a new mechanism in SQL Server 2008 for managing one or
more instances of SQL Server 2008 SQL Server Policy-Based Management can help to
simplify management operations such as setting database options across multiple servers,
checking SQL Server configurations, or enforcing naming conventions, helping to reduce
the total cost of ownership (TCO) of administering multiple SQL Server instances SQL
Server Management Studio (SSMS) can be used to define and implement policies for
managing SQL Server instances, databases, or other SQL Server objects as well as
on-demand checking and enforcement of policies Checking and enforcement of these
poli-cies can also be scheduled using SQL Server Agent For more information on Policy-Based
Management in SQL Server, see Chapter 22, “Administering Policy Based Management.”
Currently, several options are available for troubleshooting or getting information about
SQL Server–generated events: SQL Server Profiler, SQL Server Log, dynamic management
views and functions, SQL Trace, trace flags, Windows Application and System logs,
perfor-mance counters, and so on SQL Server 2008 introduces a new event infrastructure,
Extended Events Extended Events is a general-purpose event-handling system for server
systems Currently, the Extended Events infrastructure supports the correlation of data
from SQL Server and, under certain conditions, the correlation of data from the operating
system and database applications Extended Events has the potential to make other
Trang 8bleshooting options obsolete in future releases and become the common denominator for
troubleshooting purposes As mentioned previously, the new SQL Server Audit feature is
based on Extended Events For more information on configuring and using Extended
Events for monitoring SQL Server 2008, see Chapter 39, “Monitoring SQL Server
Performance.”
Resource Governor, another new technology in SQL Server 2008, enables you to manage
and control the allocation of resources for SQL Server according to workload Similarly
sized queries or requests that can, and should be, treated the same are assigned to a
work-load group as the requests are received Each workwork-load group is associated to a pool of
resources that represents the physical resources for SQL Server (currently, for SQL Server
2008, these resources are CPU and memory) Limits are specified on resource consumption
for these incoming requests In an environment where multiple distinct workloads are
present on the same server, Resource Governor enables you to differentiate these
work-loads and allocate shared resources as they are requested, based on the limits you specify
For more information on implementing and configuring Resource Governor, see Chapter
40, “Managing Workloads with the Resource Governor.”
Change Data Capture (CDC) and Change Tracking are new features in SQL Server 2008
with similar names but different purposes CDC is an asynchronous mechanism that
captures all changes of a data row from the transaction log and stores them in change
tables The information captured is available in relational format and can be accessed by
client applications such as extract, transform, and load (ETL) processes All intermediate
values of a row are stored Using Change Data Capture, you can avoid using expensive
techniques such as triggers, time stamp columns, and join queries to identify and capture
the changes made to data
Change Tracking, on the other hand, is a lightweight synchronous mechanism that tracks
data modifications but records only the fact that a row has changed Applications can use
Change Tracking to identify which rows have changed for a user table and refresh their
data stores with the latest values from these rows by requerying the table
For more information on using CDC and Change Tracking, see Chapter 42
New SQL Server Management Studio Features
SQL Server Management Studio (SSMS) was first introduced in SQL Server 2005 SSMS is a
full-featured, robust SQL Server administration and development tool However, there was
clearly room for improvement, and SQL Server 2008 provides some long-awaited
enhance-ments
One of the most anticipated (and missed) features in SSMS was a built-in T-SQL debugger
Prior to SQL Server 2005, SQL Server Enterprise Manager had a built-in T-SQL Debugger A
lot of users were disappointed a T-SQL debugger was not included with this version of
SSMS To debug T-SQL, you needed to install Visual Studio (VS) Fortunately, a built-in
debugger returns to SSMS in SQL Server 2008
Another long-awaited feature for SSMS is IntelliSense IntelliSense is a useful feature in the
Query Editor for looking up language elements and object names without having to leave
Trang 9CHAPTER 2 What’s New in SQL Server 2008
the editor IntelliSense can even automatically complete and insert language elements
directly into your code
In conjunction with IntelliSense, SSMS also provides the error list window The error list
window displays all errors and warnings produced by IntelliSense as you develop your code
in the Database Engine Query Editor You can double-click the error message entry to
jump to the error location As you fix errors, they are automatically removed from the
error list window
One other new capability built in to SSMS in SQL Server 2008 is multiserver queries This
feature allows you to execute T-SQL statements against multiple servers defined in a server
group at the same time If you open a Query Editor from the server group in the
Registered Servers window, the T-SQL statements in the current Query Editor are executed
against all the servers in the group The results from the query can be merged into a single
results pane or can be returned in separate results panes for each server
For more details on these new features in SSMS, see Chapter 4, “SQL Server Management
Studio.”
PowerShell Integration
SQL Server 2008 provides integrated support for Windows PowerShell, a powerful scripting
shell that enables administrators and developers to automate server administration and
application deployment The Windows PowerShell language supports more complex logic
than Transact-SQL scripts, enabling SQL Server administrators to build more robust and
complex administration scripts
SQL Server provides two snap-ins to Windows PowerShell for creating scripts to manage
SQL Server:
A SQL Server provider, which enables a simple navigation mechanism similar to file
system paths where the drive is associated with a SQL Server management object
model and the nodes are based on the object model classes This allows you to use
familiar commands such as cd and dir to navigate the paths similar to the way you
navigate folders in a command prompt window
A set of cmdlets, which are commands used in Windows PowerShell scripts to
speci-fy a SQL Server action, such as running a SQLCMD script containing Transact-SQL or
XQuery statements
For more information on managing SQL Server using PowerShell, see Chapter 17,
“Administering SQL Server 2008 with PowerShell.”
New Premium SQL Server Editions
SQL Server 2008 R2 introduces two new premium-level editions of SQL Server: Datacenter
Edition and Parallel Data Warehouse
Built on SQL Server 2008 R2 Enterprise, SQL Server 2008 R2 Datacenter is designed to
deliver a high-performing data platform that provides the highest levels of scalability for
large application workloads, virtualization and consolidation, and management for an
Trang 10organization’s database infrastructure Datacenter helps enable organizations to
cost-effec-tively scale their mission-critical environment Key features of Datacenter include
Application and multiserver management for enrolling, gaining insights, and
managing more than 25 instances
Highest virtualization support for maximum return on investment (ROI) on
consoli-dation and virtualization
High-scale complex event processing with SQL Server StreamInsight
Support for more than 8 processors and up to 256 logical processors
SQL Server 2008 R2 Parallel Data Warehouse is a highly scalable data warehouse
appliance-based solution Parallel Data Warehouse delivers performance at low cost through a
massively parallel processing (MPP) architecture and compatibility with hardware partners,
allowing you to scale your data warehouse to tens and even hundreds of terabytes Key
features provided by Parallel Data Warehouse include
Advanced data warehousing capabilities such as Star Join Queries and Change Data
Capture
Integration with SSIS, SSRS, and SSAS
Support for industry-standard data warehousing hub-and-spoke architecture and
par-allel database copy
SQL Server Utility for Multiserver Management
SQL Server 2008 R2 features new SSMS dashboards for observing information on more
than one server from the same screen by utilizing the new SQL Server Utility The SQL
Server Utility models an organization’s SQL Server–related entities in a unified view Utility
Explorer and SQL Server Utility viewpoints in SQL Server Management Studio provide
administrators a holistic view of SQL Server resource health Entities that can be viewed in
the SQL Server Utility include
Instances of SQL Server
Data-tier applications
Database files
Volumes
SQL Server Utility is covered in more detail in Chapters 4 and 39
PowerPivot for Excel and SharePoint
PowerPivot is a new tool that integrates SQL Server with Microsoft Excel and SharePoint to
create a self-service business intelligence (BI) solution for the enterprise PowerPivot for
Excel and SharePoint are client and server components that integrate Analysis Services
with Excel and SharePoint PowerPivot for Excel is an add-in that allows you to create
PowerPivot workbooks that can assemble and relate large amounts of data from different