Transcript lesson28
SQL Server Management Tools
Lesson 28
Skills Matrix
Using Data-tier Applications
• Your developers use Visual Studio to develop
your new application.
• They create a data-tier application (DAC) as
a single unit for authoring, deploying and
managing the multiple involved objects.
• You use the Deploy Data-tier Application
Wizard to deploy a data-tier application
(DAC) from a DAC package to an existing
instance of SQL Server 2008 R2.
Using Data-tier Applications
• Information in the Deployed Data-tier Applications
view of Utility Explorer provides utilization data for
individual data-tier applications, CPU utilization
history, storage utilization details at the file level,
and the ability to view and update policy
thresholds.
• Policy thresholds can be controlled at the data-tier
application level for CPU utilization and for
database data files and log files.
• You can also view property details for individual
data-tier applications.
Centralized Server Management
• A Central Management Server (CMS) must be a
SQL Server 2008 edition, or later.
• You register a server by clicking View in SQL
Server Management Studio, selecting
Registered Servers, expanding your Database
Engine, right-clicking Central Management
Server and right-clicking to select Register
Central Management Server.
• When done you can run queries against a
server group created in the CMS.
Performance Studio
• Performance Studio builds on the concept of
the Database Reports in SQL Server 2005
and the Performance Dashboard introduced
in SQL Server 2005 SP2.
• Data are historical and are persisted across
service restarts.
Data Collection
• A data collection container holds a set of statistical data
you would like to collect, when to collect them and how long
to keep them.
• Data collections differ from dynamic management views in
that dynamic management views present current data while
data collections hold multiple instances of instantaneous
(history) data permitting trend analysis.
• The data collector uses prebuilt or custom SSIS modules
and SQL Agent jobs to populate an automatically created
Management Data Warehouse (MDW).
• Four different data collector types exist: Transact-SQL
query, SQL Trace, performance Counters and query activity.
Custom Data Collection
• To create a custom Data Collection you need to
use a Transact-SQL script.
• You can create a Transact-SQL script from scratch
to define your custom Data Collection or you can
generate a script from one of the three different
system Data Collections, and then modify it to
meet your needs.
• You might it easier to generate a script of a system
Data Collation by using the script task from Object
Explorer and modifying it, then keying in a
complete script by hand.
Resource Governor
• The resource governor (available only on the
Enterprise edition) makes sure processes consume
only the CPU cycles and memory allotted.
• The resource governor also limits resource
intensive processes so other database activities
continue to be responsive.
• Resource Governor is a new technology in SQL
Server 2008 that enables you to manage SQL
Server workload and resources by specifying limits
on resource consumption by incoming requests.
Resource Governor
• Resource Governor is designed to address
the following types of resource issues which
are commonly found in a database
environment:
– Run-away queries on the server
– Unpredictable workload execution
– Setting workload priority
Dynamic Views
• Resource Governor introduces new dynamic
management views that you can use to
return current statistics and configuration
data for workload groups and resource
pools.
Classifier Function
• The purpose of a classifier function is to identify
processes that should belong to specific
workload groups.
• These workload groups will be restricted by the
Resource Governor process to the limits
allowed by any resource pool to which the
workload group is assigned.
• If no classifier function is in use, processes will
be assigned to the default workload group.
DBCC Consistent Checks
• The database console commands (DBCCs) are an
important set of commands a DBA should understand.
• The DBCC consistency check commands form the
basis of a proactive database maintenance solution,
coupled with an appropriate re-indexing and backup
strategy.
• Back in the SQL Server 6.x days DBAs had to run the
DBCCs on a fairly regular basis to keep those minor
inconsistencies under control, before they became
major problems. However, SQL Server's storage engine
was reengineered for version 7.0.
DBCC CHECKALLOC
• The DBCC CHECKALLOC command checks
the consistency of the various internal
structures (allocation units, GAM pages, IAM
pages, IAM chains, SGAM pages, PFS pages)
that describe the allocations of pages and
extents within the database.
DBCC CHECKCATALOG
• The DBCC CHECKCATALOG command
checks the system catalog (system tables) of
a database.
• The DBCC CHECKCATALOG command also is
run during the execution of the DBCC
CHECKDB command.
DBCC CHECKCONSTRAINTS
• The DBCC CHECKCONSTRAINTS command
checks the table-level constraints in a
database.
• The DBCC CHECKCONSTRAINTS command
constructs and executes a query for all
FOREIGN KEY constraints and CHECK
constraints on a table.
DBCC CHECKDB
• The DBCC CHECKDB command checks the
logical and physical integrity of the
database.
DBCC CHECKFILEGROUP
• The DBCC CHECKFILEGROUP command
checks the allocation and structural integrity
of all tables (including nonclustered indexes
by default) and indexed views for a given file
group in the current database.
• The DBCC CHECKFILEGROUP command
effectively performs DBCC CHECKALLOC on
the specified file group and DBCC
CHECKTABLE on every table and indexed
view in the file group.
DBCC CHECKIDENT
• The DBCC CHECKIDENT command checks
the current identity value for a given table.
The command will reset the maximum value
of the identity column if the current identity
value is less than the table's current identity
maximum.
• You can also use the DBCC CHECKIDENT
command to set a new seed value for the
identity column.
DBCC CHECKTABLE
• The DBCC CHECKTABLE command checks
the integrity of all the pages and structures
of a table or indexed view.
DBCC CLEANTABLE
• The DBCC CLEANTABLE command is used to
reclaim space after a variable-length column
is dropped from a table.
DBCC DBREINDEX
• The DBCC DBREINDEX command is used to
rebuild the indexes of a table in a database.
• The DBCC DBREINDEX command will not run
against system tables.
DBCC DROPCLEANBUFFERS
• The DBCC DROPCLEANBUFFERS command
removes all buffers from the buffer pool
(SQL Server's data cache).
• It is predominantly used by database
developers to flush SQL Server's data cache
when testing TransacTransact-SQL query
performance.
DBCC FREEPROCCACHE
• The DBCC FREEPROCCACHE command frees
SQL Server's procedure cache (memory used
to store programming constructs such as
stored procedures, query plans, and so on).
• Although developers sometimes use the
DBCC FREEPROCCACHE command for
testing purposes, it is also a useful
command for DBAs because it causes all ad
hoc Transact-SQL statements (and
everything else of course) to be recompiled.
DBCC INDEXDEFRAG
• The DBCC INDEXDEFRAG command defragments the
leaf level of an index on a table or a view in a database
so that the physical order of the pages matches the
left-to-right logical order of the leaf pages.
• The DBCC INDEXDEFRAG command additionally
compacts the data pages and removes any freed-up
pages.
• This operation should improve the performance of
table scans and range queries (which typically perform
partial scans).
• When DBCC INDEXDEFRAG is run, index
defragmentation occurs serially.
DBCC SHOWCONTIG
• The DBCC SHOWCONTIG command shows the
degree of both internal and external fragmentation
for a table, index, or view.
• In a nutshell, internal fragmentation refers to how
much of each data page is being used in the table,
whereas external fragmentation refers to whether
the pages that make up the table are sequentially
located.
• External fragmentation is always bad. Internal
fragmentation is not necessarily bad.
DBCC SHRINKDATABASE
• The DBCC SHRINKDATABASE command
shrinks the size of the data and log files of a
database to a target percentage of free
space.
DBCC SHRINKFILE
• The DBCC SHRINKFILE command shrinks
the size of specific data or log files of a
database to a target size.
• Importantly, you can use the DBCC
SHRINKFILE command to shrink a file to a
size that is less than its initial size when it
was created.
• This resets the minimum file size to the new
value.
DBCC UPDATEUSAGE
• The DBCC UPDATEUSAGE command corrects the
database catalog (system tables of a database).
• The DBCC UPDATEUSAGE command specifically
updates inaccuracies in the data pages, leaf
pages, rows, reserved pages, and used pages of
the relevant catalog views (including
sys.allocation_units, sys.dm_db_partition_stats,
sys.indexes, and sys.partitions).
• These inaccuracies are typically seen in the output
of the sp_spaceused system stored procedure.
Summary
• This lesson alerts you to four new features of SQL Server
2008.
– You were introduced to Data-tier Applications, Policy
Management, Data Collections.
– The Resource Governor limits CPU and other system
assets according to your plan.
– Should a process slow the production server
unacceptably, you might find a solution to keeping user
response acceptable by slowing the responsible process.
– DBCC commands form the foundation of maintenance
activities. Plan to perform them on regularly occurring
schedules.
Summary for Certification Examination
• Some of these topics are so new they don’t
appear in the 70-432 certification check list.
Watch for changes.
• They will surely show up in the next iteration
of the Technical Specialist requirements.
• Focus on the most common “check” DBCCs.
Have an understanding of when to use each.