What’s New in SQL Server System and Database Administration
System Administrator Responsibilities
System Databases
System Tables
System Views
System Stored Procedures
Summary
8 Installing SQL Server 2008
What’s New in Installing SQL Server 2008
Installation Requirements
Installation Walkthrough
Installing SQL Server Using a Configuration File
Installing Service Packs and Cumulative Updates
Slipstream Installations
Summary
9 Upgrading to SQL Server 2008
What’s New in Upgrading SQL Server
Using the SQL Server Upgrade Advisor (UA)
Destination: SQL Server 2008 or SQL Server 2008 R2
Upgrading Using a Configuration File
Slipstreaming Upgrades
Upgrading Other SQL Server Components
Summary
10 Client Installation and Configuration
What’s New in Client Installation and Configuration
Client/Server Networking Considerations
Client Installation
Client Configuration
Client Data Access Technologies
Summary
11 Security and User Administration
What’s New in Security and User Administration
An Overview of SQL Server Security
Authentication Methods
Managing Principals
Managing Securables
Managing Permissions
Managing SQL Server Logins
Managing SQL Server Users
Managing Database Roles
Managing SQL Server Permissions
The Execution Context
Summary
12 Data Encryption
What’s New in Data Encryption
An Overview of Data Security
An Overview of Data Encryption
SQL Server Key Management
Column-Level Encryption
Transparent Data Encryption
Column-Level Encryption Versus Transparent Data Encryption
Summary
13 Security and Compliance
Exposure and Risk
Across the Life Cycle
The Security Big Picture
Identity Access Management Components
Compliance and SQL Server
SQL Server Auditing
Setting Up Auditing via T-SQL
SQL Injection Is Easy to Do
Summary
14 Database Backup and Restore
What’s New in Database Backup and Restore
Developing a Backup and Restore Plan
Types of Backups
Recovery Models
Backup Devices
Backing Up a Database
Backing Up the Transaction Log
Backup Scenarios
Restoring Databases and Transaction Logs
Restore Scenarios
Additional Backup Considerations
Summary
15 Database Mail
What’s New in Database Mail
Setting Up Database Mail
Sending and Receiving with Database Mail
Using SQL Server Agent Mail
Related Views and Procedures
Summary
16 SQL Server Scheduling and Notification
What’s New in Scheduling and Notification
Configuring the SQL Server Agent
Viewing the SQL Server Agent Error Log
SQL Server Agent Security
Managing Operators
Managing Jobs
Managing Alerts
Scripting Jobs and Alerts
Multiserver Job Management
Event Forwarding
Summary
17 Administering SQL Server 2008 with PowerShell
What’s New with PowerShell
Overview of PowerShell
PowerShell Scripting Basics
PowerShell in SQL Server 2008
Step-By-Step Examples
Summary
18 SQL Server High Availability
What’s New in High Availability
What Is High Availability?
The Fundamentals of HA
Building Solutions with One or More HA Options
Other HA Techniques That Yield Great Results
High Availability from the Windows Server Family Side
Summary
19 Replication
What’s New in Data Replication
What Is Replication?
The Publisher, Distributor, and Subscriber Magazine Metaphor
Replication Scenarios
Subscriptions
Replication Agents
Planning for SQL Server Data Replication
SQL Server Replication Types
Basing the Replication Design on User Requirements
Setting Up Replication
Scripting Replication
Monitoring Replication
Summary
20 Database Mirroring
What’s New in Database Mirroring
What Is Database Mirroring?
Roles of the Database Mirroring Configuration
Setting Up and Configuring Database Mirroring
Testing Failover from the Principal to the Mirror
Client Setup and Configuration for Database Mirroring
Migrate to Database Mirroring 2008 as Fast as You Can
Using Replication and Database Mirroring Together
Using Database Snapshots from a Mirror for Reporting
Summary
21 SQL Server Clustering
What’s New in SQL Server Clustering
How Microsoft SQL Server Clustering Works
Installing SQL Server Clustering
Summary
22 Administering Policy-Based Management
Introduction to Policy-Based Management
Policy-Based Management Concepts
Implementing Policy-Based Management
Sample Templates and Real-World Examples
Policy-Based Management Best Practices
Summary
Part IV: Database Administration
23 Creating and Managing Databases
What’s New in Creating and Managing Databases
Data Storage in SQL Server
Database Files
Creating Databases
Setting Database Options
Managing Databases
Summary
24 Creating and Managing Tables
What’s New in SQL Server 2008
Creating Tables
Defining Columns
Defining Table Location
Defining Table Constraints
Modifying Tables
Dropping Tables
Using Partitioned Tables
Creating Temporary Tables
Summary
25 Creating and Managing Indexes
What’s New in Creating and Managing Indexes
Types of Indexes
Creating Indexes
Managing Indexes
Dropping Indexes
Online Indexing Operations
Indexes on Views
Summary
26 Implementing Data Integrity
What’s New in Data Integrity
Types of Data Integrity
Enforcing Data Integrity
Using Constraints
Rules
Defaults
Summary
27 Creating and Managing Views in SQL Server
What’s New in Creating and Managing Views
Definition of Views
Using Views
Creating Views
Managing Views
Data Modifications and Views
Partitioned Views
Indexed Views
Summary
28 Creating and Managing Stored Procedures
What’s New in Creating and Managing Stored Procedures
Advantages of Stored Procedures
Creating Stored Procedures
Executing Stored Procedures
Deferred Name Resolution
Viewing Stored Procedures
Modifying Stored Procedures
Using Input Parameters
Using Output Parameters
Returning Procedure Status
Debugging Stored Procedures Using SQL Server Management Studio
Using System Stored Procedures
Startup Procedures
Summary
29 Creating and Managing User-Defined Functions
What’s New in SQL Server 2008
Why Use User-Defined Functions?
Types of User-Defined Functions
Creating and Managing User-Defined Functions
Rewriting Stored Procedures as Functions
Creating and Using CLR Functions
Summary
30 Creating and Managing Triggers
What’s New in Creating and Managing Triggers
Using DML Triggers
Using DDL Triggers
Using CLR Triggers
Using Nested Triggers
Using Recursive Triggers
Summary
31 Transaction Management and the Transaction Log
What’s New in Transaction Management
What Is a Transaction?
How SQL Server Manages Transactions
Defining Transactions
Transactions and Batches
Transactions and Stored Procedures
Transactions and Triggers
Transactions and Locking
Coding Effective Transactions
Transaction Logging and the Recovery Process
Long-Running Transactions
Bound Connections
Distributed Transactions
Summary
32 Database Snapshots
What’s New with Database Snapshots
What Are Database Snapshots?
Limitations and Restrictions of Database Snapshots
Copy-on-Write Technology
When to Use Database Snapshots
Setup and Breakdown of a Database Snapshot
Reverting to a Database Snapshot for Recovery
Setting Up Snapshots Against a Database Mirror
Database Snapshots Maintenance and Security Considerations
Summary
33 Database Maintenance
What’s New in Database Maintenance
The Maintenance Plan Wizard
Managing Maintenance Plans Without the Wizard
Executing a Maintenance Plan
Maintenance Without a Maintenance Plan
Database Maintenance Policies
Summary
Part V: SQL Server Performance and Optimization
34 Data Structures, Indexes, and Performance
What’s New for Data Structures, Indexes, and Performance
Understanding Data Structures
Database Files and Filegroups
Database Pages
Space Allocation Structures
Data Compression
Understanding Table Structures
Understanding Index Structures
Data Modification and Performance
Index Utilization
Index Selection
Evaluating Index Usefulness
Index Statistics
SQL Server Index Maintenance
Index Design Guidelines
Indexed Views
Indexes on Computed Columns
Filtered Indexes and Statistics
Choosing Indexes: Query Versus Update Performance
Identifying Missing Indexes
Identifying Unused Indexes
Summary
35 Understanding Query Optimization
What’s New in Query Optimization
What Is the Query Optimizer?
Query Compilation and Optimization
Query Analysis
Row Estimation and Index Selection
Join Selection
Execution Plan Selection
Query Plan Caching
Other Query Processing Strategies
Parallel Query Processing
Common Query Optimization Problems
Managing the Optimizer
Summary
36 Query Analysis
What’s New in Query Analysis
Query Analysis in SSMS
SSMS Client Statistics
Using the SET SHOWPLAN Options
Using sys.dm_exec_query_plan
Query Statistics
Query Analysis with SQL Server Profiler
Summary
37 Locking and Performance
What’s New in Locking and Performance
The Need for Locking
Transaction Isolation Levels in SQL Server
The Lock Manager
Monitoring Lock Activity in SQL Server
SQL Server Lock Types
SQL Server Lock Granularity
Lock Compatibility
Locking Contention and Deadlocks
Table Hints for Locking
Optimistic Locking
Summary
38 Database Design and Performance
What’s New in Database Design and Performance
Basic Tenets of Designing for Performance
Logical Database Design Issues
Denormalizing a Database
Database Filegroups and Performance
RAID Technology
SQL Server and SAN Technology
Summary
39 Monitoring SQL Server Performance
What’s New in Monitoring SQL Server Performance
Performance Monitoring Tools
A Performance Monitoring Approach
Summary
40 Managing Workloads with the Resource Governor
Overview of Resource Governor
Resource Governor Components
Configuring Resource Governor
Monitoring Resource Usage
Modifying Your Resource Governor Configuration
Summary
41 A Performance and Tuning Methodology
The Full Architectural Landscape
Primary Performance and Tuning Handles
A Performance and Tuning Methodology
Performance and Tuning Design Guidelines
Tools of the Performance and Tuning Trade
Summary
Part VI: SQL Server Application Development
42 What’s New for Transact-SQL in SQL Server 2008
MERGE Statement
Insert over DML
GROUP BY Clause Enhancements
Variable Assignment in DECLARE Statement
Compound Assignment Operators
Row Constructors
New date and time Data Types and Functions
Table-Valued Parameters
Hierarchyid Data Type
Using FILESTREAM Storage
Sparse Columns
Spatial Data Types
Change Data Capture
Change Tracking
Summary
43 Transact-SQL Programming Guidelines, Tips, and Tricks
General T-SQL Coding Recommendations
General T-SQL Performance Recommendations
T-SQL Tips and Tricks
In Case You Missed It: New Transact-SQL Features in SQL Server 2005
The xml Data Type
The max Specifier
TOP Enhancements
The OUTPUT Clause
Common Table Expressions
Ranking Functions
PIVOT and UNPIVOT
The APPLY Operator
TRY...CATCH Logic for Error Handling
The TABLESAMPLE Clause
Summary
44 Advanced Stored Procedure Programming and Optimization
T-SQL Stored Procedure Coding Guidelines
Using Cursors in Stored Procedures
Nested Stored Procedures
Using Temporary Tables in Stored Procedures
Using Remote Stored Procedures
Stored Procedure Performance
Using Dynamic SQL in Stored Procedures
Installing and Using .NET CLR Stored Procedures
Using Extended Stored Procedures
Summary
45 SQL Server and the .NET Framework
What’s New in SQL Server 2008 and the .NET Framework
Getting Comfortable with ADO.NET 3.5 and SQL Server 2008
Developing with LINQ to SQL
Using ADO.NET Data Services
Leveraging the Microsoft Sync Framework
Summary
46 SQLCLR: Developing SQL Server Objects in .NET
What’s New for SQLCLR in SQL Server 2008
Developing Custom Managed Database Objects
Summary
47 Using XML in SQL Server 2008
What’s New in Using XML in SQL Server 2008
Understanding XML
Relational Data As XML: The FOR XML Modes
XML As Relational Data: Using OPENXML
Using the xml Data Type
Indexing and Full-Text Indexing of xml Columns
Summary
48 SQL Server Web Services
What’s New in SQL Server Web Services
Web Services Migration Path
Web Services History and Overview
Building Web Services
Examples: A C# Client Application
Using Catalog Views and System Stored Procedures
Controlling Access Permissions
Summary
49 SQL Server Service Broker
What’s New in Service Broker
Understanding Distributed Messaging
Designing a Sample System
Understanding Service Broker Constructs
Service Broker Routing and Security
Troubleshooting SSB Applications with ssbdiagnose.exe
Related System Catalogs
Summary
50 SQL Server Full-Text Search
What’s New in SQL Server 2008 Full-Text Search
Upgrade Options in SQL Server 2008
How SQL Server FTS Works
Implementing SQL Server 2008 Full-Text Catalogs
Setting Up a Full-Text Index
Full-Text Searches
Full-Text Search Maintenance
Full-Text Search Performance
Full-Text Search Troubleshooting
Summary
Part VII: SQL Server Business Intelligence Features
51 SQL Server 2008 Analysis Services
What’s New in SSAS
Understanding SSAS and OLAP
Understanding the SSAS Environment Wizards
An Analytics Design Methodology
An OLAP Requirements Example: CompSales International
Summary
52 SQL Server Integration Services
What’s New with SSIS
SSIS Basics
SSIS Architecture and Concepts
SSIS Tools and Utilities
A Data Transformation Requirement
Running the SSIS Wizard
The SSIS Designer
The Package Execution Utility
Connection Projects in Visual Studio
Change Data Capture Addition with R2
Using bcp
Logged and Nonlogged Operations
Summary
53 SQL Server 2008 Reporting Services
What’s New in SSRS 2008
Reporting Services Architecture
Installing and Configuring SSRS
Developing Reports
Management and Security
Performance and Monitoring
Summary
Part VIII: Bonus Chapters
54 Managing Linked and Remote Servers
What’s New in Managing Linked and Remote Servers
Managing Remote Servers
Linked Servers
Adding, Dropping, and Configuring Linked Servers
Mapping Local Logins to Logins on Linked Servers
Obtaining General Information About Linked Servers
Executing a Stored Procedure via a Linked Server
Setting Up Linked Servers Using SQL Server Management Studio
Summary
55 Configuring, Tuning, and Optimizing SQL Server Options
What’s New in Configuring, Tuning, and Optimizing SQL Server Options
SQL Server Instance Architecture
Configuration Options
Fixing an Incorrect Option Setting
Setting Configuration Options with SSMS
Obsolete Configuration Options
Configuration Options and Performance
Database Engine Tuning Advisor
Data Collection Sets
Summary
56 SQL Server Disaster Recovery Planning
What’s New in SQL Server Disaster Recovery Planning
How to Approach Disaster Recovery
Microsoft SQL Server Options for Disaster Recovery
The Overall Disaster Recovery Process
Have You Detached a Database Recently?
Third-Party Disaster Recovery Alternatives
Summary
Index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y-Z
Nội dung
ptg 2024 CHAPTER 50 SQL Server Full-Text Search Here are some examples using FREETEXT and FREETEXTTABLE: Use AdventureWorks;SELECT * from Person.Contact where Freetext(*,’Barack Obama’) Corrected! HPC Use AdventureWorks; SELECT * FROM Sales.Individual as s JOIN (SELECT [key], rank FROM FREETEXTTABLE(Person.Contact, *, ‘jon’,100)) AS k ON k.[key]=s.Contactid order by rank desc Notice that the FREETEXTTABLE example does the functional equivalent of a CONTAINSTABLE query because the search is wrapped in double quotation marks. Stop Lists Stop lists are used when you want to hide words in searches or to prevent from being indexed those words that would otherwise bloat your full-text index and might cause perfor- mance problems. Stop lists (also known as noise word lists or stop word lists) are a legacy component from decades ago when disk prices were very expensive. Back then, using stop lists could save considerable disk space. However, with disk prices being relatively cheap, the use of stop lists is no longer as critical as it once was. You can create your own stop word list by expanding your database in SSMS and then right-clicking on the Full-Text Stoplists node and selecting New Full-Text Stoplist. You have an option of creating your own stop list, basing it on a system stop list, creating an empty one, or creating one based on another stop list in a different database. Each catalog can have its own stop list, which is a frequently demanded feature because some search consumers want to be able to prevent some words from being indexed in one table but want those words indexed in a different table. After you create a stop word list, you can maintain it by right-clicking on it in the Full-Text Stoplists node and selecting Properties. Figure 50.5 illustrates this option. The options are to add a stop word, delete a stop word, delete all stop words, and clear the stop list. After selecting the option you want, you can enter a stop word and the language in which you want that stop word to be applied. Keep in mind that the stop lists are applied at query time (while searching) and index time (while indexing). Changes made to a stop list are reflected real-time in searches but applied only to newly indexed words. The stop words remain in the catalog until you rebuild the catalog. It is a best practice to rebuild your catalog as soon as you have made changes to your stop word list. To rebuild your full-text catalog, right-click on the catalog in SSMS and select Rebuild. Full-Text Search Maintenance After you create full-text catalogs and indexes that you can query, you have to maintain them. The catalogs and indexes maintain themselves, but you need to focus on backing up and restoring them as well as tuning your search solution for optimal performance. In SQL Server 2008, the full-text catalogs get fragmented from time to time, especially if you are using the Automatic (Track Changes Automatically) setting. You can check the level of fragmentation by using the following command: SELECT table_id, status FROM sys.fulltext_index_fragments WHERE status=4 OR status=6; ptg 2025 Full-Text Search Performance 50 FIGURE 50.5 Maintaining a full-text stop list. If you notice that your tables are highly fragemented you will optimize your full-text indexes. Here is the command you would use to do this: ALTER FULLTEXT CATALOG AdventureWorks2008 REORGANIZE; Full-Text Search Performance SQL Server FTS performance is most sensitive to the number of rows in the result set and number of search terms in the query. You should limit your result set to a practical number; most searchers are conditioned to look only at the first page of results for what they are looking for, and if they don’t see what they need there, they refine the search and search again. A good practical limit for the number of rows to return is 200. You should try, if at all possible, to use simple queries because they perform better than more complex ones. As a rule, you should use CONTAINS rather than FREETEXT because it offers better performance, and you should use CONTAINSTABLE rather than FREETEXTTABLE for the same reason. Several factors are involved in delivering an optimal Full-Text Search solution. Consider the following: . Avoid indexing binary content. Convert it to text, if possible. Most IFilters do not perform as well as the text IFilter. . Use integer columns on the base table that comprises your unique index. ptg 2026 CHAPTER 50 SQL Server Full-Text Search . Partition large tables into smaller tables. There seems to be a sweet spot around 50 million rows, but your results may vary. Ensure that for large tables, each table has its own catalog. Place this catalog on a RAID 10 array, preferably on its own controller. . SQL Full-Text Search benefits from multiple processors, preferably four or more. A sweet spot exists on eight-way machines or better. You will find 64-bit hardware also offers substantial performance benefits over 32-bit. . Dedicate at least 512MB to 1GB of RAM to MSFTESQL by setting the maximum server memory to 1GB less than the installed memory. Set resource usage to run at 5 to give a performance boost to the indexing process (that is, sp_fulltext_service ‘resource_usage’,5 ), set ft crawl bandwidth (max) and ft notify bandwidth (max) to 0, and set max full-text crawl range to the number of CPUs on your sys- tem. Use sp_configure to make these changes. Full-Text Search Troubleshooting The first question you should ask yourself when you have a problem with SQL Full-Text Search is this: “Is the problem with searching or with indexing?” To help you make this determination, Microsoft has included three DMVs in SQL Server 2008: . sys.dm_fts_index_keywords . sys.dm_fts_index_keywords_by_document . sys.dm_fts_parser The first two DMVs displays the contents of your full-text index. The first DMV returns the following columns: . Keyword—Each keyword in varbinary form. . Display_term—The keyword as indexed; all the accents are removed from the word. . Column_ID—The column ID where the word exists. . Document_Count—The number of times the word exists in that column. The second DMV breaks down the keywords by document. Like the first DMV, it contains the Keyword, Display_term, and Column_ID columns, but in addition it contains the following two columns: . Document_ID—The row in which the keyword occurs. . Occurrence_count—The number of times the word occurs in the cell (a cell is also known as a tuple; it is a row-column combination—for example, the contents of the third column in the fifth row). The first DMV, sys.dm_fts_index_keywords, is used primarily to determine candidate noise wordsit can be used to diagnose indexing problems. The second DMV, sys.dm_fts_index_keywords_by_document, is used to determine what is stored in your index for a particular cell. ptg 2027 Full-Text Search Troubleshooting 50 Here are some examples of their usage: select * From sys.dm_fts_index_keywords(DB_ID(),Object_iD(‘MyTable’)) select * From sys.dm_fts_index_keywords_by_document(DB_ID(),Object_iD(‘MyTable’)) These two DMVs are used to determine what occurs at index time. The third DMV, sys.dm_fts_parser, is used primarily to determine what happens at search time—in other words, how SQL Server Full-Text Search interprets your search phrase. Here is an example of its usage. select * from sys.dm_fts_parser(@queryString, @LCID, @StopListID, @AccentSenstive) @QueryString is your search word or phrase, @LCID is the LoCale ID for your language (determinable by querying sys.fulltext_languages), @StopListID is your stoplist file (determinable by querying sys.fulltext_stoplists), @AccentSensitive allows you to set accent sensitivity (0 not sensitive, 1 sensitive to accents) . Here is an example of how this works: select * from sys.dm_fts_parser(‘café’, 1033, 0, 1) select * from sys.dm_fts_parser(‘café’, 1033, 0, 0) In the second example, you will notice that the Display_term is cafe and not café. These queries return the following columns: . Keyword—This is a varbinary representation of your keyword. . Group_id—The query parser builds a parse tree of the search phrase. If you have any Boolean searches, it assigns different group IDs to each part of the search term. For example in the search phrase ’”Hillary Clinton” OR “Barack Obama”’, Hillary and Clinton belong to Group ID 1 and Barack and Obama belong to Group ID 2. . Phrase_id—Some words are indexed in multiple forms; for example, data-base is indexed as data, base, and database. In this case, data and base have the same phrase ID, and database has another phrase ID. . Occurence_count—This is how frequently the word apprears in the search string. . Special_term—This column refers to any delimiters that the parser finds in the search phrase. Possible values are Exact Match, End of Sentence, End of Paragraph, and End of Chapter. . Display_term—This is how the term would be stored in the index. . Expansion_type—This is the type of expansion, whether it is a thesaurus expansion ( 4), an inflectional expansion (2), or not expanded (0). For example, the following query shows the stemmed variants of the word run. select * from sys.dm_fts_parser(‘FORMSOF( INFLECTIONAL, run)’, 1033, 0, 0) . Source_Term—This is the source term as it appears in your query. When troubleshooting indexing problems, you should consult the full-text error log, which can be found in C:\Program Files\Microsoft SQL ptg 2028 CHAPTER 50 SQL Server Full-Text Search Server\MSSQL10.MSSQLSERVER\MSSQL\LOG and starts with the prefix SQLFT followed by the database ID (padded with leading zeros), the catalog ID (query sys.fulltext_catalogs for this value), and then the extension .log. You may find many versions of the log each with a numerical extension, such as SQLFT0001800005.LOG.4; this is the fourth version of this log. These full-text indexing logs can be read by any text editor. You might find entries in this log that indicate documents were retried or documents failed indexing in addition to error messages returned from the iFilters. Summary SQL Server 2008 Full-Text Search offers extremely fast and powerful querying of textual content stored in tables. In SQL Server 2008, the full-text index creation statements are highly symmetrical, with the table index creation statements making SQL Server FTS much more intuitive to use than previous versions of SQL Server FTS. Also new is the tremendous increase in indexing and querying speeds. These features make SQL Server Full-Text Search a very attractive component of SQL Server 2008. ptg CHAPTER 51 SQL Server 2008 Analysis Services IN THIS CHAPTER . What’s New in SSAS . Understanding SSAS and OLAP . Understanding the SSAS Environment Wizards . An Analytics Design Methodology . An OLAP Requirements Example: CompSales International SQL Server 2008 Analysis Services (SSAS) continues to expand with numerous data warehousing, data mining, and online analytical processing (OLAP)–rich tools and tech- nologies. Microsoft continues to attack the data warehous- ing/business intelligence (BI) market by pouring millions and millions of dollars into this area. Microsoft knows that the world is hungry for analytics and is betting the farm on it. As a part of its internal project named “Madison,” Microsoft has been acquiring other complementary BI tech- nologies to accelerate its plans (such as acquiring the MPP data warehousing appliance company DATAllegro and rolling it under its BI offering). Other more traditional (and much more expensive) OLAP and BI platforms such as Cognos, Hyperion, Business Objects, and Micro Strategies are being challenged, if not completely replaced, by this new version of SSAS. A chief data architect from a prominent Silicon Valley company said recently, “I can now build [using SSAS] sound, extremely usable, highly scalable, OLAP cubes myself, faster and smarter than the entire data warehouse team could do only a few years ago.” This is what Microsoft has been trying to bring to the forefront for years—“BI for the masses.” What’s New in SSAS SQL Server 2005 was the big jump into completely rede- ploying Analysis Services—from the architecture, to the development environment, to the multidimensional languages supported, and even to the wizard-driven deploy- ments. SQL Server 2008 R2 raises this core work up a few ptg 2030 CHAPTER 51 SQL Server 2008 Analysis Services more notches with enhancements at almost every part of SSAS and with the addition of major scaleout capabilities. Following are some of the top new features and enhancements: . Microsoft has improved and streamlined the Cube Designer. . Several subtle enhancements have been made around the Dimension and Aggregation Designers. . You can now create attribute relationships with the new Attribute Relationship Designer. . You can use subspace computations to optimize performance for your Multidimensional Expressions (MDX) queries. . Multidimensional OLAP (MOLAP) enables write-back capabilities that support high- performance “what if” scenarios. . A shared read-only Analysis Services database between several Analysis Services servers enables you to “scale out” easily and efficiently. . You are able to use localized analytical data in native languages, including transla- tion capabilities and automatic currency conversions. . A highly compressed and optimized data cache is maintained automatically. . Backup performance is optimized. . SQL Server PowerPivot for Excel is a new feature. . The master data hub in SQL Server 2008 R2 helps manage your master data services more efficiently. And, last, but not least, . SQL Server 2008 R2 Parallel Data Warehouse is a highly scalable data warehouse appliance-based massively parallel processing (MPP) solution that knows no bounds. Understanding SSAS and OLAP Because OLAP is at the heart of SSAS, you need to understand what it is and how it solves the requirements of decision makers in a business. As you might already know, data ware- housing requirements typically include all the capability needed to report on a business’s transactional history, such as sales history. This transactional history is often organized into subject areas and tiers of aggregated information that can support some online query- ing and usually much more batch reporting. Data warehouses and data marts typically extract data from online transaction processing (OLTP) systems and serve data up to these business users and reporting systems. In general, these are all called decision support systems (DSS), or BI systems, and the latency of this data is determined by the business requirements it must support. Typically, this latency is daily or weekly, depending on the business needs, but more and more, we are seeing more real-time (or near-real-time) reporting requirements. ptg 2031 Understanding SSAS and OLAP 51 TIME GEOGRAHY All Product Product Type All Geo Country All Time Month Sales Units 450 333 1203 Years Product Region Customer TIME TIME OLAP Cube PRODUCT PRODUCT GEOGRAPHY Jan01 Feb01 Mar01 Apr01 996 (France) (2010) (Feb 01) (IBM Laptop Model 451D) FIGURE 51.1 Multidimensional representation of business facts. OLAP falls squarely into the realm of BI. The purpose of OLAP is to provide for a mostly online reporting environment that can support various end user reporting requirements. Typically, OLAP representations are of OLAP cubes. A cube is a multidimensional represen- tation of basic business facts that can be accessed easily and quickly to provide you with the specific information you need to make a critical decision. It is useful to note that a cube can be composed of from 1 to N dimensions. However, remember that the business facts represented in a cube must exist for all the dimensions being defined for the fact. In other words, all dimensional values (that is, intersections) have to be present for a fact value to be stored in the cube. Figure 51.1 illustrates the Sales_Units historical business fact, which is the intersection of time, product, and geography dimensional data. For a particular point in time (February 2010), for a particular product (IBM laptop model 451D), and in a particular country (France), the sales units were 996 units. With an OLAP cube, you can easily see how many of these laptop computers were sold in France in February 2010. Basically, cubes enable you to look at business facts via well-defined and organized dimen- sions (time, product, and geography dimensions, in this example). Note that each of these dimensions is further organized into hierarchical representations that correspond to the way data is looked at from the business point of view. This provides for the capability to drill down into the next level from a higher, broader level (like drilling down into a specific country’s data within a geographic region, such as France’s data within the European geographic region). ptg 2032 CHAPTER 51 SQL Server 2008 Analysis Services SSAS directly supports this and other data warehousing capabilities. In addition, SSAS allows a designer to implement OLAP cubes using a variety of physical storage techniques that are directly tied to data aggregation requirements and other performance considera- tions. You can easily access any OLAP cube built with SSAS via the Pivot Table Service, you can write custom client applications by using MDX with OLE DB for OLAP or ActiveX Data Objects Multidimensional (ADO MD), and you can use a number of third-party “OLE DB for OLAP” compliant tools. Microsoft utilizes something called the Unified Dimensional Model (UDM) to conceptual- ize all multidimensional representations in SSAS. It is also worth noting that many of the leading OLAP and statistical analysis software vendors have joined the Microsoft Data Warehousing Alliance and are building front-end analysis and presentation tools for SSAS. The data mining capabilities that are part of SSAS provide a new avenue for organized data discovery. This includes using SQL Server DMX. This chapter takes you through the major components of SSAS, discusses a mini-method- ology for OLAP cube design, and leads you through creating and managing robust OLAP cube that can easily be used to meet a company’s BI needs. Understanding the SSAS Environment Wizards Welcome to the “land of wizards.” This implementation of SSAS, as with older versions of SSAS, is heavily wizard oriented. SSAS has a Cube Wizard, a Dimension Wizard, a Partition Wizard, a Storage Design Wizard, a Usage Analysis Wizard, a Usage-Based Optimization Wizard, an Aggregation Wizard, a Calculated Cells Wizard, a Mining Model Wizard, and a few other wizards. All of them are useful, and many of their capabilities are also available through editors and designers. Using a wizard is helpful for those who need to have a little structure in the definition process and who want to rely on defaults for much of what they need. The wizards are also plug-and-play oriented and have been made avail- able in all SQL Server and .NET development environments. In other words, you can access these wizards from wherever you need to, when you need to. All the wizard-based capabilities can also be coded in MDX, DMX, and ASSL. Figure 51.2 shows how SSAS fits into the overall scheme of the SQL Server 2008 environ- ment. SSAS has become completely integrated into the SQL Server platform. Utilizing many different mechanisms, such as SSIS and direct data source access capabilities, a vast amount of data can be funneled into the SSAS environment. Most of the cubes you build will likely be read-only because they will be for BI. However, a write-enabled capability (WriteBack) is available in SSAS for situations that meet certain data updatability requirements. As you can also see in Figure 51.2, the basic components in SSAS are all focused on building and managing data cubes. SSAS consists of the analysis server, processing services, integra- tion services, and a number of data providers. SSAS has both server-based and client-/local- based SSAS capabilities. This essentially provides a complete platform for OLAP. You create cubes by preprocessing aggregations (that is, precalculated summary data) that reflect the desired levels within dimensions and support the type of querying that will be done. These aggregations provide the mechanism for rapid and uniform response times to ptg 2033 Understanding the SSAS Environment Wizards 51 Packages SSIS SQL Server Analysis Services msmdsrv.exe OLAP Cube OLAP Cube Mining Models Mining Models Server Based Local/Client Based Local Cube Engine msmdlocal.exe IIS COM Data Pump XMLA (SOAP over TCP/IP) XMLA (SOAP over HTTP) XMLA (SOAP over TCP/IP) ADO MD.NET OLE DB for OLAP ADO MD Win32/64 Applications COM-Based Applications .NET Applications Any Application for OLAP or DM OLTP Databases Multi-Dimensional Data Warehouse OLTP Databases Measures Dimensions Hierarchies Partitions Perspectives Unified Dimensional Model (UDM) Proactive Cache (MOLAP cache) SSAS Processing Engine FIGURE 51.2 SSAS as part of the overall SQL Server 2008 environment. queries. You create them before the user uses the cube. All queries utilize either these aggre- gations, the cube’s source data, a copy of this data in a client cube, data in cache, or a combination of these sources. A single Analysis Server can manage many cubes. You can have multiple SSAS instances on a single machine. By orienting around UDM, SSAS allows for the definition of a cube that contains data measures and dimensions. Each cube dimension can contain a hierarchy of levels to specify the natural categorical breakdown that users need to drill down into for more details. Look back at Figure 51.1, and you can see a product hierarchy, time hierarchy, and geography hierarchy representation. The data values within a cube are represented by measures (the facts). Each measure of data might utilize different aggregation options, depending on the type of data. Unit data might require the SUM (summarization) function, Date of Receipt data might require the MAX function, and so on. Members of a dimension are the actual level values, such as the particular product number, the particular month, and the particular country. Microsoft has solved most of the limitations within SSAS. SSAS addresses up to 2,147,483,647 of most anything within its environment (for example, dimensions in a database, attributes in a dimension, databases in an instance, levels in a hierarchy, cubes in a database, measures in a cube). In reality, you will probably not have more than a handful of dimen- sions. Remember that dimensions are the paths to the interesting facts. Dimension members should be textual and are used as criteria for queries and as row and column headers in query results. . can be found in C:Program Files Microsoft SQL ptg 2028 CHAPTER 50 SQL Server Full-Text Search Server MSSQL10.MSSQLSERVERMSSQLLOG and starts with the prefix SQLFT followed by the database ID. SQL Server PowerPivot for Excel is a new feature. . The master data hub in SQL Server 2008 R2 helps manage your master data services more efficiently. And, last, but not least, . SQL Server 2008. supported, and even to the wizard-driven deploy- ments. SQL Server 2008 R2 raises this core work up a few ptg 2030 CHAPTER 51 SQL Server 2008 Analysis Services more notches with enhancements at