Policy-Based Management is a new feature of SQL Server 2008 that allows Ü Ü you to create and apply policies to multiple target servers or database objects.. Performance Data Collection
Trang 1Performing Ongoing Maintenance
SQL Server Agent is a service that can create multi step jobs, notification
Ü
Ü
alerts, and notify operators by e-mail, pager or NET SEND command
SQL Server Agent service must be running for jobs and alerts to execute
Ü
Ü
It is also key to system functionality like replication, Policy-Based
Management and data collector
The Database Maintenance Plan wizard allows sysadmins to create, modify,
Ü
Ü
schedule and run customized maintenance plans A Maintenance Plan is a
sequence of ongoing maintenance tasks like rebuilding indexes, validate
databases, and perform backup
Policy-Based Management is a new feature of SQL Server 2008 that allows
Ü
Ü
you to create and apply policies to multiple target servers or database
objects A policy consists of a set of conditions that must be met by the
object for it to be compliant with the policy Objects that do not comply
with the policy are reported to you when the policy is evaluated
Policies can be evaluated manually or automatically This is known as “on
Ü
Ü
demand”, “on change: prevent”, “on change: log only” and “on schedule”
policy evaluation modes These modes are used to check whether the
target complies with the policy, and possibly prevent a change that will
cause the object to become noncompliant The “on change: prevent” and
“on change: log only” policies are enforced using recursive DDL triggers
The “on schedule” evaluation is performed using SQL Server Agent
Performance Data Collection
The Data Collector is a feature of SQL Server 2008 that allows you to
Ü
Ü
systematically collect data from various sources and store it in a data
warehouse
The Data Collector can be used to collect performance data, but it is not
Ü
Ü
limited to this use
The Data Collector uses SQL Agent jobs to collect data, and SQL Agent
Ü
Ü
must be running for the Data Collector to work
SQL Server Reporting Services reports are created on collected data
Ü
Ü
Built-in reports are available, or you can create custom reports
Trang 2Exam Objectives
Frequently Asked Questions
Q: What happens to the database collation when a database is restored from backup
to a server that has a different data collation?
A: The database collation remains as it was on the source server
Q: How do I change collation settings at column and database level once they have been assigned?
A: Use ALTER TABLE and ALTER DATABASE statements with the COLLATE clause Unfortunately, there are many restrictions preventing this operation
Q: What happens when I join two tables, but the join keys have different
collations?
A: You will receive an error message similar to ‘Cannot resolve collation conflict between ‘Latin1_General_CS_AS’ and ‘Greek_CI_AS’ in equal to operation.’
Q: Which is more efficient: row-level compression or page-level compression?
A: Page-level compression results in more efficient disk space usage as it enables row-level compression, prefix compression, and dictionary compression
However, page-level compression also results in higher performance overhead
Q: Can I create a column set on the entire table and update each row as an
XML fragment?
A: No, because column sets are defined on sparse columns and the primary key column cannot be marked as sparse You must always have a primary key
column in a table
Q: Is the Fill Factor of an index automatically maintained by SQL Server?
A: No, the Fill Factor is only an initial setting This is why you must rebuild your indexes as an ongoing task
Q: What is the overhead of Policy-Based Management on my SQL Server?
A: Unless the policy is currently being evaluated, there is no overhead on SQL Server Two exceptions are the “On Change: Prevent” and “On Change: Log
Trang 3Only” evaluation modes These modes use DDL Triggers, which execute to
perform a check every time an object in the policy’s target set is altered
This results in some overhead
Q: Can you manage earlier versions of SQL Server using Policy-Based
Management?
A: Yes, except not all settings are applicable to all versions of SQL Server
Q: When a SQL Server Agent job executes, what credentials are used?
A: The credentials used are those of the SQL Server Agent service account, unless
a proxy is explicitly configured or the statement is performing custom
imper-sonation
Q: Is it better to create Maintenance Plans or individual SQL Server Agent jobs to
perform my routine management and maintenance tasks?
A: It is recommended that you use Maintenance Plans because they are easier to
view and edit Additionally, the Maintenance Plan Wizard will not let you
misconfigure a task, which cannot be said for complicated homegrown
Transact-SQL scripts
Q: Differential and log backups both record changes from the last full backup, so
what is the difference between them?
A: The difference between these backup types is in the way changes are backed up
The differential backup records all database extents that have changed since the
last backup When a differential backup is restored, all changes must be restored
as there is no order or sequence of data changes This makes the differential
backup faster to restore than a log backup Log backups record transactions in
sequence Replaying the log means redoing all transactions recorded in it This is
a time consuming operation, but it does allow you to roll forward to a
point-in-time, provided all sequential log file backups are available
Q: I am missing a log file backup from the middle of a log sequence Is it possible
to restore all the other logs I have and roll the database forward, losing only the
transactions recorded in the lost log?
A: No, logs can only be restored in sequence In this case, you can only roll the
database forward to the point of the lost log
Trang 4Q: How often should I back up the Master database?
A: The Master database stores much of the server configuration information including security settings, database configuration, and logins You should back it
up regularly in the live environment The exact frequency depends on your organization’s tolerance for loss of configuration data and how often this config-uration changes
Q: I have configured the performance Data Collector, but it has collected no data Why?
A: The most likely reason that the Data Collector is not collecting data is that the SQL Agent is not running The Data Collector uses SQL Agent jobs to perform data collection
Trang 5Self Test
1 You have a large centralized line of business database used by hundreds of users all around the world One of the key tables is the Orders table This table is
frequently updated and frequently searched A nonclustered index named
IX_Orders_CustomerID exists on the Orders table, CustomerID column
Recently your company has experienced record sales, and many new
customers have been added You have received several user reports of degraded
performance when trying to search for orders by a specific customer After
running some diagnostics, you are convinced that the reason for the performance degradation is index fragmentation You wish to resolve the problem for your
users, but, due to the 24-hour nature of your business, you are not allowed to
take the index offline Additionally, you wish to be able to interrupt reindexing
operations without losing progress, in case the maintenance operation affects
performance severely while it is running What is the best way to resolve the
problem while meeting your objectives?
A Run ALTER INDEX _Orders_CustomerID ON Orders.CustomerID
REBUILD
B Run ALTER INDEX IX_Orders_CustomerID ON Orders.CustomerID
REORGANIZE
C Run CREATE INDEX IX_Orders_CustomerID ON Orders
CustomerID WITH DROP EXISTING
D Run DBCC INDEXDEFRAG (LOBDatabase, “Orders”, IX_Orders_
CustomerID)
2 You have recently removed a lot of historical data from your SQL Server 2008
database named HR by archiving it to a different server However, you notice
that the disk space consumed by the database file remains unchanged and the
.MDF file is taking up the majority of space on the drive How can you
decrease the size of the database file?
A Run DBCC CHECKDB (‘HR’, REPAIR_ALLOW_DATA_LOSS)
B Run DBCC SHRINKFILE (‘HR_Data’, TRUNCATEONLY)
C Run DBCC SHRINKFILE (‘HR_Data’, NOTRUNCATE)
D Use the Copy Database Wizard to copy the database, then delete the
original database Finally, rename the new database you have just copied
to the same name as the original database