| Lausanne SQL Server et PowerShell David Barbarin Database Architect - Insentia...

Post on 04-Apr-2015

122 views 1 download

Transcript of | Lausanne SQL Server et PowerShell David Barbarin Database Architect - Insentia...

| Lausanne

SQL Server et PowerShellDavid BarbarinDatabase Architect - Insentiadavid.barbarin@insentia.chMVP & MCM SQL Server

Business Intelligence

Data Management

Collaborative Solutions

Enterprise Content Management

Social Business Services

Business Solutions SharePoint

SQL Server

Dynamics NAV CRM

insentia en quelques mots55 collaborateursMembre de VeltigroupPrésence Suisse

Genève, Lausanne, Bern, Zurich

Agenda

Avantages et inconvénients 5’

SMO et fournisseur SQL Server 15’

Cas d’utilisation 35’

| Lausanne

Avantages et inconvénients

PowerShell et SQL Server

Historique

Avec SQL Server 2008 Utilisation d’un mini-shell sqlps avec limitation d’utilisation

Avec SQL Server 2012 Le mini shell n’existe plus et sqlps peut être chargé en tant que module

Environnement Power Shell plus complet Possibilité de charger d’autres modules ou snap-ins

Avantages et inconvénients

Inconvénients Prise en main de PowerShell peut être compliqué pour les DBA non développeurs Peut rendre plus complexe les opérations DBA au jour le jour. L’utilisation de T-SQL

est plus adapté dans ce cas

Avantages Langage commun d’administration des serveurs Windows (Windows, Exchange,

SharePoint, SQL Server …) Environnement de script étendu à l’utilisation du Framework .NET Accès aux ressources externes à SQL Server contrairement au langage T-SQL Possibilité d’exécuter les requêtes T-SQL par l’utilisation de cmdlets ou objets SMO

Exemple de cas d’utilisation

Inventaire d’instances SQL Server

Provisionnement semi-automatisé d’instances SQL Server

Template de création d’objets SQL Server pour des super utilisateurs non DBA

Rafraîchissement de bases de données entres différents environnements (production test)

Automatisation de vérification de la gestion des règles (Policy Based Management)

Formatage de résultats en sortie d’un benchmark SQLIO

Monitoring

| Lausanne

SMO et fournisseur SQL Server

PowerShell et SQL Server

Server Management Objects (SMO) SMO est une librairie .NET contenant un ensemble d’objets, propriétés, méthodes,

interfaces, énumérations etc… permettant de travailler avec SQL Server

Le modèle objet montre l’ensemble des objets utilisables et leurs relations intrinsèques

Tous les objets du modèle héritent du nœud racine « Server»

Diagramme : http://bit.ly/smodiagram

Namespace : http://bit.ly/smonamespace

Server Management Objects (SMO)

Fournisseur SQL Server

PSSnapin (2008 et PowerShell V1) SqlServerProviderSnapin100 SqlServerCmdletSnapin100

Import module (2012 et PowerShell V2)

Cmdlets pour SQL Server

Permet la navigation comme dans une structure de dossiers / fichiers pour interagir avec SQL Server

Types et formats

Mapping fournisseur SQL - SMO

| Lausanne

DEMONSTRATION

PowerShell et SQL Server

Cas d’utilisation

Installation automatisée d’une ou plusieurs instances SQL Server

Ajout d’une instance SQL Server dans un serveur centralisé (CMS)

Inventaire d’instances SQL Server

Application de règles de gestion automatisée sur des instances SQL Server

Installation automatisée d’un environnement SQL Server AlwaysOn

Sauvegarde vers Windows Azure

| Lausanne

Merci de votre écoute

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a

commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a

commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.