The Real MCTS SQL Server 2008 Exam 70-432 Prep Kit: Database Implementation and Maintenance
Copyright Page
Technical Editor
Lead Authors
Contributing Authors
Contents
Chapter 1: MCTS SQL Server 2008 Exam 432 New Features in SQL Server 2008
Introduction
A Word About the Test
New Feature Overview
Installation
Compressed Backups
Enhanced Configuration and Management of Audits
New Table Value Parameter
FileStream Data Types
Sparse Column Support
Encryption Enhancements
Key Management and Encryption
High Availability
Performance
Performance Data Management
Resource Governor (similar to Query Governor)
Freeze Plan
SQL Server 2008 Declarative Management Framework
Development Improvements
LINQ Support
MERGE Statement
Spatial Data Type
Analysis Services Improvements
ETL/SSIS Enhancements
Reporting Services
No Longer Requires IIS
Better Graphing
Export to Word Support
Deprecated Features
Discontinued Features
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 2: MCTS SQL Server 2008 Exam 432 Installing SQL Server 2008
Introduction
SQL Versions, Requirements, Features, and Differences
Planning Your Installation
Upgrade Tools
Hardware Requirements: CPU, Memory, and Disk
Operating System Requirements
Software Requirements
Establishing Service Accounts
Upgrading vs. Side-by-Side Installation
Clustered Installation Considerations
Unattended Installations
Post-Upgrade Activity
Database Instances, Files, Locations, Filegroups, and Performance
Binary File Locations
Filegroups
Disk Planning Best Practices
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 3: MCTS SQL Server 2008 Exam 432 Configuring SQL Server 2008
Introduction
Instances vs. Default Instance
Instance Limitations
Performance Considerations
SQL Server Configuration Manager
Managing Services
Enabling FileStream
Managing Connections and Protocols
Shared Memory
Named Pipes
VIA
TCP/IP
Changing the TCP Port
Aliases
sp_configure and SQL Server Management Studio
Advanced Options
AWE
Setting the Maximum and Minimum Memory for SQL Server
Max Server Memory (MB)
Min Server Memory (MB)
Maximum Degree of Parallelism
Security Certifications
C2 Auditing
Common Criteria Compliance
New Features
Backup Compression Default
FileStream Access Level
Database Mail
Configuring Database Mail
Full-Text Indexing
Configuring Full-Text Indexing
Managing Full-Text Indexes
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 4: MCTS SQL Server 2008 Exam 432 Managing Security
Introduction
Principals
Roles
The “Principle of Least Privilege”
Users
Schemas
Users versus Logins
Authentication Mode
Permissions
Cross-Database Ownership Chaining
Object Permissions
Log-in Permissions (As Related to Roles)
Auditing
Change Data Capture (CDC)
Using DDL Triggers
The SQL Server Configuration Manager
Security and SQL Agent
Service Accounts and Permissions
Domain Service Accounts versus Local Service Accounts
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 5: MCTS SQL Server 2008 Exam 432 Managing Data Encryption
Introduction
Understanding Transparent Data Encryption
Requirements
Enabling TDE
How Data Is Encrypted
Encryption Keys
Key Management
Database Encryption Keys
Best Practices for Managing Database Keys
Cell- and Column-Level Encryption
EFS Encryption (Through the Operating System)
EFS in a Clustered Environment
Restoring Encrypted Backups to Another Server or Instance
Third-Party Encryption Tools
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 6: MCTS SQL Server 2008 Exam 432 Managing High Availability
Introduction
Defining High Availability
SQL High-Availability Options
Log Shipping
Mirroring
Clustering
Special Hardware Requirements
Special Software Requirements
Geo-Clustering
Replication
Recovery Model
Expandability
Hot Add CPU
Hot Add Memory
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 7: MCTS SQL Server 2008 Exam 432 Maintaining Your Database
Introduction
Understanding Data Collation
SQL Server Collations
Binary Collations
Using Collations
Collation Considerations for Backup and Restore
Maintaining Data Files
Implementing Data Compression
Row versus Page Compression
Estimating Space Savings Using sp_estimate_data_compression_savings
Using Sparse Columns
Maintaining Indexes
DBCC Explained
Using DBCC CHECKTABLE to Verify Table Integrity
Using the DBCC CHECKDB to Verify Database Integrity
Using the DBCC SHRINKFILE Option to Reclaim Database Space
Backing Up and Restoring Data
Understanding Database Recovery Models
Backup Types
Choosing a Database Backup Strategy
Restoring Databases
Performing Online Restore
Restoring Individual Pages
Performing Ongoing Maintenance
Using SQL Server Agent
Using Database Maintenance Plans
Policy-Based Management
Examples of Using Policy-Based Management
Using the Data Collector to Collect Performance Data
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 8: MCTS SQL Server 2008 Exam 432 ETL Techniques
Introduction
Understanding ETL
Bulk Copying Data
Using BCP
Using BCP Data File Types
Using Format Files
Using the BULK INSERT Statement
Recovery Model and Bulk Operations
Optimizing Bulk Load Performance
Distributed Queries
Understanding Fully Qualified Object Names
Enabling Ad Hoc Distributed Queries
Using the OPENROWSET Function
Querying Data with OPENROWSET
Modifying Data with OPENROWSET
Copying Data with OPENROWSET
Using OPENROWSET (BULK,…)
Using the OPENDATASOURCE Function
Using Linked Servers
Using the OPENQUERY Function
Using Distributed Transactions
SQL Server Integration Services
Creating SSIS Packages
Using the Copy Database Wizard
Using the Import and Export Wizard
Using Business Intelligence Development Studio
Using Package Configurations
Managing SSIS
Understanding SSIS Package Storage
Deploying SSIS Packages
Securing SSIS Packages
Using Package Protection Levels
MSDB Database Roles and SSIS Package Roles
Executing SSIS Packages
Logging Package Execution
Alternative ETL Solutions
Coding Solutions
Third-Party Solutions
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 9: MCTS SQL Server 2008 Exam 432 Managing Replication
Introduction
Replication Scenarios
Article
Publication
Subscription
Publisher
Distributor
Subscriber
Replication Types
Snapshot
Components
Transactional
Components
Updatable Subscription
Peer-to-Peer Replication
Merge
Components
Replication Configuration
Configuration of Distributor
Configuration of Publisher
Configuration of Subscriber(s)
Configuration of Peer-to-Peer Replication
Conflict Resolution
Conflict Resolution Mechanism in Peer-to-Peer Replication
DDL Replication
Security Considerations
Snapshot Agent
Connect to Publisher
Replication Performance
Monitoring
Replication Monitor
Tracer Tokens
Alerts
Performance Monitor
Replication Agents
Replication Distribution
Replication Logread
Replication Merge
Replication Snapshot
DMVs
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 10: MCTS SQL Server 2008 Exam 432 Monitoring and Troubleshooting
Introduction
Service Troubleshooting
Concurrency Issues
Agent Issues
Error Logs
Windows Event Log
SQL Server Log
SQL Server Profiler
Performance Monitor
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 11: MCTS SQL Server 2008 Exam 432 SQL Server XML Support
Introduction
Working with XML Data
Understanding XML Indexing
HTTP Endpoints
Http Endpoints Defined
Endpoint Can Interface to a Stored Procedure
How to Create the Endpoint
Web Services
XQuery Explained
XPath
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 12: MCTS SQL Server 2008 Exam 432 Service Broker
Introduction
The Queuing Concept Explained
Service Broker Defined
Message Types
Contracts
Queues
Services
Endpoints
Routes
Sending a Message
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 13: MCTS SQL Server 2008 Exam 432 Performance Tuning
Introduction
Tracing
Trace Templates
Trace Events
Trace Filters
Server-Side Tracing
Combining System Monitor and Profiler Traces
Replaying Traces
Using SQLDiag to Collect Performance Data
Locks, Blocking, and Deadlocks
Locking
Blocking
Deadlocks
Transaction Isolation Levels
Lock Escalation
Lock Compatibility
Detecting and Resolving Locking Problems
Guide to the DYNAMIC Management Views (DMVs)
Partitioning
Horizontal Partitioning
Vertical Partitioning
Filegroups
Selecting a Partition Key and Number of Partitions
Partition Function
Partition Scheme
Moving Data between Partitions
Performance Data Collection
Performance Data Collection Explained
Management Data Warehouse
Configuring MDW
Configuring Data Collection
Data Collection Caching
Management Data Warehouse Reports
Resource Governor
Resource Governor Concepts
Resource Pools
Workload Groups
Classification Function
Validate Configuration
Resource Governor Summary
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Chapter 14: MCTS SQL Server 2008 Exam 432 Implementing Objects
Introduction
Understanding DDL and DML Language Elements
Working with Tables and Views
Creating Tables
Creating User-Defined Data Types
Working with Constraints
Creating Indexes
Working with Full-Text Indexes
Viewing and Modifying Data
Creating Views
Creating Stored Procedures
Creating Functions
Creating Triggers
Summary of Exam Objectives
Exam Objectives Fast Track
Exam Objectives Frequently Asked Questions
Self Test
Self Test Quick Answer Key
Index
Appendix: The Real MCTS SQL Server 2008 Exam 432 Self Test
Appendix
Chapter 1: New Features in SQL Server 2008
Chapter 2: Installing SQL Server 2008
Chapter 3: Configuring SQL Server 2008
Chapter 4: Managing Security
Chapter 5: Managing Data Encryption
Chapter 6: Managing High Availability
Chapter 7: Maintaining Your Database
Chapter 8: ETL Techniques
Chapter 9: Managing Replication
Chapter 10: Monitoring and Troubleshooting
Chapter 11: SQL Server XML Support
Chapter 12: Service Broker
Chapter 13: Performance Tuning
Chapter 14: Implementing Objects
Nội dung
602 Chapter13•PerformanceTuning DMVs can be server-scoped or database-scoped reflecting the data tracked Ü within the DMV. DMVs run continually in the background with a very low overhead, data Ü provided is either cumulative (since last service restart) or a snapshot view. Partitioning Partitioning can be used to split a large table into a series of smaller tables Ü transparent to the application. Horizontal partitioning can be used to split a table into several smaller Ü tables with all columns and a smaller number of rows (often by date). Vertical partitioning divides a large table into several smaller tables each Ü with all rows, but a subset of columns. Performance Data Collection (Data Collector) The Performance Data Collection allows collection of performance data Ü from a number of servers to a central data warehouse for analysis and reporting. Performance data is stored in the Management Data Warehouse (MDW) Ü which is a relational database intended to be an organization-wide reposi- tory for performance data. Data collection is the process of harvesting performance data from target Ü servers to store in the MDW. Resource Governor Resource Governor provides capability to identify inbound connections to Ü SQL Server and provide these connections with minimum and maximum resource (Memory, CPU) allocation. Resource pools are used to control physical server resources, while work- Ü load groups map users groups to resource pools the classifier functions are used to assign users to workload groups. The Dedicated Admin Connection (DAC) is not subject to the resource Ü governor. Performance Tuning • Chapter 13 603 Exam Objectives Frequently Asked Questions Q: What’s happening when SQL Profiler reports missing events? A: This happens occasionally with very busy servers when tracing to a table or to SQL Profiler. In this situation the SQL Profiler tool is unable to keep up with the volume of events that are generated. Consider using a server side trace and saving the trace to a flat file, local to the database server. Q: How big will the trace file grow? A: The size of trace files is determined by the workload, events, and columns included in the trace definition. A very busy server with only a few events defined can produce a file as large as a quiet server with many events included. Be sure to monitor the growth of trace files to ensure they don’t fill any drives, and if you’re leaving a trace unattended (e.g., overnight) ensure there is plenty of disk space to include activities such as nightly maintenance or data loads. 604 Chapter13•PerformanceTuning Self Test 1. You’re the DBA for a sales and marketing organization that has a high rate of data change (lots of INSERTS and DELETES). Over the past few weeks the SQL server has gradually become slower. Which DMV could help identify the cause? A. Sys.dm_os_schedulers B. Sys.dm_os_slow_tasks C. Sys.dm_db_index_physical_stats D. Sys.dm_exec_requests 2. Which of the following could be used within a function by Resource Governor to classify incoming sessions? A. IP Address B. Username C. Server Role Membership D. Hostname 3. You’ve recently enabled Resource Governor to ensure the Finance and HR departments each receive a fair share of CPU and memory on a consolidated SQL Server. Since Resource Governor has been operating, some users have experienced connection timeouts and you suspect the classifier function may be the cause. How could you identify the cause? A. Run SQL Profiler B. Connect using Dedicated Admin Connection C. Capture Performance Monitor data D. Reboot the server and see if problem recurs 4. You’re troubleshooting a slow running problem and you’d like to see which indexes, if any, are being used by the slow query. You’re configuring a SQL profiler trace. Which events should you include to see the actual execution plan in XML? A. Showplan XML Statistics Profile B. SQL:BatchCompleted C. Showplan XML D. RPC:Completed PerformanceTuning•Chapter13 605 5. Users complain that the database server is slow to respond or causes timeouts, and you’ve been running a server-side trace capturing details of query perfor- mance. The server is busy and you’ve generated 10 × 1 GB trace files. What’s the best way to find queries with the longest duration? A. Open each trace file in Profiler and find longest duration. B. Open the trace in Excel and sort by duration. C. Use fn_trace_gettable to load the data into a table, analyze with TSQL queries. D. Run the trace again with a filter. 6. You’re responsible for maintenance for a mission-critical database that is 650 GB in size, with a particularly large sales order table. The nightly index maintenance scripts are fully optimized but regularly run longer than the maintenance window. How could you resolve this with minimal impact to the business? A. Delete old data from the sales order table. B. Separate sales data into separate databases, one for each calendar year. C. Don’t carry out index maintenance. D. Implement table partitioning. 7. You’re responsible for managing a database that uses table partitioning for a stock trading firm. Performance on the partition storing most recent trades has started to degrade and you’d like to begin a new partition. Which statement should you use? A. ALTER PARTION FUNCTION… SPLIT B. ALTER TABLE … SWITCH C. ALTER TABLE … SPLIT D. Denormalize the table to 5th Normal Form 8. When a new SQL Server session is started that meets none of the criteria defined in the Classifier function, to which resource pool is the session assigned? A. Internal B. Default C. Custom-1 D. None 606 Chapter13•PerformanceTuning 9. You’re the Administrator for a SQL Server used by a number of departments within your organization. At the end of each month the Accounts department runs a number of reports that calculate complex ratios and analytics. During this time other users frequently receive timeouts and poor performance. What’s the best solution to limit the impact of these CPU-intensive reports run by Accounts? A. Implement table partitioning. B. Separate data and log files. C. Use Resource Governor. D. Request Accounting users run reports only at night. 10. You’re a Systems Engineer responsible for SQL Server, and a case had been escalated via the helpdesk where a user reported an exception in an applica- tion—the error included deadlock victim. You’d like to implement monitoring to capture details of the deadlocked processes and locks held with minimum overhead. Should you: A. Start a SQL Profiler Trace. B. Capture Lock\Deadlocks per second with Windows System Monitor. C. Enable trace flag 1222. D. Review the sys.dm_tran_locks DMV. 11. A developer is using locking hints within a stored procedure and has some questions about lock escalation. You describe lock escalation as the time when SQL Server: A. Changes down from table locks to row locks. B. Changes from SHARED to UPDATE locks. C. Changes up from row lock to table locks. D. Changes from an UPDATE lock to EXCLUSIVE lock. 12. You’re working with an external vendor on a patch to their application. They’ve applied the patch to the test environment and would like to simulate some production-like workload to assess the success of the patch. You’ve decided to capture a SQL trace. Which trace template will you use? A. TSQL_Replay B. Tuning . with the volume of events that are generated. Consider using a server side trace and saving the trace to a flat file, local to the database server. Q: How big will the trace file grow? A: The. Denormalize the table to 5th Normal Form 8. When a new SQL Server session is started that meets none of the criteria defined in the Classifier function, to which resource pool is the session. vendor on a patch to their application. They’ve applied the patch to the test environment and would like to simulate some production-like workload to assess the success of the patch. You’ve decided