session 2: sql server 2012 with christian malbeuf

67
Module 1: Introduction to SQL Server 2012 CTE Ottawa Seminar Day September 7 th , 2012

Upload: cte-solutions-inc

Post on 10-May-2015

712 views

Category:

Technology


1 download

DESCRIPTION

CTE Ottawa Seminar Day - September 7th, 2012 This clinic introduces the key features and enhancements in SQL Server 2012. It is designed to provide a high-level overview of the product and the key new capabilities in this release. This course is intended for technology managers and database professionals who want to understand the key capabilities of SQL Server 2012. In many cases, it is assumed that senior technical managers may attend this clinic in order to assess the further training that their technology-focused employees will need in order to adopt SQL Server 2012.

TRANSCRIPT

Page 1: Session 2: SQL Server 2012 with Christian Malbeuf

Module 1: Introduction to SQL Server 2012

CTE Ottawa Seminar Day September 7th, 2012

Page 2: Session 2: SQL Server 2012 with Christian Malbeuf

Module Overview

• Enterprise Data Scenarios and Trends

•SQL Server 2012 Overview

Page 3: Session 2: SQL Server 2012 with Christian Malbeuf

Lesson 1: Enterprise Data Scenarios and Trends

•Common Data Workloads

•Key Trend – Mission-Critical Data

•Key Trend – Self-Service Business Intelligence

•Key Trend – Big Data

•Key Trend – Cloud Technologies

•Key Trend – Appliances

Page 4: Session 2: SQL Server 2012 with Christian Malbeuf

Common Data Workloads

Online Transaction Processing (OLTP)

Enterprise Integration Management (EIM)

Data Warehousing (DW)

Business Intelligence (BI)

Page 5: Session 2: SQL Server 2012 with Christian Malbeuf

Key Trend – Mission-Critical Data

•High availability

• Fast, up-to-the-minute data recoverability

Page 6: Session 2: SQL Server 2012 with Christian Malbeuf

Key Trend – Self-Service Business Intelligence

• Empower information workers

•Reduce IT workload

Page 7: Session 2: SQL Server 2012 with Christian Malbeuf

Key Trend – Big Data

• Large volumes of data

•Many data sources

•Diverse data formats

Page 8: Session 2: SQL Server 2012 with Christian Malbeuf

Key Trend – Cloud Technologies

• Public Cloud

• Private Cloud

•Hybrid Solutions

Page 9: Session 2: SQL Server 2012 with Christian Malbeuf

Key Trend – Appliances

• Pre-configured hardware and software solutions

•Optimized for specific workloads

•Generally purchased from a single supplier with a single support package

Page 10: Session 2: SQL Server 2012 with Christian Malbeuf

Lesson 2: SQL Server 2012 Overview

•SQL Server 2012 Editions

•SQL Server 2012 Components

•SQL Server 2012 and Other Microsoft Technologies

•SQL Server 2012 Licensing

Page 11: Session 2: SQL Server 2012 with Christian Malbeuf

SQL Server 2012 Editions

Premium Editions

Parallel Data Warehouse Enterprise

Core Editions

Business Intelligence Standard

Other Editions

Express Compact

Developer SQL Azure

Web

Page 12: Session 2: SQL Server 2012 with Christian Malbeuf

SQL Server 2012 Components

•Not just a database engine

•Relational and Business Intelligence Components

SQL Server Components

Database Engine Analysis Services

Integration Services Reporting Services

Master Data Services StreamInsight

Data Mining Full-Text Search

PowerPivot Replication

Data Quality Services Power View

Page 13: Session 2: SQL Server 2012 with Christian Malbeuf

SQL Server 2012 and Other Microsoft Technologies

Product Relationship to SQL Server

Microsoft Windows Server The operating system on which SQL Server is installed

Microsoft SharePoint Server A Web platform for collaboration through which users can access SQL Server Reporting Services, PowerPivot, and Power View

Microsoft System Center A suite of technologies for provisioning and managing server infrastructure. SQL Server can be deployed on virtual servers in a private cloud and managed by System Center

Microsoft Office An information worker productivity suite that provides an intuitive way for users to consume SQL Server BI technologies and manage master data models

The .NET Framework A software development runtime that includes class libraries for creating applications that interact with data in a SQL Server database

Windows Azure A cloud platform for developing applications that can leverage cloud-based databases and reporting

Page 14: Session 2: SQL Server 2012 with Christian Malbeuf

SQL Server 2012 Licensing

•Core-based Licensing – licensing by computing power

•Server + CAL Licensing – licensing by user

•Virtual Machine Licensing – licensing VMs

Edition Licensing Model

Server + CAL Core-based

Enterprise

Business Intelligence

Standard

Page 15: Session 2: SQL Server 2012 with Christian Malbeuf

Module Review

• Enterprise Data Scenarios and Trends

•SQL Server 2012 Overview

Learn more at www.microsoft.com/sqlserver

Page 16: Session 2: SQL Server 2012 with Christian Malbeuf

Module 2: SQL Server 2012 as a Platform for

Mission-Critical Data

CTE Ottawa Seminar Day September 7th, 2012

Page 17: Session 2: SQL Server 2012 with Christian Malbeuf

Module Overview

•Database Development Enhancements

•Database Manageability Enhancements

•Database Availability Enhancements

Page 18: Session 2: SQL Server 2012 with Christian Malbeuf

Lesson 1: Database Development Enhancements

• Transact-SQL Enhancements

•New Functions

•Spatial Data Enhancements

•Storing and Querying Documents

Page 19: Session 2: SQL Server 2012 with Christian Malbeuf

Transact-SQL Enhancements

• The WITH RESULT SETS Clause

EXECUTE GetOrderPickList 'SO59384'

WITH RESULT SETS

(

([SalesOrder] nvarchar(20) NOT NULL,[LineItem] int, [Product] int, [Quantity] int)

)

THROW 50001, 'Customer doers not exist', 1

SELECT SalesOrderNumber, OrderDate, CustomerName FROM SalesOrders

ORDER BY SalesOrderNumber ASC

OFFSET 20 ROWS

FETCH NEXT 10 ROWS ONLY

CREATE SEQUENCE OrderNumbers

START WITH 1000 INCREMENT BY 10

...

CREATE TABLE Orders

(OrderNumber int PRIMARY KEY DEFAULT(NEXT VALUE FOR OrderNumbers),

CustomerKey int, ProductKey int, Quantity int)

SELECT City, OrderYear, OrderQuantity,

SUM(OrderQuantity) OVER (PARTITION BY City ORDER BY OrderYear

ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS RunningQty

FROM CitySalesByYear

• The THROW Statement

• Paging with the OFFSET and FETCH Keywords

• Sequence Objects

• The OVER Clause

Page 20: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Using Transact-SQL Enhancements

In this demonstration, you will see how to:

Use the WITH RESULT SETS Clause

Use the THROW Statement

Implement Paging

Use a Sequence Object

Use the OVER Subclause

Page 21: Session 2: SQL Server 2012 with Christian Malbeuf

New Functions

Conversion Functions

PARSE PARSE('£345.98' AS money USING 'en-GB')

TRY_PARSE TRY_PARSE('£345.98' AS money USING 'en-US')

TRY_CONVERT TRY_CONVERT(int, 'One')

Date and Time Functions

DATEFROMPARTS DATEFROMPARTS (2010, 12, 31)

DATETIMEFROMPARTS DATETIMEFROMPARTS ( 2010, 12, 31, 23, 59, 59, 0 )

SMALLDATETIMEFROMPARTS SMALLDATETIMEFROMPARTS ( 2010, 12, 31, 23, 59 )

DATETIME2FROMPARTS DATETIME2FROMPARTS ( 2010, 12, 31, 23, 59, 59, 1, 7 )

TIMEFROMPARTS TIMEFROMPARTS ( 23, 59, 59, 1, 5 )

DATETIMEOFFSETFROMPARTS DATETIMEOFFSETFROMPARTS(2010,12,31,14,23,23,1,8,0,7)

EOMONTH EOMONTH (GETDATE(), 1)

Logical Functions

CHOOSE CHOOSE (3,'Cash','Credit Card','Debit Card','Invoice')

IIF IIF(@i % 2 = 0, 'Even', 'Odd')

String Functions

CONCAT CONCAT(Firstname, ' ', LastName)

FORMAT FORMAT(UnitPrice, 'C', 'en-GB')

Page 22: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Using New Functions

In this demonstration, you will see how to:

Use Conversion Functions

Use Data and Time Functions

Use Logical Functions

Use String Functions

Page 23: Session 2: SQL Server 2012 with Christian Malbeuf

Spatial Data Enhancements

•New Spatial Shapes

•Shapes larger than a Hemisphere

•New FULLGLOBE Shape

CIRCULARSTRING COMPOUNDCURVE CURVEPOLYGON

Page 24: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Using Spatial Data Enhancements

In this demonstration, you will see how to:

Create a CIRCULARSTRING Shape

Create a COMPOUNDCURVE Shape

Create a CURVEPOLYGON Shape

Create a Shape that is Larger than a Hemisphere

Use the FULLGLOBE Shape

Page 25: Session 2: SQL Server 2012 with Christian Malbeuf

Storing and Querying Documents

CREATE TABLE FileStore AS FileTable

WITH (FileTable_Directory = 'Documents')

SELECT [name] As FileName FROM FileStore

WHERE CONTAINS(PROPERTY(file_stream,'Title'),'Bike OR Cycling')

SELECT [name] As FileName

FROM FileStore

WHERE CONTAINS(file_stream, 'NEAR((bicycle, race), 15)')

Page 26: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Working with Documents

In this demonstration, you will see how to:

Create a FileTable

Use the NEAR Operator

Page 27: Session 2: SQL Server 2012 with Christian Malbeuf

Lesson 2: Database Manageability Enhancements

•Management Tool Enhancements

•Security Enhancements

Page 28: Session 2: SQL Server 2012 with Christian Malbeuf

Management Tool Enhancements

•Code Snippets

• Enhanced Debugging

Page 29: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Using SQL Server Management Studio

In this demonstration, you will see how to:

Use Code Snippets

Debug Transact-SQL Code

Page 30: Session 2: SQL Server 2012 with Christian Malbeuf

Security Enhancements

•User-Defined Server Roles

•Contained Databases

CREATE SERVER ROLE [AGAdmins] AUTHORIZATION [sa];

GRANT ALTER ANY AVAILABILITY GROUP TO [AGAdmins];

GRANT ALTER ANY ENDPOINT TO [AGAdmins];

GRANT CREATE AVAILABILITY GROUP TO [AGAdmins];

GRANT CREATE ENDPOINT TO [AGAdmins];

ALTER SERVER ROLE [AGAdmins]

ADD MEMBER [JohnDoe];

CREATE DATABASE [MyContainedDB]

CONTAINMENT = PARTIAL

GO

USE [MyContainedDB]

CREATE USER [SalesAppUser] WITH PASSWORD = 'Pa$$w0rd'

GO

Page 31: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Using Security Enhancements

In this demonstration, you will see how to:

Create a Server Role

Create a Contained Database

Page 32: Session 2: SQL Server 2012 with Christian Malbeuf

Lesson 3: Database Availability Enhancements

•Backup and Restore Enhancements

•AlwaysOn Availability Groups

Page 33: Session 2: SQL Server 2012 with Christian Malbeuf

Backup and Restore Enhancements

• Point-In-Time Restore

• Page Restore

Page 34: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Using Backup and Restore Enhancements

In this demonstration, you will see how to:

Perform a Point-In-Time Restore

Page 35: Session 2: SQL Server 2012 with Christian Malbeuf

AlwaysOn Availability Groups

Windows Cluster

Node1 (Primary)

Node2 (Read-Only)

Node3

Async

Listener

Page 36: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Using AlwaysOn Availability Groups

In this demonstration, you will see how to:

Verify Cluster and AlwaysOn Configuration

Perform a Full Database Backup

Create an AlwaysOn Availability Group

View Availability Group Configuration

Connect to an AlwaysOn Availability Group

Use a Readable Secondary Replica

Use a Readable Secondary Replica with a Read-Intent Connection

Perform a Manual Failover

Observe Automatic Failover

Page 37: Session 2: SQL Server 2012 with Christian Malbeuf

Module Review

•Database Development Enhancements

•Database Manageability Enhancements

•Database Availability Enhancements

For more information, attend the following courses:

• 10774A: Querying Microsoft® SQL Server® 2012 • 10775A: Administering Microsoft® SQL Server® 2012 Databases • 10776A: Developing Microsoft® SQL Server® 2012 Databases • 40008A: Updating your Database Skills to Microsoft® SQL Server® 2012

Page 38: Session 2: SQL Server 2012 with Christian Malbeuf

Module 3: Enterprise Integration Management

and Data Warehousing

CTE Ottawa Seminar Day September 7th, 2012

Page 39: Session 2: SQL Server 2012 with Christian Malbeuf

Module Overview

•SQL Server 2012 Data Quality Services

•SQL Server 2012 Master Data Services

•SQL Server 2012 Integration Services

•SQL Server 2012 for Data Warehousing

Page 40: Session 2: SQL Server 2012 with Christian Malbeuf

Lesson 1: SQL Server 2012 Data Quality Services

•Overview of SQL Server Data Quality Services

•Data Quality Services Knowledge Bases

•Data Cleansing

•Data Matching

Page 41: Session 2: SQL Server 2012 with Christian Malbeuf

Overview of SQL Server Data Quality Services

•DQS is a knowledge-based solution for:

Data Cleansing

Data Matching

•DQS Components:

Server

Client

Data Cleansing SSIS Transformation

1011000110

KB

DQS Client

Data Cleansing Transformation

SSIS

DQS Server

Page 42: Session 2: SQL Server 2012 with Christian Malbeuf

Data Quality Services Knowledge Bases

•Repository of knowledge about data:

Domains define values and rules for each field

Matching policies define rules for identifying duplicate records

1011000110

KB

Page 43: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Creating a Knowledge Base

In this demonstration, you will see how to:

Create a Knowledge Base

Perform Knowledge Discovery

Perform Domain Management

Page 44: Session 2: SQL Server 2012 with Christian Malbeuf

Data Cleansing

1. Select a knowledge base

2. Map columns to domains

3. Review suggestions and corrections

4. Export results

Page 45: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Cleansing Data

In this demonstration, you will see how to:

Create a Data Cleansing Project.

View Cleansed Data.

Page 46: Session 2: SQL Server 2012 with Christian Malbeuf

Data Matching

•Matching Policies

•Data Matching Projects

Page 47: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Matching Data

In this demonstration, you will see how to:

Create a Matching Policy.

Create a Data Matching Project.

View Data Matching Results.

Page 48: Session 2: SQL Server 2012 with Christian Malbeuf

Lesson 2: SQL Server 2012 Master Data Services

•Overview of SQL Server Master Data Services

•Master Data Models

• The Master Data Services Add-in for Excel

• Implementing a Master Data Hub

Page 49: Session 2: SQL Server 2012 with Christian Malbeuf

Overview of SQL Server Master Data Services

CRM

Marketing System Order Processing System

Customer ID Name Address Phone

1235 Ben Smith 1 High St, Seattle 555 12345

Account No Customer Address Phone

531 Benjamin Smith 1 High St, Seattle 555 12345

Contact No Name Address Phone

22 B Smith 5 Main St, Seattle 555 54321

Customer ID Account No Contact No Customer Address Phone

1235 531 22 Ben Smith 1 High St, Seattle 555 12345 Master Data Hub

Master Data Services

Other consumers (e.g. Data Warehouse ETL)

Data Steward

Page 50: Session 2: SQL Server 2012 with Christian Malbeuf

Master Data Models

• A versioned data model for specific business item or area of the business

• Contains definitions for entities required in the business area

Often an entity with the same name as the model, as well as related entities

• Each entity has a defined set of attributes

All entities have Code and Name attributes

Attributes can be categorized in attribute groups

• Each instance of an entity is a known as a member

Customers Model

Version 1

Version 2 Version 3

Account Type Entity

Customer Entity

Attributes: • Code (string) • Name (string)

• Code: 1 • Name: Standard

Member

• Code: 2 • Name: Premier

Member

• Code: 1235 • Name: Ben Smith • Address: 1 High St, Seattle • Phone: 555-12345 • AccountType: 1 • CreditLimit: 1000

Member

Attributes: • Code (free-form text) • Name (free-form text) • Address (free-form text) • Phone (free-form text) • AccountType (domain-based) • CreditLimit (free-form number)

Contact Details Attribute Group

Page 51: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Creating a Master Data Model

In this demonstration, you will see how to:

Create a Master Data Model

Create Entities

Create Attributes

Add and Edit Members

Page 52: Session 2: SQL Server 2012 with Christian Malbeuf

The Master Data Services Add-in for Excel

• Use the Master Data Services Add-In for Excel to connect to a model

• Create entities

• Add columns to create attributes

• Edit entity member data in worksheets

• Publish changes to Master Data Services

Page 53: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Editing a Model in Microsoft Excel

In this demonstration, you will see how to:

View a Master Data Entity in Excel

Add a Member

Add a Free-Form Attribute

Add a Domain-Based Attribute and a Related Entity

Page 54: Session 2: SQL Server 2012 with Christian Malbeuf

Implementing a Master Data Hub

•Users insert and update data in application data stores

•Application data is loaded into the master data hub via staging tables for consolidation and management by data stewards

•Master data flows back to application data stores and other consumers across the enterprise via subscription views

CRM

Marketing System

Order Processing System

Master Data Hub

Data Steward

Other consumers (e.g. Data Warehouse ETL)

SSIS

SSIS SSIS

SSIS

Page 55: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Importing and Consuming Master Data

In this demonstration, you will see how to:

Use an SSIS Package to Import Data

View Import Status

Create a Subscription View

Query a Subscription View

Page 56: Session 2: SQL Server 2012 with Christian Malbeuf

Lesson 3: SQL Server 2012 Integration Services

•Overview of SQL Server Integration Services

• Extracting Modified Data

•Deploying and Managing Integration Services Projects

Page 57: Session 2: SQL Server 2012 with Christian Malbeuf

Overview of SQL Server Integration Services

•SSIS project:

A versioned container for parameters and packages

A unit of deployment to an SSIS Catalog

•SSIS package:

A unit of task flow execution

A unit of deployment (package deployment model)

Project

Package Package

Project-level parameter

Package-level parameter Package-level parameter

Deploy

Deploy

SSIS Catalog

Package Deployment Model

Project-level connection manager

Package connection manager Package connection manager

Control Flow

Data Flow

Control Flow

Data Flow

Page 58: Session 2: SQL Server 2012 with Christian Malbeuf

Extracting Modified Data Initial Extraction Incremental Extraction

CDC Control Mark Initial Load Start

Source

Staged Inserts

CDC Control Mark Initial Load End

CDC State Table

CDC State

Variable

CDC Control Get Processing Range

CDC Source

Staged Inserts

CDC Control Mark Processed Range

CDC State

Variable

CDC Splitter

Staged Updates

Staged Deletes

1. A CDC Control Task records the starting LSN

2. A data flow extracts all records

3. A CDC Control task records the ending LSN

1. CDC Control Task establishes the range of LSNs to be extracted

2. A CDC Source extracts records and CDC metadata

3. Optionally, a CDC Splitter splits the data flow into inserts, updates, and deletes

4. A CDC Control task records the ending LSN

Data

Flo

w

Data

Flo

w

1

2

3

1

2

3

4

CDC

Page 59: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Using the CDC Control Task

In this demonstration, you will see how to:

Enable Change Data Capture

Perform an Initial Extraction

Extract Modified Records

Page 60: Session 2: SQL Server 2012 with Christian Malbeuf

Deploying and Managing Integration Services Projects

Page 61: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Deploying an Integration Services Project

In this demonstration, you will see how to:

Create an SSIS Catalog

Deploy an SSIS Project

Create Environments and Variables

Run an SSIS Package

View Execution Information

Page 62: Session 2: SQL Server 2012 with Christian Malbeuf

Lesson 4: SQL Server 2012 for Data Warehousing

•Overview of SQL Server Data Warehousing

•Options for SQL Server Data Warehousing

•Optimizing Performance with Columnstore Indexes

Page 63: Session 2: SQL Server 2012 with Christian Malbeuf

Overview of SQL Server Data Warehousing

•A centralized store of business data for reporting and analysis

• Typically, a data warehouse:

Contains large volumes of historical data

Is optimized for querying data (as opposed to inserting or updating)

Is incrementally loaded with new business data at regular intervals

Provides the basis for enterprise business intelligence solutions

Page 64: Session 2: SQL Server 2012 with Christian Malbeuf

Options for SQL Server Data Warehousing

Reference architectures

Data warehouse appliances

Custom-build

Page 65: Session 2: SQL Server 2012 with Christian Malbeuf

Optimizing Performance with Columnstore Indexes

ProductID OrderDate Cost

310 20010701 2171.29

311 20010701 1912.15

312 20010702 2171.29

313 20010702 413.14

data page 1000

ProductID OrderDate Cost

314 20010701 333.42

315 20010701 1295.00

316 20010702 4233.14

317 20010702 641.22 data page 1001

ProductID

310

311

312

313

314

315

316

317

318

319

320

321

data page 2001

OrderDate

20010701

20010702

20010703

20010704

data page 2000

data page 2002

Cost

2171.29

1912.15

2171.29

413.14

333.42

1295.00

4233.14

641.22

24.95

64.32

1111.25

Row Store Column Store

Page 66: Session 2: SQL Server 2012 with Christian Malbeuf

Demonstration: Using a Columnstore Index

In this demonstration, you will see how to:

View Logical Reads for a Query

Create a Columnstore Index

View Performance Improvement

Page 67: Session 2: SQL Server 2012 with Christian Malbeuf

Module Review

•SQL Server 2012 Data Quality Services

•SQL Server 2012 Master Data Services

•SQL Server 2012 Integration Services

•SQL Server 2012 for Data Warehousing

For more information, attend the following courses:

• 10777A: Implementing a Data Warehouse with Microsoft® SQL Server® 2012 • 40009A: Updating your Business Intelligence Skills to Microsoft® SQL

Server® 2012