System Center Managing SQL Server 2012 R2

2014 with System Center 2012 R2

Hands-on lab

In this lab, you will learn how to leverage System Center

2012 R2 to manage and monitor SQL Server 2014. You will begin by performing SQL Server-specific backup and recovery operations. You will then review SQL Server 2014 monitoring using System Center 2012 R2 Operations Manager. Next, you will use a third party integration pack to create runbooks which leverage SQL Server data. Finally, you will use System Center 2012 R2 Virtual Machine Manager to create a service which deploys new SQL Server database instances.

Produced by HynesITe, Inc Version 1.0 6/19/2014

This document supports a preliminary release of a software product that may be changed substantially prior to final commercial release. This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information in this document, including URL and other Web site references, is subject to change without notice. The entire risk of the use or the results from the use of this document remains with the user. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in examples herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

Copyright 2014 © Microsoft Corporation. All rights reserved.

Microsoft, Active Directory, Hyper-V, , SharePoint 2013, SQL Server, Windows, Windows PowerShell, and are trademarks of the Microsoft group of companies.

All other trademarks are property of their respective owners. Managing SQL Server 2014 with System Center 2012 R2

Introduction

Estimated time to complete this lab 60 minutes Objectives After completing this lab, you will be able to:

 Perform backup and restore operations using System Center 2012 R2 Data Protection Manager.  Review the health of your SQL Server deployment using System Center 2012 R2 Operations Manager and System Center 2012 R2 Advisor.  Create runbooks which perform common Microsoft SQL Server tasks using System Center 2012 R2 Orchestrator. Prerequisites Before working on this lab, you must have:

 An understanding of SQL Server and database concepts in general.  Experience performing common database-oriented tasks.  An understanding of general system management practices, tools, and technologies. Overview of the lab In this lab, you will learn how to leverage System Center 2012 R2 to manage and monitor Microsoft SQL Server 2014. You will begin by performing SQL Server-specific backup and recovery operations. You will then review SQL Server 2014 monitoring using Operations Manager. Next, you will use a third party integration pack to create runbooks which leverage SQL Server data. Finally, you will use System Center 2012 R2 Virtual Machine Manager to create a service which deploys new SQL Server database instances.

Scenario You have a SQL Server 2014 implementation that provides structured data that is used by your organization for a variety of purposes. You wish to standardize on System Center 2012 R2 for management for your organization. In doing so, you wish to monitor health, ensure effective disaster recovery, and automate common tasks.

Virtual machine technology This lab is completed using virtual machines that run on Windows Server 2012 R2 Hyper-V technology. To log on to the virtual machines, press CTRL+ALT+END and enter your logon credentials. Computers in this lab This lab uses computers as described in the following table. Before you begin the lab, you must ensure that the virtual machines are started and then log on to the computers.

Virtual Machine Role SCDC01 Domain controller SCDPM01 Data Protection Manager server

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 3 Managing SQL Server 2014 with System Center 2012 R2

Virtual Machine Role SCO01 Orchestrator server SCOM01 Operations Manager server SCVMM01 Virtual Machine Manager server SCSQL01 Standalone SQL Server instance All user accounts in this lab use the password Passw0rd!

Note regarding pre-release software Portions of this lab may include software that is not yet released, and as such may still contain active or known issues. While every effort has been made to ensure this lab functions as written, unknown or unanticipated results may be encountered as a result of using pre-release software. Note regarding user account control Some steps in this lab may be subject to user account control. User account control is a technology which provides additional security to computers by requesting that users confirm actions that require administrative rights. Tasks that generate a user account control confirmation are denoted using a shield icon. If you encounter a shield icon, confirm your action by selecting the appropriate button in the dialog box that is presented. Note on activation The virtual machines for these labs may have been built by using software that has not been activated. This is by design in the lab to prevent the redistribution of activated software. The unactivated state of software has been taken into account in the design of the lab. Consequently, the lab is in no way affected by this state. For operating systems other than Windows 8.1, please click Cancel or Close if prompted by an activation dialog box. If you are prompted by an Activate screen for Windows 8.1, press the Windows key to display the Start screen.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 4 Managing SQL Server 2014 with System Center 2012 R2

Exercise 1: Protecting SQL Server 2014 using System Center Data Protection Manager 2012 R2

In this exercise, you will configure SQL Server to support backup using System Center 2012 R2 Data Protection Manager (DPM). You will then perform a backup and restore. Finally, you will review the health of your Data Protection Manager implementation.

Complete the configuration of SQL Server 2014

In this task, you will complete the configuration of SQL Server 2014 and enable Data Protection Manager backup. The Data Protection Manager agent runs as the local system, and therefore the local system must have sysadmin access to SQL Server to perform backups.

Begin this task logged on to SCSQL01 as Contoso\Administrator using the password Passw0rd!

On the taskbar, click SQL Server Management Studio. In the Server Name drop-down list, select SCSQL01. Click Connect. In Object Explorer, expand Security, and then expand Logins.

There is a login for NT AUTHORITY\SYSTEM already in place.

Expand Server Roles, and then click sysadmin.

Right-click sysadmin, and then click Properties. Click Add. In Select Server Login or Role, click Browse. Check [NT AUTHORITY\SYSTEM], and then click OK.

Click OK in all open dialog boxes.

You will notice that the login is already associated with the role. You are performing these steps to reinforce the requirements for Data Protection Manager.

Leave SQL Server Management Studio open for subsequent steps.

Perform a database backup using Data Protection Manager

In this task, you will configure an initial backup solution for the AdventureWorks database.

Begin this task logged on to SCDPM01 as Contoso\Administrator using the password Passw0rd!

Ensure System Center 2012 R2 Data Protection Manager Console is open. If not, click the Data Protection Manager icon on the taskbar.

Click Management.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 5 Managing SQL Server 2014 with System Center 2012 R2

In the contents pane, note that many computers are already listed as unprotected with a protection agent.

Installing the protection agent is a simple process which can require a reboot. This step has been done for you. To install the agent, you must be able to browse to the admin$ file share on the target computer.

IMPORTANT: The agent status may show a status of Unavailable, Unknown or OK. A computer with a status of Unknown simply means that the agent has not notified the Data Protection Manager server that it is online. This is common in a lab environment when computers are first brought online.

Click SCSQL01, and then on the ribbon, click Refresh.

IMPORTANT: Wait for the agent to show an Agent Status of OK.

Click Disks, and then review the available DPM storage pools. Click Protection, and then on the ribbon, click New.

Complete the Create Protection Group wizard using the values in the following table.

Page Settings to Configure Notes/Actions Welcome None Click Next Select protection group Servers Click Next type Select group members Check Employee-Data Expand SCSQL01/All SQL database Servers/SCSQL01 If you receive an error, click Clear Cache, then start this task over. Click Next Select data protection Protection group name: Online and Tape are not configured on method SQL Protection Group this server and therefore are not available Method: Disk Click Next Select short-term goals None Click Next Review disk allocation None Click Next Choose replica creation None Click Next method Choose consistency None Click Next check options Summary None Click Create Group

When the process completes, click Close.

In the navigation pane, under All Protection Groups, click SQL Protection Group.

Your SQL Server databases are now protected.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 6 Managing SQL Server 2014 with System Center 2012 R2

IMPORTANT: In this task, you did not protect the operating system for the instance of SQL Server. Protection of operating systems is outside the scope of this lab, but follows a similar process in Data Protection Manager.

IMPORTANT: Wait for the Protection Status to read OK for all the databases before proceeding. This will only take a minute.

From the taskbar, open Windows PowerShell. At the Windows PowerShell command prompt, type the following two commands, pressing

ENTER after each one.

↪ Restart-service HealthService ↪ ICM SCSQL01 {Restart-Service HealthService}

In subsequent lab steps, you will examine health status data reported by SCDPM01 and SCSQL01 to Operations Manager. You are restarting the health service on SCDPM01 and SCSQL01 to speed up the reporting of this data.

Perform a SQL Server database restore to the original instance

When you restore a SQL Server database, you restore the entire database overwriting existing data. You can leave the database in a fully operational state, or you can leave it in a state to either apply logs, or perform additional restores.

Begin this task logged on to SCDPM01 as Contoso\Administrator using the password Passw0rd!

In Data Protection Manager Console, click Recovery. In Recoverable Data on the left side, drill down and select SCSQL01\All Protected SQL

Instances\SCSQL01\Employee-Data. In the Contents Pane, click Employee-Data. Click Recover. Complete the Recovery Wizard using the values in the following table.

Page Settings to Configure Notes/Actions Review Recovery Selection None Click Next Review recovery type Recover to original instance of SQL Click Next Server (Overwrite database) Specify recovery options None Click Next Summary None Click Recover Status None Wait for recovery to complete, and then click Close

You have just completed a full recovery of the SQL Database.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 7 Managing SQL Server 2014 with System Center 2012 R2

Perform a SQL Server database restore to retrieve specific database data

When you restore a SQL Server database, you can restore the database to an alternate location allowing you to extract specific records from the database rather than restoring the entire database.

Begin this task logged on to SCDPM01 as Contoso\Administrator using the password Passw0rd!

In the Data Protection Manager Console, click Recovery. In the Recovery Points for: Employee-Data pane, use the drop-down to select the previous

recovery time.

Please ensure you select the previous time, otherwise the option to copy the backup to a network folder

will not be available.

In the Contents Pane under Recoverable Item, click Employee-Data. Click Recover.

Complete the Recovery Wizard using the values in the following table.

Page Settings to Configure Notes/Actions Review recovery selection None Click Next Select recovery type Copy to a network folder Click Next Specify Destination Destination: scsql01.contoso.com Click Browse, expand SCSQL01, Destination path: Volumes, C:, select C:\SQLServer2014SampleDBs SQLServer2014SampleDBs, click OK, and then click Next Specify recovery options None Review the options, and then click Next Summary None Click Recover Status None Wait for recovery to complete, and then click Close

You have just completed a full recovery of the SQL Database.

Switch to SCSQL01, and then open SQL Server Management Studio. In SQL Server Management Studio, expand Databases.

Right-click Databases, and then click Attach.

In Attach Databases, click Add. Browse to C:\SQLServer2014SampleDBs\DPM_\SCSQL01\Employee-Data\C- Volume\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA. Double-click Employee-Data.mdf.

In Databases to attach, under Attach As, change Employee-Data to Employee-DataRestore, and then click OK.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 8 Managing SQL Server 2014 with System Center 2012 R2

In SQL Server Management Studio, click New Query. Type the following query, and then press CTRL+E.

↪ select * from [Employee-DataRestore].[dbo].[Employees]

It may take a few moments to return all the rows from the database view.

You are accessing data in the restored version of the database. You can now engage your database team to recover specific data entries using standard Transact-SQL commands.

Leave the SQL Server Management Studio and the query window open for subsequent tasks. Switch to SCDPM01.

In the DPM Administrator console, click Monitoring.

An alert may be present that indicates the replica for Employee-Data is inconsistent. In time, this will resolve itself. If you see this alert, please perform the next steps; otherwise proceed to the next exercise.

In the upper middle pane, click the Replica is inconsistent alert. In the lower middle pane, in the Recommended action section, click Run a synchronization job with consistency check.

The critical alert changes to a warning to indicate a verification is in progress and then the warning disappears.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 9 Managing SQL Server 2014 with System Center 2012 R2

Exercise 2: Monitoring SQL Server 2014 with System Center 2012 R2 Operations Manager

In this exercise, you will use System Center Operations Manager to review and verify the health of your SQL Server deployment. You will use the new SQL Server 2014 Management Pack to perform this task. The System Center Management Pack for SQL Server 2014 enables the discovery and monitoring of SQL Server 2014 Database Engines, Databases, SQL Server Agents and other related components, and is available as a free download.

Explore the SQL Server 2014 Management Pack

In this task, you will explore the SQL Server 2014 Management Pack. This management pack includes several views and dashboards that can be used to monitor database performance and health.

Begin this task logged on to SCOM01 as Contoso\Administrator using the password Passw0rd!

From the taskbar, open Operations Console. In Operations Manager, click Monitoring.

Under Monitoring, expand Microsoft SQL Server (new). Click Computers.

This shows a view of all SQL Server instances regardless of role or configuration and the overall health.

In this lab environment, SQL Server might be in a state other than healthy. This is expected.

Click SQL Server Roles, and then click MSSQLSERVER.

This shows an overall view of health by role, and then provides detailed information on that instance of SQL Server.

Expand SQL Server Database Engines, and then expand SQL Server 2014. Click All Performance Data.

Because there is a very light load on the SQL Server server and because the SQL Server server has not been running long in the lab environment, many of the counters will not have any data. In the next steps, you will choose counters that have some data to show.

In the bottom pane, under Legend, click the Look for: drop-down box, and then click Items by

text search. In the search field, type Average, and then check the Average Wait Time (ms) counter. In the search field, type Lock Requests, and then check the Lock Requests/sec counter. In the search field, type Page, and then check the Page life expectancy counter.

In the search field, type Stolen, and then check the Stolen Server Memory (MB) counter. Click the Look for: drop-down list, and then select Items in the Chart.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 10 Managing SQL Server 2014 with System Center 2012 R2

You should see the four counters you selected.

In the Tasks pane, click Select Time Range. In the Time Range dialog box, click Select a time range, enter 30 Minutes as the time range, and then click OK.

You should see some data associated with most, if not all, of the counters.

In the navigation pane, click Instance Summary.

This dashboard contains a summary of instance health and performance. It may take a minute to load.

Continue to explore elements of the management pack, when you have finished, move to the next task.

Use Operations Manager to correct a problem in SQL Server

In this task, you will simulate a failure in SQL Server and use Operations Manager to correct the problem. This is a simple problem in which the MSSQLService has stopped. In this lab environment, the polling cycle for this particular issue has been reduced to 5 seconds to ensure you see immediate results. The default polling is 15 minutes. This is changed through a management pack override.

Begin this task logged on to SCOM01 as Contoso\Administrator using the password Passw0rd!

On the taskbar, click Windows PowerShell.

Type the following command, and then press ENTER.

↪ ICM SCSQL01 {stop-service MSSQLSERVER -force}

This will stop the MSSQLServer service on SCSQL01.

Switch to the Operations Manager console. Under Microsoft SQL Server (new), right-click Active Alerts, and then click Refresh.

You may have to wait a few seconds for the MSSQL 2014: SQL Service Stopped alert to appear. Refresh the view until the alert appears.

Click the alert name MSSQL 2014: SQL Server Service Stopped.

In the Tasks pane on the right side, under Tasks, click Health Explorer.

Health Explorer provides the ability to see detailed information on a large number of monitors associated with a particular scope. You may have to scroll down to see the Health Explorer selection. Alternatively, you can right-click the alert, point to Open, and then click Health Explorer.

On the left side navigation pane, click SQL Server Windows Service – MSSQLSERVER (SQL

Server 2014 DB Engine).

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 11 Managing SQL Server 2014 with System Center 2012 R2

Read the information under Summary and Causes. Under Resolutions, click Start SQL DB Engine service.

In the Run Task – Start SQL Server Service dialog box, click Run. When the task is complete, click Close.

The alert will vanish after a few minutes, since it is resolved. If it doesn’t vanish within a few minutes, click Refresh on the menu bar.

Close Health Explorer.

In the left navigation pane, click Task Status.

Notice the completed task.

Click the Start SQL Service task.

In the Tasks pane, scroll down to SQL Server 2014 DB Engine Tasks.

Notice that you also have the option to start the SQL Server service from here.

Review the System Center Advisor Connector

System Center Advisor is an online service that collects data from your infrastructure, analyzes it, and then provides alerts based on potential issues, such as missing updates or configurations that do not align with best practices. System Center Advisor can provide both current and historical views of your infrastructure configuration.

The System Center Advisor consists of a web service hosted in and an on-premises installation of a gateway and agent. The agent collects data from your environment and synchronizes it with the web service. Administrators can log on to System Center Advisor to review information about the environment and any alerts that require attention and remediation.

System Center Advisor can be attached to your infrastructure as a standalone service; however, it can also be attached to Operations Manager. In this case, the agent communicates directly with the management service, extending the value of Advisor to Operations Manager.

In this task, you will review the connector between Operations Manager and System Center Advisor.

Perform this task logged on to SCOM01 as Contoso\Administrator using the password Passw0rd!

In the Administration workspace, click System Center Advisor, and then click Advisor Managed.

This provides a view of the computers that are registered with the Advisor service.

Click Advisor Connection.

The connection has already been set up and initial data collection performed against the environment to collect data. However, because this lab instance has no Internet connection, no information is currently being collected and sent from the instance to the online Web service.

Click Monitoring, and then expand System Center Advisor.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 12 Managing SQL Server 2014 with System Center 2012 R2

Click Active Alerts to see the alerts.

You will see both critical and warning alerts. This is expected in this lab environment.

In the Look for: box, type SCOM01, and then press ENTER.

The output is filtered for alerts and warnings specific to SCOM01.

Click the critical alert named Missing Operating System Update KB2905412, and examine the details of the alert in the bottom pane.

An Advisor alert contains information about the computer or instance where the alert was discovered and remediation information to address the issue.

In the Tasks pane, under Advisor Tasks, note that you have the option to click View Solution/KB

Article.

You may have to scroll down in the task pane to see the Advisor Tasks section.

In an environment where you had a connection to the Internet, clicking the link would cause Internet Explorer to open and display the relevant knowledge base article.

Click the warning alert named Hotfixes are available for File Services in Windows Server 2012 and Windows Server 2012 R2, and examine the details in the bottom pane.

Continue to explore the other alerts and warnings for a few minutes.

Note that the alerts are related to configuration best practices, for example missing patches and lack of backups, that would be helpful to an administrator to ensure that best practices were adhered to.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 13 Managing SQL Server 2014 with System Center 2012 R2

Exercise 3: Deploy SQL Server Instances using System Center Virtual Machine Manager

System Center Virtual Machine Manager 2012 R2 allows you to deploy services. Services are multi-layer solutions consisting of applications and operating systems deployed in virtual machines. Virtual Machine Manager fully supports SQL Server automated deployments when deployed as part of a virtual machine. In this exercise, you will configure a SQL Server deployment and deploy it using System Center 2012 R2 Virtual Machine Manager.

Review System Center Virtual Machine Manager library items

In this task, you will review a series of library objects that were pre-created to save time. These objects include a hardware profile, an operating system profile, and a SQL Server profile.

Begin this task logged on to SCVMM01 as Contoso\Administrator using the password Passw0rd!

On the taskbar, click Virtual Machine Manager Console. Click Library, and then click Profiles.

In the search text box, above the contents pane, type SQL, and then press ENTER.

This will return the profiles which contain the text SQL. There are five profiles.

Double-click PetShop-HW-SQL, and then click Hardware Profile.

This profile contains the virtual hardware settings for the virtual machine including items such as memory, disk, and CPU.

Click Processor. Review the settings available here. Click Memory. Review the settings available here.

This virtual machine template is set to use Dynamic Memory, which will optimize the delivery and removal of virtual machine memory based on the demand of the guest operating system.

Click OK. Double-click PetShop-GuestOS-SQL, and then click Guest OS Profile.

This profile contains the operating system roles and features to be added, including computer name,

product key, and other installation-related settings typically found in an unattended answer file.

Click Roles. Scroll down to observe the different Windows Server roles that will be enabled as part of this template deployment. Click Features. Scroll down to observe the different Windows Server features that will be enabled as part of this template deployment.

Click OK. Double-click PetShop-SQL, and then click SQL Server Configuration.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 14 Managing SQL Server 2014 with System Center 2012 R2

The SQL Configuration is the heart of the solution and contains the information to install SQL Server in the virtual machine. This profile contains the minimum settings needed to install a database server, but also includes the ability to specify a SQL Server configuration file, which can perform a fully-customized installation of SQL Server. This is located under Configuration of the deployment.

Click SQL Server Deployment. Here you will see the instance name, ID, and appropriate run as account. Click Configuration. Here you will see the source files for the SQL Server installation, along with relevant accounts.

Click OK.

Double-click PetShop-App-SQL, and then click Application Configuration.

The application package contains a specific SQL Server database solution that will be added to the server once the deployment is completed. This is only required if you are deploying SQL Server in a scale-out scenario for an existing SQL application.

Click SQL Server Data-Tier. This is where you will find information on SQLDAC packages used to configure SQL Server databases on top of the SQL Server installation specified earlier.

Click OK.

Create a SQL Server VM template

In this task, you will use the objects you explored in previous tasks to build a new VM template for deployment of SQL Server.

Begin this task logged on to SCVMM01 as Contoso\Administrator using the password Passw0rd!

In Library, under Templates, click VM Templates. On the ribbon, click Create VM Template. On the Select Source page, select Use an existing template or virtual hard disk stored in the

library, and then click Browse. Select VM_PetShop_Web, and then click OK.

Click Next.

In VM Template Name, type Basic SQL Server, and then click Next. In Configure Hardware, in Hardware profile, select PetShop-HW-SQL, and then click Next. In Configure Operating System, in Guest OS profile, select PetShop-GuestOS-SQL, and then click Next.

In Application Configuration, click Next. In SQL Server Configuration, in SQL Server profile, select PetShop-SQL, and then click Next.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 15 Managing SQL Server 2014 with System Center 2012 R2

Click Create, and then when the job is completed, close the Jobs window.

Create a virtual machine based on the SQL Server VM template

In this task, you will explore the process to deploy a new virtual machine using the SQL Server VM template. Because your VM template contains deployment items such as SQL Server deployments, it must be deployed as a service instead of a single standalone virtual machine.

Begin this task logged on to SCVMM01 as Contoso\Administrator using the password Passw0rd!

In Virtual Machine Manager, click VMs and Services. On the ribbon, click Create Service.

Click Create a Service Template, and then click OK.

The Virtual Machine Manager Service Template Designer opens.

In the New Service Template dialog box, in Name, type SQL Server, in Release, type 1, click

Blank, and then click OK. Drag Basic SQL Server from VM Templates to the work area. In the diagram, double-click Basic SQL Server – Machine Tier 1 to edit the configuration.

The base VM hardware template did not include any network connections, so you will add them now.

Click Hardware Configuration, and then under Network Adapters, click Network Adapter 1.

In the configuration pane, under Connectivity, click Connected to a VM network, and then click

Browse. Click Create VM Network.

In a production environment, the VM networks and other fabric components would likely be pre- configured so that service owners would not need to know the details of the underlying infrastructure in order to deploy a service.

VM Networks in Virtual Machine Manager are out of scope for this lab. Other labs exist which cover this topic in depth.

In Name, type Contoso Data Network, and then click Next.

Click No isolation, and then click Next.

Click Finish. Click Contoso Data Network, and then click OK. Click Network Adapter 2.

In the configuration pane, under Connectivity, click Connected to a VM network, and then click Browse. Click Contoso Data Network, and then click OK.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 16 Managing SQL Server 2014 with System Center 2012 R2

Repeat the previous three steps to attach Network Adapter 3 and 4 to Contoso Data Network. Click OK to close the Properties dialog box.

Following this change, you may need to reposition items on your diagram to fit on the screen.

On the ribbon, click Save and Validate. Close the Virtual Machine Manager Service Template Designer.

Deploy a new SQL Server instance based on the service template

In this task, you will deploy a new SQL Server instance based on the service template you just created.

Because this environment does not have a Hyper-V server to host the VM, you will not be able to fully complete the deployment. The full deployment would take between 30 minutes and 1 hour on adequate hardware.

Begin this task logged on to SCVMM01 as Contoso\Administrator using the password Passw0rd!

On the ribbon, click Create Service.

In Create Service, click Browse. In Select Service Template, select SQL Server, and then click OK. In Name, type SQL Server Deployment, and then click OK.

This will open the deployment designer, where you can configure specifics of the actual deployment

such as the hosts, host groups, or clusters on which to place the service.

The deployment is red, indicating an issue, because no Hyper-V servers exist which can accept this deployment. There are no Hyper-V servers added to this environment.

Close the Deploy Service – SQL Server Deployment window. When prompted, click Delete to clear the settings for this particular deployment.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 17 Managing SQL Server 2014 with System Center 2012 R2

Exercise 4: Automating SQL Server Management with System Center 2012 R2 Orchestrator

In this exercise, you will use System Center 2012 R2 Orchestrator to create a simple runbook to demonstrate the process for creating automation solutions for SQL Server. You will create a runbook which will create a new user based on a user data entered in an employee database.

Configure SQL Server Integration Pack connections

In this task, you will configure the SQL Server integration pack for Orchestrator connection. An integration pack is an add-on for Orchestrator. Microsoft produces a number of integration packs. In addition, Kelverion, a Microsoft Partner and member of the System Center Alliance, provide Orchestrator integration packs to enable organizations to integrate their multi-vendor operational tools and pre-built solutions to solve the most common automation requirements.

Begin this task logged on to SCO01 as Contoso\Administrator using the password Passw0rd!

On the taskbar, click System Center Orchestrator Runbook Designer. On the Options menu, click KA SQL Server.

You will see a number of integration packs in the Options menu – some provided by Microsoft, and a number that are provided by Kelverion. Although you will be using only the SQL Server integration pack from Kelverion in this lab, the lab environment includes a number of others (each designated with a KA

prefix) to provide an idea of the range of integration packs for various platforms. For more information on the integration packs provided by Kelverion, please see http://www.kelverion.com/.

Click Add.

In Name, type HRSQL.

A KA SQL Server configuration represents a connection to a database, not a generic connection to a server.

Click the Ellipsis (…) button next to Type, click SQL Server Options, and then click OK.

It may take a few moments for the properties table to appear.

Complete the Properties table using the values in the following table, and then click OK.

Property Value Server Name SCSQL01 Database Name Employee-Data Authentication Scheme Windows Authentication User Name Contoso\Administrator Password Passw0rd! Connect Timeout 15

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 18 Managing SQL Server 2014 with System Center 2012 R2

Click Finish.

IMPORTANT: This configuration uses the administrator account. This is not recommended, but is used here for simplicity. You only need an account that has the permissions required based on the activities you select. For example, if you include a Monitor List Item activity, you only need read-only permissions.

Create a runbook to create a user based on a list

In this task, you will create and test a basic runbook to create a user based on a list.

Begin this task logged on to SCO01 as Contoso\Administrator using the password Passw0rd!

In Runbook Designer, navigate to SCO01/Runbooks/SC2012Slutions/9.0 SQL Server

Management. Right-click 9.0 SQL Server Management, point to New, and then click Runbook. In the designer pane, right-click New Runbook, and then click Rename. Click Yes.

Type Create User, and then press ENTER. In the Activities pane on the right side, scroll down, and then click KA SQL Server.

The activities pane lists all the default and previously imported integration packs from Microsoft and

third parties.

Drag one Monitor Rows activity and three Update Rows activities to the work area.

Rename Update Rows (2) to Update Rows (Fail User). Rename Update Rows (3) to Update Rows (Fail Group). In the Activities pane, click Active Directory. Drag one Create User Activity and one Add User To Group activity to the work area.

Connect the activities such that the layout is similar to the following graphic. To create the arrows, hover over an activity, and then click and drag the right arrow towards the activity you wish to link

it to.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 19 Managing SQL Server 2014 with System Center 2012 R2

Right-click each item, and then click Properties. Configure properties as shown in the following table.

Activity Property Value Note Monitor Configuration HRSQL Rows Table/View dbo.employees Name Monitor Interval 15 Default value Output Processing Click Optional Properties to select output Filters Processed Equals False Click add on the filters tab to create this entry. Create User Configuration Contoso Common Name CN={Alias from “Monitor Type CN= right-click the field value, Rows”} click Subscribe, and then click Published Data. Choose Alias from the Monitor Rows activity. Display Name {Alias from “Monitor Display name is located in Optional Rows”} Properties, as are other unlisted fields. First Name {First Name from “Monitor Rows”} Last Name {Last Name from “Monitor Rows”} Container CN=users,DC=Contoso,DC Distinguished =COM Name SAM Account {Alias from “Monitor Name Rows”} Add User to Configuration Contoso Group Group CN=Domain Distinguished Admins,CN=Users,DC=Co Name ntoso,DC=COM User {Distinguished Name from Distinguished “Create User”} Name Update Rows Configuration HRSQL Table/View dbo.Employees Name Processed True Click Optional Properties to add Processed. Output User added Filters EmployeeID equals {EmployeeID from “Monitor Rows”}

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 20 Managing SQL Server 2014 with System Center 2012 R2

Activity Property Value Note Update Rows Configuration HRSQL (Failed User) Table/View dbo.Employees Name Output {Error Summary Text from Click Add, right-click the Value “Create User”} box, click Subscribe, click Published Data, and then change Activity to Monitor Rows. Check Show Common Published Data to see Error Text Summary as an available item Filters EmployeeID equals Click Add, right-click the Value {EmployeeID from box, click Subscribe, click “Monitor Rows”} Published Data, and then change Activity to Monitor Rows. Update Rows Configuration HRSQL (Failed Group) Table/View dbo.Employees Name Output {Error Summary Text from Click Add, right-click the Value “Add user to Group”} box, click Subscribe, and then click Published Data. Check Show Common Published Data to see Error Text Summary as an available item Filters EmployeeID equals Click Add, right-click the Value {EmployeeID from box, click Subscribe, click “Monitor Rows”} Published Data, and then change Activity to Monitor Rows.

Double-click the arrow connecting Create user to Update Rows (Failed User).

Click Success, uncheck Success, check Warning and Failed, and then click OK. Click Finish. Double-click the arrow connecting Add User To Group to Update Rows (Failed Group).

Click Success, uncheck Success, check Warning and Failed, and then click OK.

Click Finish.

Test the create user runbook

In this task, you will test the create user runbook. You will first start the runbook and then create a row in a SQL Server database that is used to store user data.

Begin this task logged on to SCSQL01 as Contoso\Administrator using the password Passw0rd!

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 21 Managing SQL Server 2014 with System Center 2012 R2

In SQL Server Management Studio, if the query window is not open from the previous exercise, click New Query.

Type the following query, and then press CTRL+E.

Ensure you are running the query against Employee-Data, and not Employee-DataRestore from earlier.

↪ select * from [Employee-Data].[dbo].[Employees]

You see a list of users. Note the value in the Processed column. A value of 0 (False) is used as a filter for the monitor rows runbook activity. The activity will only process rows where the Processed column is set to False. Also notice that there is no data in the output column. This cell will be populated with data by the update rows runbook activities. Finally, notice that there is a duplicate entry for Alice Ciccu. This duplicate entry was created to test the logic of the runbook.

Switch to SCO01. In Runbook Designer, click Runbook Tester.

Click Run.

The Runbook Tester will be visible. Within 15 seconds you should see the runbook begin to execute.

The runbook should show a number of tasks, each showing success, with the notable exception of two Create User activities that fail for the duplicate entry you examined earlier and another entry that collides with a pre-existing entry in Active Directory (Ben Smith).

Locate the failure entry in the log, and then click Show Details.

The error summary text provides the reason for the user creation failure.

Switch to SCSQL01, and then in the Query window, press CTRL-E to run the query again.

The Processed and Output fields have been updated by the runbook to indicate that the users were added to Active Directory. Optionally, you can review the new users in the Users container in Active Directory. Notice the error text output for the duplicate user.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 22 Managing SQL Server 2014 with System Center 2012 R2

Exercise 5: Monitoring the Health of SQL Server Backups using System Center 2012 R2 Operations Manager

In this task, you will use Operations Manager to ensure that the Data Protection Manager infrastructure which you configured earlier in this lab is healthy, and that backups are happening as expected. By delaying this task until the end, you have made it possible for the Operations Manager agent running on SCDMP01 to report more data to Operations Manager. The SCDPM01 server already has the Operations Manager agent deployed, and has been reporting status information to the Operations Manager infrastructure.

Begin this task logged on to SCOM01 as Contoso\Administrator using the password Passw0rd!

On the taskbar, click Operations Console. In Operations Manager, under Monitoring, scroll down, and then expand System Center 2012 R2 Data Protection Manager\State Views.

Click DPM Servers.

The monitors may show a status of critical for the Protected Computer or Resource Group because you recently stopped and then started SQL Service. It may take a few moments for its status to be reported as healthy.

Click SCDPM01.

Notice the context sensitive actions on the right pane under DPM Server Tasks.

Click Disks. Click Protected Servers.

This lists all servers currently being protected by DPM.

Click Protection Groups.

This shows the health of any protection groups created by DPM. You may see that the status for the State is healthy; however, it may be the case that the DPM Data Source cell shows a status of Critical.

In the details pane, click the cell showing the status (Healthy or Critical) of the DPM Data Source.

Note that the Detail View in the bottom pane shows the status of the database backups.

Right-click the SQL Protection Group, point to Open, and then click Health Explorer for SQL

Protection Group. Currently the scope is only to unhealthy monitors, of which there should not be any. To the right of Scope is only unhealthy child monitors, click X.

This will cause both healthy and unhealthy monitors to appear.

Expand Configuration.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 23 Managing SQL Server 2014 with System Center 2012 R2

Browse through the different configuration monitors that are provided as part of the management pack.

Close the Health Explorer, and then close Operations Manager.

This is the end of the lab.

Lab created by HynesITe, Inc. For questions or comments, send an email message to [email protected] Page | 24