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
372 Chapter8•ETLTechniques Lookup Can perform lookups on data. For example, the source might have only the ProductID, but the destination needs the ProductName. You could perform a lookup against a table that has both values to capture the required ProductName and include it. Merge Performs a union operation on two inputs to create a single set of data to send to a destination. Developers can debug and run their packages from their own workstations using BIDS. Once they have the packages developed and functioning, they can create a deployment utility that administrators can use to deploy those packages to the production server. We’ll discuss the deployment wizard later in this chapter. First, let’s discuss Package Configurations, a feature that allows administrators to reconfigure packages in the production environment. EXERCISE 8.8 oP E n i n g a Pa C k a g E in BIDS In this exercise, you will use BIDS to open the package you created in Exercise 8.7 using the Import and Export Wizard. This exercise assumes that you have administrative privileges on the SQL Server instance that you are working with, that you have the AdventureWorks2008 sample database installed on your SQL Server instance, that BIDS is installed, and that you are running the exercise from the same computer where the SQL Server instance is installed. 1. Start BIDS by clicking the Start menu | Microsoft SQL Server 2008 | SQL Server Business Intelligence Development Studio. 2. In the BIDS menu bar select File | New | Project…. 3. In the Project Types list on the left select Business Intelligence Projects and then in the Templates list, select Integration Services Project. Enter BIDS Practice as the Name:. Leave everything else at the default values and click OK. 4. If the Solution Explorer window is not open, from the menu bar select View | Solution Explorer. 5. In the Solution Explorer window right click the SSIS Packages folder and select Add Existing Package. 6. In the Add Copy of Existing Package window, complete the fields as follows and click OK. ETL Techniques • Chapter 8 373 ■ Package Location SQL Server ■ Server (local) ■ Authentication Type Windows Authentication ■ Package Path /Export Product Data 7. In the Solution Explorer double click the Export Product Data.dtsx package to open the package designer. 8. Switch between the Control Flow and Data Flow tabs to view the package contents. Select items and view their properties in the properties window. When you are done, close BIDS. Using Package Configurations Developers build the SSIS packages on their workstations. Therefore, the paths to data files, the connection information to the development servers, and any number of other settings often can be significantly different from those that are needed when the package runs in production. Developers can facilitate the simple management of this problem by implementing package configurations. Package configurations make it possible for the SSIS runtime to dynamically read alternative values for these properties and use the new values rather than the values that are hardcoded in the package. The package configuration values can be saved in XML Files, SQL Tables, environment variables, and registry settings. By working with the developers, administrators can easily reconfigure packages to work correctly in production environments without have to open and edit the packages themselves. Ideally, developers will design and configure the package configurations as part of the package development process. However, even if developers did not facilitate package configurations, you can manually override almost any property in a package when using the various execution utilities. Ex a m Wa r n i n g Remember that package configurations allow you to change the definition of a package’s connections, variable values, and so on. If a package that ran in development is having problems working in a production environment, package configurations may well be the answer! 374 Chapter8•ETLTechniques Managing SSIS SSIS actually includes a Windows service named SQL Server Integration Services 10.0. This service is responsible for managing the storage of SSIS packages on the server, enforcing the security of those packages, and managing the packages while they are running. The SSIS Service is a shared instance; that is, even if you install multiple instances of SQL Server on a single computer, there will be only a single SQL Server Integration Services 10.0 instance. To manage the SQL Server Integration Services instance, you can connect to it in SQL Server Management Studio using the Object Explorer. To connect to the SSIS Instance, you can use the Connect drop down in the Object Explorer window and select Integration Services…. Once you have connected, the Object Explorer shows a tree view of any packages that are currently running, as well as a tree view of the SSIS file system and MSDB storage. Figure 8.6 shows you how to connect to an Integration Services instance using the Object Explorer. Figure 8.6 Connecting Object Explorer to an SSIS Instance Once you select the option, you will be prompted with a standard connect dialog box. Notice that the only option you can change in the connect dialog box is the Server name:. You can connect to an SSIS instance only by using Windows Authentication. Once you have connected, the Object Explorer allows you to interact with the SSIS instance by managing both running as well as stored packages. Figure 8.7 shows the Object Explorer when it is connected to an SSIS instance. ETLTechniques•Chapter8 375 We showed you before that an SSIS package is actually an XML file. And after reading about BIDS, you know that the package files themselves can actually exist on a developer’s workstation when they are being created. Once developers have completed a package (or a set of packages), they need to get them deployed to the server where the SQL Server Integration Services service is installed for execution. There are actually a number of choices for how a package should be stored. Figure 8.7 shows two containers under the Stored Packages folder. You could store packages as files in the File System, or as records in the MSDB database on a SQL Server. As you can see from Figure 8.7, SSIS can access packages in both storage areas. We’ll discuss your storage options in the next section. Understanding SSIS Package Storage Where a package is saved, or stored, really doesn’t have anything to do with where it is used or executed. An analogy would be that it doesn’t matter where you save a Word document; as long as you can get to it across the network, you can open and use it from anywhere. The idea is the same with a package. Where you store a package impacts where it lives only when the package isn’t being used. Typically, however, you will store the packages physically on the same server where they will be run. When developers are done building a package, they either deploy them to a production server themselves (not recommended) or the give them to an adminis- trator for deployment to the production server (better). Regardless, when you “deploy” a package, you are really just copying the package to either the file system or to the SQL Server MSDB database on the target system. Figure 8.7 Working with SSIS in Object Explorer 376 Chapter8•ETLTechniques SSIS supports storing packages as files in the file system or as records in SQL Server. When you deploy packages to the file system on a server, they should go to C:\Program Files\Microsoft SQL Server\100\DTS\Packages by default. When you deploy them to SQL Server, they end up in the msdb.dbo.sysssispackages table. It is typically recommended that you store the packages into SQL Server rather than to the file system. There are some benefits to this that we will discuss throughout this section. When the packages are deployed to a server where the SQL Server Integration Services service is running, it can broker access to the local storage through what is called the SSIS Package Storage. It ends up being the same file system and MSDB locations as if you were to deploy them there directly yourselves, but it formalizes access to them through the SSIS service. Deploying SSIS Packages There are a number of ways that you can deploy packages to your servers. Table 8.5 explains the common deployment mechanisms: Tool Description Deployment Wizard Developers can use a feature of BIDS to produce what is called a deployment utility. The deployment utility produces a file with the SSISDeploymentManifest extension in the same directory as the package files and configuration files extension. The developer can zip the file up and send it to the administrator. The administrator simply double clicks the SSISDeploymentManifest file and follows the prompts. If the packages were designed with configurations, the deployment wizard even allows the administrator to provide the alternative configuration values as part of the deployment. Object Explorer In SQL Server Management Studio’s Object Explorer, you can connect directly to an Instance of the SQL Server Integration Services Instance. From there, you can import and export packages from the SSIS Package Store on the server simply by right clicking an item and choosing either Import Package… or Export Package… Table 8.5 SSIS Package Deployment Tools Continued . that you are running the exercise from the same computer where the SQL Server instance is installed. 1. Start BIDS by clicking the Start menu | Microsoft SQL Server 2008 | SQL Server Business Intelligence. in SQL Server. When you deploy packages to the file system on a server, they should go to C:Program FilesMicrosoft SQL Server 100DTSPackages by default. When you deploy them to SQL Server, . you will store the packages physically on the same server where they will be run. When developers are done building a package, they either deploy them to a production server themselves (not