Download SQL Server 2005 Management Tools Overview

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Entity–attribute–value model wikipedia , lookup

Database wikipedia , lookup

Oracle Database wikipedia , lookup

Tandem Computers wikipedia , lookup

Microsoft Access wikipedia , lookup

Database model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

Btrieve wikipedia , lookup

Relational model wikipedia , lookup

Team Foundation Server wikipedia , lookup

Open Database Connectivity wikipedia , lookup

SQL wikipedia , lookup

PL/SQL wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Transcript
SQL Server 2005 Management Tools
Overview
Writer: Kimberly L. Tripp, SQLskills.com
Published: March 2007
Applies To: SQL Server 2005
Summary: SQL Server 2005 introduces a new toolset with a myriad of new features.
The toolset builds on the strong usability of previous releases and adds many new
features and long-awaited updates. The general theme across the toolset is integration,
with consistency across tools designed to improve your productivity with SQL Server.
The new tools fix some of the most commonly requested issues with the old interfaces
and add rich functionality to extend command-line automation. SQL Server Enterprise
Manager and Query Analyzer are combined to create a single unified tool that can be
integrated with your choice of source control, creating a more flexible and manageable
solution for the system administrator and the DBA. This white paper tells you how to
select the best tool for the job and gives you best practices to make your use of the
tools more productive from the start.
Copyright
This is a preliminary document and may be changed substantially prior to final commercial release of the software
described herein.
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed
as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted
to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented
after the date of publication.
This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR
STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright,
no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form
or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express
written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering
subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the
furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual
property.
Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places,
and events depicted in examples herein are fictitious. No association with any real company, organization, product,
domain name, e-mail address, logo, person, place, or event is intended or should be inferred.
 2007 Microsoft Corporation. All rights reserved.
Microsoft, Visual Basic Scripting, Visual C#, Visual C++, Visual Studio, and Windows are either registered trademarks or
trademarks of Microsoft Corporation in the United States and/or other countries.
All other trademarks are property of their respective owners.
Table of Contents
Introduction ......................................................................................................6
The Business Case for New Tools ......................................................................7
Enterprise-Class Capabilities .............................................................................7
SQL Server Surface Area Configuration .............................................................. 7
SQL Server Configuration Manager .................................................................... 8
SQL Server Management Studio ........................................................................ 8
Insightful Management .....................................................................................9
SQL Server Agent.......................................................................................... 10
SQL Server Management Studio Reports .......................................................... 10
SQL Server Profiler ........................................................................................ 11
Database Engine Tuning Advisor ..................................................................... 12
SQL Server Best Practice Analyzer ................................................................... 12
SQL Server Upgrade Advisor........................................................................... 12
SQL Server MOM Pack ................................................................................... 13
Easy to Use .....................................................................................................14
Database Maintenance Plans........................................................................... 14
Script Generation .......................................................................................... 14
Copy Database Wizard ................................................................................... 15
Database Mail ............................................................................................... 16
SQLCMD ...................................................................................................... 16
SQL Server Management Objects .................................................................... 17
Additional Highlights of the Management Tools ..............................................18
SQL Server Configuration Manager .................................................................. 18
SQL Server Configuration Manager Features at a Glance ............................... 18
Using Configuration Manager ..................................................................... 19
SQL Server Surface Area Configuration ............................................................ 20
Surface Area Configuration Features at a Glance .......................................... 20
Using the Surface Area Configuration Tool ................................................... 21
SQL Server Management Studio ...................................................................... 25
SQL Server Management Studio Features at a Glance ................................... 25
Using SQL Server Management Studio ........................................................ 27
SQL Server Profiler ........................................................................................ 32
SQL Server Profiler Features at a Glance ..................................................... 32
Using SQL Server Profiler .......................................................................... 34
Database Engine Tuning Advisor ..................................................................... 37
Database Engine Tuning Advisor Features at a Glance .................................. 38
Using Database Engine Tuning Advisor ....................................................... 38
SQLCMD ...................................................................................................... 40
SQLCMD Features at a Glance.................................................................... 40
Using SQLCMD ......................................................................................... 40
Dedicated Administrator Connection ................................................................ 40
Backward Compatibility ..................................................................................41
Conclusion.......................................................................................................42
Additional SQL Server 2005 Resources ...........................................................43
Introduction
Microsoft® SQL Server™ 2005 introduces a brand new toolset with a myriad of new
features. The toolset builds on the strong usability of previous releases and adds many
new features and long-awaited updates. The general theme across the toolset is
integration. Consistency across SQL Server tools improves your productivity. While
staying true to the best characteristics of the older tools, the new tools fix some of the
most commonly requested issues with the old interfaces (such as SQL Server Profiler)
and add rich functionality to extend command-line automation (SQLCMD). SQL Server
Enterprise Manager and Query Analyzer are now combined to create a single unified
tool that can be integrated with your choice of source control, creating a more flexible
and manageable solution for the system administrator and the database administrator
(DBA). After reading this white paper, you will be able to select the best tool for the
job. The paper also provides you with best practices that will make your use of the tools
more productive from the start.
The Business Case for New Tools
Tools play a crucial role in enterprise database management; well-integrated tools extend
the administrator’s capabilities, whereas a random set of tools can lead to confusion,
mistakes, high training costs, and poor DBA productivity.
As IT infrastructures become increasingly interconnected and public-facing, the failure of an
integrated component can have cascading impacts on both the internal and external
customer experience. High-availability techniques can handle some failures, but not all
failure is catastrophic. Some failures consist of:

Release management issues - deploying the wrong version of the system to production

Scalability issues - deploying code that doesn’t meet the scalability requirements of the
system

Operational mistakes - hurried operators who take the wrong action
The new management tools play a vital part in automation to provide reusable code that
reduces operational mistakes. These tools integrate the administrator into the systems
development process to ensure that code, scripts, and data provided by the administrator
can be synchronized with application releases. They help provide insight that leads to rapid
problem diagnosis and quick resolution of complex performance and configuration issues.
The SQL Server 2005 toolset is more capable of meeting the new demands of complex
infrastructures that must do more with fewer resources. This white paper explores the
capabilities of the new toolset and helps you make a business case for their introduction.
Enterprise-Class Capabilities
SQL Server 2005 arrives with a set of integrated tools that deliver enterprise-class
capabilities with a designed look and feel that is consistent across tools and APIs. Microsoft
understands how to condense complexity into a usable UI—complex objects are visualized
together with a manageable set of operations that are factored intuitively and consistently.
Long-running operations such as backup and restore can take place in parallel, across
multiple servers, allowing the administrator to take care of other priorities. And, with an
object model that demand-loads and filters metadata, the API is responsive when run
against even the largest schema.
SQL Server Surface Area Configuration
Security is a priority for all customers, especially those in an enterprise. The SQL Server
Surface Area Configuration tool enables you to control the options that could potentially lead
to vulnerabilities in your SQL Server services. This new tool empowers the DBA to control
which features are enabled; this is a change in philosophy, which ensures that potentially
unused features are not enabled until the administrator is ready to configure and deploy the
new functionality. In SQL Server 2005, the exposed area of the server has been significantly
reduced by new security features, by changes to default settings, and by a new general
practice called “off by default.” By default, many new features and some old features are
turned off and disallowed until explicitly enabled by the DBA. For simplicity, this single,
central, and straightforward tool brings together many of the options that are used to
secure the server.
SQL Server Configuration Manager
SQL Server Configuration Manager enables you to manage your general server settings such
as service startup, service account settings, service account passwords, and network
libraries. See Figure 1 for a view of the SQL Server 2005 Services display. This shows all
installed components, what’s running (with their ProcessID), the service type and the
service startup account (Log On As). Service changes can be reliably set through this single,
central tool, which allows DBAs to configure and view service settings, protocol settings, and
aliases.
Figure 1
SQL Server Configuration Manager
In past releases, multiple tools had to be used to configure service settings. Each of these
tools had limitations regarding who could view the settings, where the settings could be
changed or viewed, and whether the server must be running in order to change them.
These settings are now combined into a single tool—one which does not require that you
first connect to your server—so that many dependencies on having a running server service
have been removed. You can change service accounts and passwords even when the service
is not running.
SQL Server Management Studio
SQL Server Management Studio (SSMS) combines functionality that was previously in the
Enterprise Manager and Query Analyzer tools. SSMS provides a unified database
administration and database development environment based on Microsoft Visual Studio®
shell technologies. There are many new and exciting areas of change, including graphical
reports. See Figure 2 for a graphical report of server activity in the Server Dashboard.
Figure 2
Server Dashboard
While there are many new developer-centric features—such as solutions, projects, and
integration with applications that implement the Microsoft Windows® source control API—
you could spend your entire administration or development time in the Enterprise Managerlike Object Explorer and Query Analyzer-like query windows, and not even notice this new
integration. However, if you want to simplify the environment, learning the new features
helps you to become more productive at managing large environments because you can
learn to create groups of scripts in projects and related projects in solutions.
Insightful Management
SQL Server 2005, built on a deep understanding of database operations, has tools that
deliver a variety of features and enable fast and deep analysis of real-time activity in the
SQL Server database engine. This toolset opens up the engine to give you insights into the
performance and health of your server.
SQL Server 2005 delivers 21st century database systems management with:

Over 35 out-of-the-box dynamic management view reports that monitor server and
database health.

An advanced heuristic-based index and partition analysis tool.

SQL Server Profiler deadlocking traces and Perfmon integration for deep insights into
real-time performance.

Integration with the Microsoft Operations Management (MOM) systems management
product via a tailored MOM Pack.

Full WMI integration.
SQL Server Agent
SQL Server Agent has been part of the SQL Server management tools since their early
inception. Previously, it was hosted in the SQL Server 2000 Enterprise Manager; now it is
hosted in SQL Server Management Studio. SQL Server Agent provides job and alert
management features that can be configured to span multiple servers, pushing jobs out for
remote execution and gathering back results to a central point. Tracking history provides
insight into trends that might eventually cause issues in SQL Server. SQL Server 2005
introduces more SQL Server Agent capabilities, including a fresh user interface that makes
managing large logs and job history lists easier than ever before.
Figure 3
SQL Server Agent Log File Viewer
The advanced reports that come as standard with SQL Server Management Studio also
cover the status of the jobs in SQL Server Agent, with reports that cover failing jobs, long
running jobs, and others. See Figure 3 for a view into the job status and history using the
SQL Server Agent Log File Viewer.
SQL Server Management Studio Reports
SQL Server 2005 provides detailed information across all system components. This
information enables you to monitor the state of the server. The information comes from
querying dynamic management views. While the sheer volume of all of this raw data could
be overwhelming to a new administrator, the default reports simplify administration with
easy-to-use and intuitive reports that extract meaning from the detailed information. See
Figure 4 for an example of a graphical report that shows queries that have the highest
average CPU time. These reports cover:

System health

Database health

Logon audit information

SQL Server Agent information
Figure 4
SQL Server Management Studio reports
In addition to the large number of predefined reports (extended considerably in
SQL Server 2005 SP2), custom reports can be created and added to the “custom reports
most recently used” list in SQL Server Management Studio. When a new custom report is
first opened from an Object Explorer node, it is added to the most recently used list under
Custom Reports on the context menu of that node.
SQL Server Profiler
SQL Server Profiler enables you to capture a workload of activity on your server. A workload
contains a list of customizable events and, for each event, a customizable set of data
columns that represent attributes about the events you choose. Reviewing activity in the
form of a workload is only part of the power that SQL Server Profiler offers. You can also
replay workloads, tune workloads, and correlate those workloads with System Monitor
Performance Counter logs to get an accurate view of system load and stress. The updated
SQL Server Profiler maintains a similar look and feel to the former SQL Server 2000 Profiler,
yet makes complex trace event, element, and filtering option selection easier than in
previous versions of the tool, despite the fact that it has even more trace options.
Database Engine Tuning Advisor
SQL Server 2005 includes an update to the Index Tuning Wizard (ITW) in SQL Server 2000,
called Database Engine Tuning Advisor (DTA). While ITW helped to determine the
appropriate indexes to create for a given workload of events, Database Engine Tuning
Advisor goes further with its recommendations. Instead of just recommending indexes, DTA
can also recommend new physical data structures, such as partitioning. And, in addition to
recommending changes to your database that can help performance, DTA offers new and
advanced features such as:

Tuning across multiple databases.

Configuring tuning time.

Creating multiple tuning sessions to compare results.
There is both a graphical version of the tool and a command-line version. The command-line
version allows more advanced and scriptable features, such as tuning against an empty
version of your database so that the largest systems can be analyzed and tuned against a
test server without requiring a copied database or significantly increasing the load on your
production server.
SQL Server Best Practice Analyzer
Microsoft delivers Best Practice Analyzer (BPA) tools that run against all of its server
products. These tools analyze system settings and data profiles against known best
practices to provide you with ongoing insight into potential trouble spots in your application.
The SQL Server 2000 BPA is currently available for download and the SQL Server 2005 BPA
is due early in 2007 and will capture all the early experiences of database deployments.
The tight integration between analyzer and technology means that the version of the BPA
and its associated server product must be an exact match.
The SQL Server 2000 BPA can be downloaded from the Best Practices Analyzer Tool for
Microsoft SQL Server 2000 1.0 page on the Microsoft Download Center.
The SQL Server 2005 BPA February CTP has been released for early use, testing, and
feedback. When it is officially released, it will also be linked to from the
SQL Server 2005 SP2 Feature Pack. For more information, see following Microsoft Web
pages:
SQL Server 2005 Best Practices Analyzer (February 2007 CTP)
Feature Pack for Microsoft SQL Server 2005
SQL Server Upgrade Advisor
While not directly related to SQL Server 2005 SP2, the Upgrade Advisor is another
SQL Server tool that simplifies enterprise management. Upgrading an infrastructure
requires considerable diligence in testing applications and ensuring that dependencies are
understood and managed. The SQL Server Upgrade Advisor provides advanced insight into
potential issues that might arise when upgrading a database server.
The professional database administrator should download and run this tool to identify any
problem areas so that the migration/upgrade can be better planned, increasing the
probability of a stress-free upgrade.
The SQL Server 2005 Upgrade Advisor is available in the Servers\redist\Upgrade Advisor
folder of the SQL Server 2005 product disk and from the Microsoft SQL Server 2005
Upgrade Advisor page on the Microsoft Download Center.
SQL Server MOM Pack
Customers who use services that are delivered across multiple infrastructure components
can use the Microsoft Operations Manager (MOM) application to monitor and track service
availability. SQL Server contributes its information to this tool via an extended Management
Pack that captures many events that might indicate current or imminent services issues.
Included are enterprise-level capabilities to monitor database engine resource availability
and configuration, collect performance data, and test default thresholds. Local and remote
connectivity checks help ensure database availability.
With the embedded expertise in the SQL Server Management Pack, you can identify issues
and manage issues before they become critical. The SQL Server Management Pack for
Microsoft Operations Manager 2005 increases the security, availability, and performance of
your SQL Server infrastructure. The pack is available from the Microsoft SQL Server
Management Pack for Microsoft Operations Manager 2005 page on the Microsoft Download
Center.
Easy to Use
In SQL Server 2005, Microsoft extends the industry-leading ease of use of previous
versions, moving and combining its management and development toolset into the familiar
Visual Studio shell with rich a UI and an object model that leverages the power of the shell
and the underlying Windows OS and the .NET Framework. Bringing developers and
administrators together in the same tool enables greater productivity and leads to the
development of a common understanding and compatible working methods.
UI actions can be scripted and scheduled, enabling developers and administrators to use the
UI as a super-templating tool to build scripts and jobs without first running them against the
database. And, there are more templates so that new administrators can started quickly.
The new workflow-like Database Maintenance Plan (with an easy-to-use UI) enables
administrators to construct complex and maintainable administration scripts that include
sophisticated branching and error handling.
Usability is a core focus of the SQL Server 2005 toolset; all of the tools are engineered to fit
specific roles and to present familiar and easy-to-use interfaces that make complex tasks
easy to achieve for both new and experienced users. Examples include:

SQL Server Management Studio does more in parallel against larger schemas; you can
back up a database while restoring another and at the same time work on a new
Transact-SQL script. You can browse a filtered schema that contains thousands of
objects. The tool gets out of your way and helps you get the job done.

SQL Server Profiler makes it easy to create traces. With a UI that maps the data for
each trace event, trace definition is a simple task.

SQL Server Configuration Manager places all common “operator” tasks in one place in a
familiar Microsoft Management Console interface, immediately making this role more
productive.
Database Maintenance Plans
The new Database Maintenance Plan Wizard has a UI similar to that of SQL Server
Integration Services. Use it to create advanced workflows to manage database maintenance
activities. The new tool includes options to create cross-database maintenance plans. It will
back up all user databases (even databases added after the plan is created). The tool offers
multiple schedules per plan as well as multi-instance administration.
A database maintenance plan can be defined on one instance and executed on multiple
instances, releasing you from the tedious work of backup and index management in
complex infrastructures.
Script Generation
Database administrators have long used the SQL Server Enterprise Manager in conjunction
with SQL Server Profiler to perform an action in the user interface, capture the resultant
Transact-SQL, and then fashion it into production scripts for regular use. SQL Server
Management Studio makes this even easier by providing a consistent way to capture a
script without having to execute the command against a database.
Look for the Script button in the UI (Figure 5).
Figure 5
Script button
To capture a script:
1. Click the Script button.
2. Fill in the dialog boxe(s) with the options you want.
3. Select a script action. You can even script the command straight to SQL Server Agent if
your command must execute regularly or at a specific time.
This is an invaluable aid to administrators at any experience level. It is one step above
command templates—by pointing and clicking through the user interface, you can quickly
and safely build complex scripts without wasting time debugging syntax and spelling errors.
The following code is an example backup script created by using the Backup user interface
in SQL Server Management Studio:
BACKUP DATABASE [AdventureWorks] TO
DISK = N'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Backup\AdventureWorks.bak'
WITH
DIFFERENTIAL ,
EXPIREDATE = N'01/23/2007 00:00:00', NOFORMAT, INIT,
NAME = N'AdventureWorks-Differential Database Backup', NOSKIP, NOREWIND,
NOUNLOAD,
STATS = 10, CHECKSUM, CONTINUE_AFTER_ERROR
GO
declare @backupSetId as int
select @backupSetId = position from msdb..backupset
where database_name=N'AdventureWorks'
and backup_set_id=(select max(backup_set_id) from msdb..backupset
where database_name=N'AdventureWorks' )
if @backupSetId is null begin
raiserror(N'Verify failed. Backup information for database ''AdventureWorks''
not found.', 16, 1)
end
RESTORE VERIFYONLY FROM
DISK = N'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Backup\AdventureWorks.bak'
WITH
FILE = @backupSetId,
NOUNLOAD,
NOREWIND
GO
Copy Database Wizard
Database developers often ask for copies of production databases in order to test new
functionality by running tests against real data volumes. Finding an appropriate backup,
restoring it, and then scrubbing any sensitive data can be a time-consuming activity for the
administrator. This task is made easier by the Copy Database Wizard. To start the Copy
Database Wizard, in the SQL Server Management Studio Explorer pane, right-click any user
database and select Tasks/Copy Database.
Figure 6
Copy Database Wizard
Figure 6 illustrates a new fast-copy method available by selecting the Use the detach and
attach method option (useful if run over night when the system need not be available). An
online method is also available by using the SQL Server SQL Management Objects interface
to copy database objects individually.
Database Mail
In previous releases, SQL Server offered e-mail integration—an important means of
communicating events and alerts to the administrator. SQL Server 2005 offers a more
scalable and easy-to-configure infrastructure, making it possible for applications to use the
SQL Server Database Mail tool to add mail functionality. SQL Server 2005 mail integration
uses the SMTP protocol (working on 64-bit servers for greater scalability) and no longer
requires MAPI or Outlook client installation to send mail.
SQLCMD
SQLCMD is a command-line tool that replaces OSQL and ISQL. While OSQL is still shipped
with SQL Server 2005, scripts can be migrated to SQLCMD without requiring changes.
However, once you start working with SQLCMD, you will want to leverage the new
capabilities of SQLCMD and therefore you will probably see changes in the way you work
almost immediately. SQLCMD is significantly more flexible than its predecessors. You will
quickly find that where complex multi-script automation has been implemented through
batch files, conversion to a SQLCMD “master script” is relatively quick and offers
significantly more options and flexibility in command-line and batch automation than does
OSQL.
SQL Server Management Objects
SQL Server developers and administrators have long enjoyed industry-leading APIs that
make it easy to integrate application and database management. This tradition continues
with the introduction of an advanced managed API that exposes the full management
infrastructure of SQL Server to the developer.
Use SQL Server Management Objects (SMO) to create applications that:

Integrate with your infrastructure.

Work out the relationships between all the technologies that make up a service.

Scale administrative tasks so that with a single click administrators can take action
against hundreds of databases and servers.
Developers should review the downloadable distributables of the management API. These
are available with the SQL Server 2005 Management Objects Collection, which you can
download from the Feature Pack for SQL Server 2005 SP2.
As SMO is a managed API, it integrates superbly with Visual Studio and with new Windows
PowerShell technologies to provide a superior development and scripting environment.
Additional Highlights of the Management Tools
The previous sections explained how the new tools combine to provide a series of
management “smarts,” covering:

Enterprise Scale - enabling incredibly complex infrastructures for today’s internal and
external customer-facing systems

Insightful Management - opening up the database server so the administrator can
understand the source of issues, both current and potential, and identify opportunities
for optimization

Ease of Use - making the hardest task achievable and reproducible
The investment that has been made in delivering next-generation management technologies
and tools is further explained in this section.
SQL Server Configuration Manager
The shortcut to SQL Server Configuration Manager is installed in the Start/All Programs
menu in the SQL Server 2005 program group in the Configuration Tools subgroup.
SQL Server Configuration Manager can also be accessed by using SQL Server Configuration
Manager under the Services and Applications group in Windows Computer
Management. Another way to access it is to right-click a server from the Object Explorer
(in SQL Server Management Studio) and select Manage Service. In Computer
Management or SQL Server Management Studio, you can select either the local server and
its services or a remote server and its services. Once in SQL Server Configuration Manager,
you can select any service and configure its properties.
SQL Server Configuration Manager Features at a
Glance
Service and protocol settings can be managed from any location.
SQL Server Configuration Manager can connect to any SQL Server 2005 installation,
allowing central as well as remote management of SQL Server 2005 settings without
requiring administrators to log in to each server.
Changing service management does not require a connection to SQL Server.
SQL Server Configuration Manager uses a WMI Provider that does not require a connection
to a server that is running SQL Server. This allows SQL Server-related services to be
managed even when the service is not running. Security settings, such as required access
control settings on files and registry keys, are managed transparently by SQL Server
Configuration Manager as long as the person modifying these properties has appropriate
permissions to change the service settings of that server.
Changing a password does not require a service restart.
SQL Server Configuration Manager decreases server downtime as it allows you to change
the passwords of a service account without requiring that the service be restarted.
Settings are exposed for quick review and troubleshooting.
Anyone with access to the server has access to SQL Server Configuration Manager for
viewing server and service settings; however, only administrators can change service
settings. This allows personnel who troubleshoot to direct users to this tool for an initial
diagnosis of system configuration, while not allowing them to change the settings.
Settings can be scripted through the SQL Server Configuration Manager commandline tool and through WMI.
The WMI Provider allows server settings, client and server network protocols, and aliases to
be scripted through the WMI Provider by means of simple VBScript code or by using the
command-line tool. This enables the following scenarios:

The creation of automation (using Visual Basic Scripting®, Visual C++®, and
Visual C#® through the System.Management classes) to configure SQL Server. This
automation could collect SQL Server version information from multiple servers to make
sure that all of your servers have the appropriate service pack or required hotfixes
applied.

The creation of a script that changes the password of your services on all of your servers
(for example, when a password policy is enforced that requires that the passwords of
service accounts be changed).

The integration of SQL Server configuration into your own application, without the need
to write complex APIs or maintain complex configuration code.
Using Configuration Manager
To configure the properties for the named instance called SQLDEV01, start SQL Server
Configuration Manager, right-click the SQLDEV01 instance and select the Properties
option. This opens the Properties dialog box (shown in Figure 7) where you configure:

The startup service account.

Service properties such as whether the service will automatically start when the
operating system starts.

Advanced settings such as startup parameters and whether this service supports Error
Reporting.
Figure 7
SQL Server properties
SQL Server Surface Area Configuration
The shortcut to the SQL Server Surface Area Configuration tool is installed in the Start/All
Programs menu in the SQL Server 2005 program group in the Configuration Tools
subgroup. As part of a secure installation, the installer recommends running Surface Area
Configuration as a final step of installation.
Surface Area Configuration Features at a Glance
Centralized management of potential security vulnerabilities
With security as a fundamental requirement, simplicity in centralization can provide better
security by allowing faster and easier access to the most critical of options. Using this tool,
administrators have one primary place to go for reviewing, changing, and setting options
that, if incorrectly configured, might expose security vulnerabilities.
Scriptable configuration changes
With security as a fundamental requirement, managing consistency can lead to better
security. You can accomplish this by using scripts to configure a large number of servers to
the same secure settings. SQL Server Surface Area Configuration is scriptable through a
command-line utility version of the user interface called sac.exe.
Using the Surface Area Configuration Tool
The Surface Area Configuration tool offers a central tool to change and control the
attackable surface area of SQL Server. New installations can configure all features to be “off
by default,” whereas upgraded existing installations continue to have existing features
enabled. Using SQL Server Surface Area Configuration (Figure 8), you can disable features
from a central location.
Figure 8
SQL Server Surface Area Configuration
While you may not think this warrants a separate tool, having all options that expose
interfaces that might be exploited grouped in a single location makes it easy to access these
settings to either view or change them. Without this tool, the mechanisms used to change
these settings would be dispersed across SQL Server. For example, allowing xp_cmdshell
to execute is configured through the sp_configure stored procedure while adding HTTP
endpoints is handled through the CREATE ENDPOINT statement. Though administrators
know how to use sp_configure to view configuration settings and, if they use endpoints,
are familiar with the appropriate system tables (such as sys.http_endpoints), having all of
these items centralized in a single tool allows faster access and better control.
SQL Server Surface Area Configuration has two tools to handle the two primary areas for
configuration: Surface Area Configuration for Services and Connections, and Surface Area
Configuration for Features. Surface Area Configuration for Services and Connections controls
whether remote connections are allowed and whether services are enabled. It has two
views—View by Instance (the default) or View by Component such as the Database Engine,
SQL Server Agent, or Full-Text Search. Figure 9 shows the View by Instance tab selected.
By default, the Express and Developer editions of SQL Server are set to allow local
connections only. You can use SQL Server Surface Area Configuration to change these
settings, but remember to make any other required changes such as enabling firewall ports,
defining aliases, or starting the SQL Server Browser service to facilitate connection to
instances not using the default 1433 port.
Figure 9
Surface Area Configuration for Services and Connections
To disable a service, change the Startup Type to disabled. By default, if you did not set
SQL Server Agent to autostart, SQL Server Agent is disabled. Use the Surface Area
Configuration for Services and Connections tool to change this setting to Manual or
Automatic.
Figure 10
Surface Area Configuration for Features
Surface Area Configuration for Features (Figure 10) has more settings and options. These
options can be set in a variety of ways through the server. Features that can be changed
are:

Ad hoc Remote queries
When disabled, OPENROWSET and OPENDATASOURCE are disabled and cannot be used.
This does not affect linked servers or linked server requests made through OPENQUERY;
however, these are off by default as a linked server must be created first.

CLR Integration
When disabled, the Database Engine .NET Framework Programming API—called CLR
Integration—is disabled for this instance. If you disable CLR Integration in a server that
previously used this feature, the application receives the following exception when the
feature is invoked by application code:
Msg 6263, Level 16, State 1, Line 1
Execution of user code in the .NET Framework is disabled. Use
sp_configure "clr enabled" to enable execution of user code in the .NET
Framework.

Database Mail
Database Mail can be installed in the msdb database, but is disabled by default.
Enabling the Database Mail stored procedures allows your server to configure SMTPbased mail profiles and then send e-mail. Enabling Database Mail does not immediately
allow mail to be sent; it only allows it to be configured.

Dedicated Administrator
When disabled, only LOCAL dedicated administrator connections can be made. The
dedicated administrator connection is a troubleshooting option used to connect and
troubleshoot a server when no other connections are allowed. By default, dedicated
administrator connections can be made from the local server only. Especially when direct
physical access is not allowed (as is the case in many data centers), enabling this might
be helpful for troubleshooting by using a remote dedicated administrator connection.

Native Web Services
SQL Server 2005 allows access through HTTP endpoints but by default no endpoints are
configured during installation. SQL Server endpoints do not require Internet Information
Services (IIS) and are restricted only to the logins that are granted access to them.
However, they are an alternate entry point into your server and for manageability,
Surface Area Configuration for Features shows them in one place. This list is empty by
default.

OLE Automation
Instead of instantiating OLE automation objects through the old sp_OA* procedures,
consider using the SQLCLR. If OLE automation procedures are still required, enable this
option. Because of the potential risks to server stability posed by running unmanaged
code inside the SQL Server process, this is turned off by default. Unless you have code
that uses OLE automation procedures, it won’t be necessary in most cases to turn on
this option. It is recommended that a DBA who has systems with extended stored
procedures that provide extended business logic, or who uses object model manipulation
via the sp_OA* stored procedures consider rapid adoption of .NET Framework
programming for the SQL Server 2005 Database Engine. This is because the SQL CLR is
safer.

Service Broker
In SQL Server 2005, you can create reliable messaging applications by using Service
Broker. Because access to SQL Server through a service broker endpoint could expose
SQL Server data, the Surface Area Configuration for Features tool enables you to view
all configured service broker endpoints in one place. This list is empty by default.

SQL Mail
SQL Mail refers to the extended stored procedures that were used in past releases and
that use a MAPI-based mail profile to send e-mail. These extended stored procedures
have naming conventions similar to xp_*mail. Unless you have a requirement for
backward compatibility, switch to Database Mail.

xp_cmdshell
In past releases, xp_cmdshell was enabled but limited to users in the System
Administrators role. In SQL Server 2005, it is disabled by default, even for system
administrators. A better way to execute command-line programs is through SQLCMD
scripts, which use the credentials of the Windows Authentication user to execute. Using
SQLCMD you do not use impersonation.

Web Assistant
In past releases, you could set up and automate the generation of HTML data files from
a series of Web Assistant Wizards and procedures. If you do not use the sp_*webtask
stored procedures, you do not need to enable this.
Important Note
Before enabling features that increase the surface area of the SQL Server, it is
recommended that the DBA ensure that their systems are:

At the latest service pack and critical hotfix level (obtained from Microsoft Update).

Configured according to their recommendations for secure systems (these may be
informed by Microsoft and other third-party vendor advice on server and infrastructure
configuration).
SQL Server Management Studio
As the primary tool for management, database development, and querying, SQL Server
Management Studio (SSMS) has some features that look and feel similar to Enterprise
Manager and others that are completely new. In many cases, the new features replace
components or settings that were somewhat frustrating. For example, Enterprise Manager
used modal dialogs, which meant that each dialog box stayed active until it was either
completed or canceled. To do anything else in parallel, you often needed to launch another
instance of Enterprise Manager. Another limitation of the older tools was that you didn’t
know what was going on under the hood. If you were unsure about what was being
executed for a given UI action or even if you just wanted to capture and reuse the
commands in a script for automation, you probably launched SQL Server Profiler to profile
and trace Enterprise Manager statements. These additional steps are no longer needed.
SQL Server Management Studio takes care of both of these limitations, as scripting
capability is built in to each dialog box and its dialogs are non-modal.
SQL Server Management Studio Features at a Glance
Integrated administration and database development environment
Usability is another fundamental requirement. In SQL Server 2005, developers will find
instant usability in the familiar solution and project paradigm. Even without a development
background, administrators will find that creating solutions of Transact-SQL scripts and
batch files makes opening a set of related scripts easier and makes it less likely that scripts
are “lost” in the file system.
SQL Server Management Studio provides a consistent management experience across
multiple SQL Server 2005 technologies, the SQL Server Relational Engine, and also:

SQL Server Analysis Services

SQL Server Integration Services

SQL Server Reporting Services and Notification Services

SQL Server Mobile Edition
Help integration
SQL Server Management Studio editing surfaces are connected to SQL Server Books Online
to assist with unfamiliar commands and new options. Together with the supplied templates,
this ensures that developers and administrators are productive immediately.
Scriptable dialog boxes
Previously, SQL Server Profiler had to be used to understand the commands that
SQL Server Enterprise Manager was executing. This took time and required switching
between the two tools. With SQL Server Management Studio, each dialog box has multiple
options that can be used to execute a command:

Execute the command immediately

Script to a new query window

Script to the Clipboard

Script to a file

Schedule the command to run later
Non-modal dialogs
You are no longer “stuck” on a dialog box, waiting for it to complete or forcing it to cancel.
If you have not yet decided on all of your options and want to investigate them by running a
query, you can leave dialog boxes open, switch to another window or create a query
window, and then return to your dialog box with all properties remaining.
Object filters
When browsing a large number of objects, you can easily set object filters to reduce the
number of objects that are displayed. This can help both performance and usability when
working with large schemas such as SAP or other large applications.
Predefined and custom health reports
As shown in Figure 11, a series of predefined reports are available at both the server level
and the database level. Predefined reports help determine:

Server activity

Configuration options

Performance statistics

Transaction log shipping status

A variety of change history information such as configuration change history and schema
change history
In addition to predefined reports, the ability to define custom reports is included in the tool.
Figure 11
SQL Server Management Studio reports
Integration with source control
As long as you use a source control application that supports the Windows Source Control
APIs, you can configure SQL Server Management Studio to use it to manage your scripts,
control changes through the familiar check in/out paradigm, and review and audit change
history.

Multiple query execution window types
Query windows can be one of many types: Transact-SQL query windows, SQLCMD-mode
query windows, and a special Dedicated Admin Query window.

Highly customizable query execution windows
Color coding can be customized, results to grid or text can be set, split window versus
tabbed mode are options and even your keystroke settings can be configured to either
SQL Server 2000 settings or standard settings. Standard settings are the Visual Studio
keystroke defaults and this is the default setting for keystrokes. The query window
environment is highly customizable.
Using SQL Server Management Studio
The SQL Server Management Studio environment resembles that of the former
management tool, SQL Server Enterprise Manager, and the former query tool, Query
Analyzer, in addition to the Visual Studio development environment. This environment is
highly customizable, depending on the tools you need. By default, SQL Server Management
Studio includes the Registered Servers pane and the Object Explorer pane. Additional
windows (panes) can be displayed by choosing explorer keystrokes or windows from the
View menu.
Registered Servers pane (Ctrl+Alt+G)
The Registered Servers pane contains a list of the servers to which you can connect.
Servers are grouped by type. Each icon at the top of this pane allows to you to choose the
group of servers to browse and/or query. The types of servers to which you can connect
are:

Database Engine
The Database Engine components include the core server services: SQL Server and
SQL Server Agent. You can connect to many different editions of SQL Server, including
SQL Server 2000 and all editions of SQL Server 2005.

Analysis Services
To ensure data integrity and performance for data mining applications, Analysis Services
servers are managed by their own instance. Use SQL Server Management Studio to
browse your Analysis Services instances and write MDX queries against them. For a
more extensive business intelligence environment, use Business Intelligence (BI)
Development Studio.

Reporting Services
SQL Server Reporting Services provides a set of processing components, tools, and
programmatic interfaces that support the development and use of rich reports in a
managed environment. Use SQL Server Management Studio to browse reports and use
the Report Builder tool to build reports.

SQL Server Mobile
SQL Server 2005 Mobile Edition, previously referred to as SQL Server 2000
Windows CE 2.0 (SQL Server CE), is a feature-rich compact database designed to
support an expanded list of smart devices and Tablet PCs.

Integration Services
SQL Server Integration Services (SSIS) is a platform for building high-performance data
integration solutions, including extraction, transformation, and loading (ETL) packages
for data warehousing. SQL Integration Services replaces Data Transformation Services.
Object Explorer (F8)
Object Explorer combines the tree view from the Enterprise Manager with the Object
Browser capabilities of Query Analyzer. All administration and object manipulation can be
performed from this expandable/collapsible view. Object Explorer is usually docked in the
lower left in SQL Server Management Studio windows. This is where you can browse for
databases and database objects. You can perform all administrative tasks in the same way
that you did in Enterprise Manager. When you use Object Explorer, a corresponding window
appears called the Summary window. The Summary window is opened by default if you
connect to an instance when you start SQL Server Management Studio. If you start in a
disconnected state and then later connect and want to open the Summary window,
press F8.
If you are reviewing a large number of objects, consider creating a filter. Filters allow you to
view and work with a subset of your objects at a time. To create a filter, right-click an
object type such as Tables or Views, and then click Filter. (See Figure 12.) Filters use
wildcards just as a WHERE clause would. They restrict your object list to only those objects
that meet your filter criteria.
Figure 12
Object Explorer filter settings
The right-click shortcut menu is also used to access the rich set of predefined summary and
detail reports, as well as custom reports, that are available for most of the objects in the
Explorer tree
Summary Window (F7)
When connected to a server through Object Explorer, a new Summary window appears. This
Summary window allows navigation and drill-down into the object type that is selected in
Object Explorer. The window provides a view into the detail of the object and provides a
quick view of metadata such as column names, indexes, and keys for a table. If your object
list is filtered, the Summary window is filtered as well.
Properties Window (F4)
The Properties window contains a view of the properties related to selected elements in your
solution or query window. Use the Properties window to view file, project, execution plan,
and solution properties. To open the Properties window, click Properties Window on the
View menu. The Properties window displays different types of editing fields, depending on
the particular property. Properties shown in gray are read-only.
Solution Explorer (Ctrl+Alt+L)
The Solution Explorer window matches the Visual Studio Solution and Project paradigm
where a solution can have multiple projects. You can add a project to a solution or combine
more than one project within a solution. A Management Studio project is a collection of
logically related scripts and files that are saved together for simplified access in database
administration and development. The components added to a project are:

Connections
A connection, as persisted within a project, contains login information, server name,
default database, preferred protocol, authentication type, and connection properties.
Connection information may optionally be stored with a script.

SQL scripts
A SQL script, as persisted within the project, contains commonly used SQL scripts for
the project. These scripts can be grouped into projects and can be a copy of the original
(copied to the project’s directory) or reference a file in another location. To open a script
in the SQL Editor, double-click a .sql file within the project. To see the properties of a
script, right-click a .sql file and select Properties Window.

MDX, DMX, and XMLA scripts
These are Analysis Services scripts commonly used for business intelligence applications
and projects. To open a script in the appropriate Editor, double-click the script in the
project.

Misc
Use this folder for files that do not neatly fit into any of the other default node types,
such as a text file that contains the project objectives or a batch file that calls a group of
SQLCMD scripts.
By default, Solution Explorer is not displayed. When it is displayed, Solution Explorer is
usually docked on the right side of the SQL Server Management Studio window. Solution
Explorer is blank if a solution is not currently loaded.
Template Explorer (Ctrl+Alt+T)
Templates are boilerplate files containing SQL scripts that help you create objects in the
database. A variety of templates are provided, installed by default in the
sqlworkbenchnewitems directory under Program Files\Microsoft
SQL Server\90\Tools\Binn\VSShell\Common7\IDE\.
Template Explorer provides access to many code templates. Templates are available for
solutions, projects, and various types of editors. Use them to create SQL Server objects
such as databases, tables, views, indexes, stored procedures, triggers, statistics, and
functions. Figure 13 shows the Template Explorer window and the script produced by
choosing the endpoint template.
Figure 13
Templates
There are also templates that help you to manage your server by creating extended
properties, linked servers, logins, roles, users, and templates for Analysis Services and
SQL Server Mobile Edition. In a template you can easily search and replace template
parameters by choosing the Specify Values for Template Parameters icon from the toolbar.
When this option is selected, only templates parameters are shown. Each parameter can be
changed once, globally by using the Specify Values for Template Parameters dialog box, as
shown in Figure 14.
Figure 14
Template parameters
Docking and undocking
You can arrange windows and browsers on the screen and remove the ones you don’t need.
To undock and move windows, double-click the window title bar. To reset the window
layout, select Reset Window Layout from the Window menu. If you close a window, you
can restore it from the View menu.
Changing dock location
To undock the Registered Servers pane, click the title bar of the Registered Servers pane
and slowly move the window down from its current location. A series of docking controls
appear. Docking controls always appear at the extreme top, bottom, right, and left areas of
each window and in the center of the window where your cursor is currently located. By
dragging the Registered Server window on top of the center of the control in the center of
the current window (the center control looks like a folder with tabs on the bottom), the
Registered Server window will appear as a tab with the Object Explorer. Tabs are on the
bottom of the window.
Pinning and unpinning
To gain better real estate on a low-resolution screen or to get a larger query window, you
can set the windows to auto-hide to the side. Each window is controlled by a pin located in
the window title area. If you click the pin in the Registered Servers dialog box, the pin
changes direction and the window auto-hides. These are replaced by tabs on the leftmost
window.
Important Note
Take some time to customize SQL Server Management Studio. Remember, you can always
reset the window layout by selecting Reset Window Layout from the Window menu. You
can bring a window or explorer back by using the hot key (as listed previously) or by
choosing the window/explorer from the View menu.
SQL Server Profiler
SQL Server Profiler, included in the SQL Server 2005 tools, is an updated profiling/tracing
tool. In many ways it is very similar to its predecessor. You still trace events and view
attributes (as data columns) for selected events. SQL Server Profiler adds significant value
in the area of storing and viewing events. Specifically, two new event types add flexibility to
performance tuning analysis and locking analysis: Showplan XML and Deadlock Graph.
The Showplan XML event is used to define the plan of execution in XML format so that
tools, such as SQL Server Profiler or SQL Server Management Studio, can graphically
represent the execution plan in the same way that SQL Server Management Studio does
when you execute with showplan turned on. You can graphically view and analyze saved
plans using Showplan XML format.
Deadlock Graph shows a graphical representation of the statements that were caught in a
deadlock. There are new ways to save these items in addition to and separately from your
workload.
Events can be correlated with logs collected from Windows System Monitor (also known as
PerfMon), allowing a better and more integrated feel to your server’s overall performance.
Adding counters to a trace helps you effectively analyze and diagnose problems quickly. For
example, you can graphically see the CPU queue length over a period of time, select a time
when the CPU queue length was high, and see tracing activity for that duration. This tells
you which SQL events might be contributing to a CPU spike.
SQL Server Profiler Features at a Glance
Performance Monitor correlation with a SQL Server Profiler workload
The main task for SQL Server Profiler is tracing server activity. Duration is a commonly
traced attribute. While duration can give you insight into how your server performed for a
given event, generally trace columns do not capture detailed information about system
resource usage during your trace. SQL Server Profiler focuses on attributes about a given
event, not about resource utilization in SQL Server as a whole. With SQL Server Profiler,
you can now integrate a saved System Monitor Performance Counter log into your saved
SQL Server Profiler trace. These two methods for tracing system activity, when used
together, allow you to better correlate what was happening across the server as a whole
when certain events executed. This helps you diagnose the events that lead to a spike in
CPU or a surge in disk activity.
Profiling is grantable
If granted permission, any database owner can profile and optionally tune (through
Database Engine Tuning Advisor) a workload for their database. Systems Administrator
privileges are no longer required. If permissions have been granted, you can capture a
workload and even run it through the Database Engine Tuning Advisor.
Profiling Analysis Services in addition to profiling the Database Engine
To further integrate the tools across engines, SQL Server Profiler now supports profiling
more than just the Database Engine. Since the release of OLAP Services in SQL Server 7.0,
the internal workings of Analysis Services have been a mystery. Now you can use the
familiar SQL Server Profiler tool to gain a better understanding of what happens in your
applications, and to monitor and help debug your applications. There is a wide range of new
event categories and classes, each with a rich selection of data columns. These include
events for Commands and Queries, almost the equivalent of separate events for DML and
DDL SQL statements. There are other more familiar categories, including Sessions Events
and Security Audit, with events similar to their database engine equivalents, as well as
those unique to Analysis Services. The Progress Reports category is strictly for Analysis
Services—it gives details of processing operations on objects such as dimensions, partitions,
and cubes.
Deadlock graphs
Deadlocks are graphically displayed in SQL Server Profiler, along with complete details
about the commands and connections that created the deadlock. Deadlock graphs can be
saved to separate files and loaded into SQL Server Management Studio for further graphical
analysis.
Graphical showplans in SQL Server Profiler
Graphical execution plans are a critical element in diagnosing performance problems.
Typical applications execute SQL with many access paths and join operations, resulting in
complex execution plans. The Showplan XML event generates the data needed to display
the execution plan graphically in SQL Server Profiler. The plan is interactive, has many
usability options, and can be saved to a separate file and later loaded into SQL Server
Management Studio for further graphical analysis.
Replay improvements
When replaying a trace, certain situations may arise that lead to problems where
SQL Server Profiler is waiting for a response from SQL Server for a very long time. The
Replay health monitoring option enables you to cancel operations that exceed a
configurable time limit. Other improvements include the introduction of SQL Server Analysis
Services replay, replay of RPC events (such as cursor based load), and greater control over
replay execution.
New event categories
Several new event categories focused around the new functionality provided in the database
engine for SQL Server 2005, such as Service Broker, CLR, and Query Notifications
categories have been added such as:

The Broker event category – Profiles for undelivered messages, broker conversations,
whether the queue has been disabled, and many more

The CLR event category – Profile for assemblies that have been loaded

The Query Notifications event category – Profiles subscriptions and notifications
Dynamic event infrastructure
SQL Server Profiler obtains information from SQL Server as to which counters, events, and
data it supports. The SQL Server team will use this information to add more counters over
time through hotfixes and service packs without the need to redistribute the entire
SQL Server Profiler tool. When counters are updated, SQL Server Profiler presents a dialog
box to download the new counters.
Using SQL Server Profiler
There are many ways to use SQL Server Profiler but the most common is to trace events—
using SQL Server Profiler to trap events and then analyze them in the SQL Server Profiler
client. This process has been updated by changing the way that events, data columns, and
filters are chosen and displayed. Instead of setting options on three seemingly disconnected
tabs, SQL Server Profiler unifies the options into one dialog box that provides a
spreadsheet-style view to make it easy to select the data to capture in a SQL Server Profiler
session, as illustrated in Figure 15. Only data columns that produce a value for a given
event are selectable. You can compress the list to show only selected events and data
columns.
Figure
15 SQL Server Profiler Trace properties
Additional events have been added to the existing categories, aimed at helping you
diagnose and resolve issues faster and more accurately. Several of these events return
XML, not something most administrators relish, but SQL Server Profiler renders this for you
in the lower detail pane. One example of this is the Showplan XML event, which produces
a familiar showplan format from SQL Server Management Studio. You get the easy-tointerpret graphical display without having to interactively run the query. When the
Deadlock Graph and/or Showplan XML events are chosen, a third tab, Events
Extraction Settings, appears. This dialog box allows you to choose whether to save the
individual execution plans and deadlock events as one file (one file for each type—all XML
Showplan batches in one file and all Deadlock XML batches in a separate file) or in one file
for all events of a particular type. Showplan XML events are saved in a file with the
extension .SQLPlan. When you open this file, it is automatically associated with SQL Server
Management Studio.
The following figure shows an execution plan called CreditTuningTrace_183.SQLPlan. Each
execution plan encountered during the trace was delivered to its own file. Each file was
named with a number to show the order in which they were executed. Shown in SQL Server
Management Studio, this saved execution plan is fully interactive; notice the fully populated
Properties window and the details shown for the Hash Match algorithm that display when
you hover over an item in the plan. The format for these plans (in SQL Server Management
Studio or SQL Server Profiler) is the same, allowing you to save, share, and discuss plans
with colleagues by sending a very small (and interactive when loaded in SSMS) text file
instead of sending a bitmap of a screen shot that is not interactive.
Figure 16
Saved plan
The Deadlock Graph event is another XML-based event. It complements the existing
deadlock events. It renders an easily interpreted graphic as shown in Figure 17.
Figure 17
Deadlock Graph
To correlate events between SQL Server Profiler and Performance Monitor, you must have
time-correlated logs and both must be completed and saved. This feature works against
saved Performance Monitor logs and saved SQL Server Profiler traces. If you are not familiar
with how to create a System Monitor Performance Counter log, see How to Create a
Performance Monitor Log for NT Troubleshooting in the Microsoft Knowledge Base.
To correlate events, open the saved SQL Server Profiler trace. Select Import Performance
Data from the File menu. If the performance log and the trace cover the same timeframe,
the counters logged in the performance log will appear for your selection. Once chosen, the
Performance Monitor log is correlated to the SQL Server Profiler trace and then displayed in
SQL Sever Profiler, as shown in the following illustration.
Figure 18
SQL Server Profiler and Perfmon
Once the Performance Monitor log has been integrated into SQL Server Profiler, you can
zoom in and out by clicking and dragging your mouse over the area of the graph that
interests you. You can select points in the graph to see the trace activity at that point
(SQL Server Profiler moves to the corresponding event) or visa versa; you can select points
in the saved workload and see the performance counters at that point.
Database Engine Tuning Advisor
Database Engine Tuning Advisor (DTA) replaces the revolutionary Index Tuning Wizard
(ITW) of SQL Server 2000 and adds a more flexible environment for tuning, together with
support for new SQL Server 2005 database engine features such as partitioning.
The rules engine behind Database Engine Tuning Advisor is greatly improved and produces
more accurate recommendations in less time. Incoming workload is prioritized to focus on
the most expensive queries first and to group duplicate queries. The range of queries that
can be optimized has increased, especially for those statements that use temp tables.
Database Engine Tuning Advisor provides comprehensive error reporting tracked to a full
error log. You can see an error for each tuned statement, so you know exactly why a
statement could not be tuned and you can fall back to manual tuning if it is required. Errors
are reported as the tuning happens. If tuning must be interrupted, you can stop tuning and
get whatever recommendations have been generated so far, so that not all tuning effort is
wasted.
If changes to your production system need to undergo a risk/benefit analysis, this process is
assisted with reports that document expected improvements for each statement and why
certain indexes have been selected. The tuning options allow for evaluation of existing
indexes to see if some of them can be safely dropped. The command-line Database Engine
Tuning Advisor also allows for what-if analysis.
The UI is multithreading, so you can start a tuning session and then open another one and
look at its results while the first one is running. Tuning can continue without leaving your
session open; the tuning session is saved on the server and the results available when you
launch the DTA UI again.
Database Engine Tuning Advisor Features at a Glance
Tune multiple databases with a single workload
DTA allows multiple databases to be tuned from the same workload. This enables you to
focus on collecting the right workload from your application by using SQL Server Profiler and
then submitting the workload to DTA for tuning. Select the databases to tune and DTA
returns recommendations for each database, if changes are recommended.
Get partition recommendations in DTA
Select the partitioning strategy to employ—full partitioning or aligned partitioning—and DTA
generates partition function and partition scheme recommendations. For data warehouses
and OLTP environments with large data sets that may benefit from partitioning, this feature
can help to determine the best partitioning scenario to improve performance.
Timebound tuning
Real-life applications have huge workloads and can take a very long time to complete.
Timebound tuning will box the time and generate recommendations based on workload
consumed in that time.
Reducing the production server tuning load
Instead of requiring a fully redundant test server, DTA can generate metadata, statistics,
and production server hardware specifications in order to tune a production database, on a
test server, without requiring that the database be backed up and restored.
Using Database Engine Tuning Advisor
There are many ways to launch the Database Engine Tuning Advisor. The shortcut to the
Database Engine Tuning Advisor tool is on the Start/All Program menu in the
SQL Server 2005 program group in the Performance Tools subgroup. To launch DTA
from SQL Server Management Studio, select Analyze Query in Database Engine Tuning
Advisor from the Query menu.
In the Database Engine Tuning Advisor you can choose any combination of options and
perform analysis on queries, scripts, or complete workloads on one to several databases.
Select the databases and tables to tune on the Workload tab (see Figure 19). The options
that define the extent to which a database is tuned are on the Tuning Options tab.
Options for tuning include:

Physical design structures (PDS) to use in database
The design structures tuned by default are indexes, which includes all index types
except indexed views. To include all index types, change this to Indexes and indexed
views. You can limit this to indexed views only, nonclustered indexes only, or look only
at the effectiveness of indexes that are already in place.

Partitioning strategy to employ

Physical design structures to keep in database

Advanced tuning options include:

Define (limit) max space for recommendations (MB)

Define (limit) max columns per index

Online index recommendations
Figure 19
Database Engine Tuning Advisor
In order to tune a workload, a DBA typically follows a series of steps:
1. Capture a workload against production (in order to ensure a realistic workload).
2. Back up the production database and then restore the production database to a test
server (to ensure a realistic data set).
3. Run the tuning tool with the production workload against the development server (to
minimize the load against production).
These steps are necessary because running a tuning tool against a production server can be
expensive in terms of resource utilization. However, requiring a completely redundant
development server can also be expensive in terms of hardware, storage, and management
costs. Instead of requiring a fully restored image of the database, you can use a new
feature that reduces the production server tuning load and saves time and resources. The
idea behind reducing the production server load is that only necessary metadata and
statistics are copied over to a test server in order to run tuning against the metadata and
not the actual data. This requires a lot less space on your development server. To run DTA
in this mode, you must use the command-line executable version of DTA called dta.exe with
an input file in XML format. For details on how to use this, see Reducing the Production
Server Tuning Load in SQL Server Books Online.
SQLCMD
SQL Server 2005 delivers a next-generation scripting engine that can be used to develop
complex batch scripts that run Transact-SQL against any number of database instances.
This tool supplants (and extends) previous scripting tools such as ISQL and OSQL.
SQLCMD Features at a Glance
Parameterized scripts
SQLCMD allows the creation of reusable scripts (script templates) by the introduction of
script variables that can be passed in from the command-line to the script in a multitude of
ways.
Improved error handling
SQLCMD allows scripts to trap errors and immediately terminate execution, preventing
complex database and object creation scripts from creating objects in the wrong database.
Multi-server scripts
SQLCMD allows scripts to be run against multiple servers by the introduction of a connection
command (:CONNECT). This allows structured and parameterized scripts to run against
multiple servers. Where complex ordered statements must execute, proper order can be
maintained.
Dynamic output switching
SQLCMD allows output from queries, errors, or statistical execution data to be switched
dynamically to different types of output, in the same script.
Improved handling of code pages
OSQL and ISQL did not provide much control over code pages, sometimes yielding
unexpected results. SQLCMD gives you complete control over the input and output code
page that is being used.
Using SQLCMD
SQLCMD scripts can be managed within source control and deployed to a file share where
they are picked up by batch jobs defined in SQL Server Agent. This provides a completely
automated management infrastructure. The administrator need only step in when problems
are indicated by the scripts. This is often called management by exception and it is how
administrators can manage a large number of databases, instances, and servers without
becoming overwhelmed.
If the capabilities of SQLCMD are not enough for your application needs, consider custom
development work using PowerShell scripts and the SMO classes.
Dedicated Administrator Connection
In extreme cases, your server might not respond to normal login requests; it appears to be
“hung” and in an indeterminate state. However, the service may still be running and
perhaps even continuing to process some of the already connected users. In many cases,
administrators stop and restart the SQL Server service in order to temporarily stop the
problem. In many cases, the problem might not return. But in others, the problem returns
so that the server must be repeatedly stopped and restarted. The real problem is the lack of
troubleshooting tools at the time of these serious problems. Without a way to connect,
troubleshooting is impossible. In SQL Server 2005, a small (yet critical) number of
resources are dedicated to troubleshooting in this scenario.
Troubleshooting in this scenario is done by using the Dedicated Administrator Connection
(DAC) through one of the client tools, typically SQLCMD. By default, only logins with the
CONTROL_SERVER permission or higher can access the server by using the DAC and only
locally executed connections are allowed. For remote DAC access, use the Surface Area
Configuration tool for Features to enable remote DAC access.
You can connect to a server by using a Dedicated Administrator Connection from SQLCMD
or from SQL Server Management Studio. When a query window connects to SQL Server
Management studio, the server name and login information are required. To have the query
window connect to a SQL Server window by using a Dedicated Administrator Connection,
precede your server name with Admin:. For example, to connect to the server\instance by
using the DAC, use Admin:server\instance.
Important Note
You can only have one Dedicated Administrator Connection at a time. The Dedicated
Administrator Connection is a special connection, typically associated with SQLCMD. By
default, this special connection can only be used for locally connected administrators.
However, allowing remote Dedicated Administrator Connections can be enabled by using the
Surface Area Configuration tool.
Backward Compatibility
In some cases, the new SQL Server 2005 tools can be used to manage a SQL Server 2000
installation. SQL Server Management Studio can be used to connect to and manage a server
that is running SQL Server 2000. The SQL Server 2000 Query Analyzer can be used to
connect to and execute scripts against SQL Server 2005. The SQL Server 2005 SQLCMD tool
can connect and execute scripts against SQL Server 7.0, SQL Server 2000, and
SQL Server 2005.
While using some SQL Server 2000 tools might be convenient, you do not have access to all
SQL Server 2005 features unless you connect to and use the SQL Server 2005 tools.
One tool you will want to switch to quickly is SQL Server Profiler. SQL Server 2005 Profiler
can profile a server that is running either SQL Server 2005 or SQL Server 2000. One
immediate benefit of using SQL Server 2005 Profiler is that the user interface shows only
the data columns that produce values for a given event. Additionally, using the new user
interface, cells that do not have a value are shaded to show that no value is expected. While
many of the new features, such as Deadlock Graph events and the graphical showplan are
not available, the general changes to the user interface warrant the switch. Additionally, the
ability to integrate SQL Server Profiler trace files with System Monitor Performance Counter
logs—even with SQL Server 2000 traces—makes SQL Server 2005 Profiler significantly
better for launching and analyzing SQL Server 2000 workloads.
The SQL Server 2000 management API (SQL Server Distributed Management Objects
(DMO)) has been updated to work against SQL Server 2005, making interim support from
older programs simple; they just work with existing SQL Server 2000 functionality. The
SQL Server 2005 management API (SQL-SMO) also works against SQL Server 2000, making
the job of downward compatibility of new applications simple.
Conclusion
While this document only highlights key features for many of the new tools, you now have a
solid base on which to start. SQL Server 2005 offers a complete toolset that allows you
better control and management of your enterprise. These include integration with source
control, filtering of large object sets, advanced profiling and analysis with Performance
Monitor integration, flexible command-line automation, descriptive default report sets at
both the server and the database level, custom reports in SQL Server 2005 SP2, profiling
different engines including Analysis Services and the SQL Server Database Engine, and a
more flexible management solution that uses a project and solution paradigm for better
script/resource management—to name just a few.
This white paper should make you more aware of the features available to you that can
make you more productive from the start. Knowing which is the right tool for the job and
the limitations of each tool should have you on your way to a more manageable
environment.
For more information:
Microsoft SQL Server Manageability Web site
Did this paper help you? Please give us your feedback. On a scale of 1 (poor) to 5
(excellent), how would you rate this paper?
Additional SQL Server 2005 Resources
Resources on Microsoft.com, MSDN, and TechNet

SQL Server Developer Center

SQL Server TechCenter

MSDN Live and On-Demand Webcasts

Management API Redistributables

SQL Server 2005 Virtual Labs

Management Studio Hands-On Lab Manual

Database Tuning Hands-On Lab Manual
White Papers

Statistics Used by the Query Optimizer in Microsoft SQL Server 2005

Strategies for Partitioning Relational Data Warehouses in Microsoft SQL Server 2005

Partitioned Tables and Indexes in SQL Server 2005

Processing XML Showplans Using SQLCLR in SQL Server 2005

Statistics Used by the Query Optimizer in Microsoft SQL Server 2000

Improving Performance with SQL Server 2000 Indexed Views
Miscellaneous Resources
Books About SQL Server 2005