SQL Server Tacklebox Essential Tools and Scripts for the day-to-day DBA Rodney Landrum High Performance SQL Server ISBN: 978-1-906434-24-3 SQL Server Tacklebox Essential Tools and Scripts for the day-to-day DBA By Rodney Landrum First published by Simple Talk Publishing 2009 Copyright Rodney Landrum 2009 ISBN 978-1-906434-24-3 The right of Rodney Landrum to be identified as the author of this work has been asserted by him in accordance with the Copyright, Designs and Patents Act 1988 All rights reserved. No part of this publication may be reproduced, stored or introduced into a retrieval system, or transmitted, in any form, or by any means (electronic, mechanical, photocopying, recording or otherwise) without the prior written consent of the publisher. Any person who does any unauthorized act in relation to this publication may be liable to criminal prosecution and civil claims for damages. This book is sold subject to the condition that it shall not, by way of trade or otherwise, be lent, re-sold, hired out, or otherwise circulated without the publisher's prior consent in any form other than which it is published and without a similar condition including this condition being imposed on the subsequent publisher. Technical Review by Shawn McGehee Cover Image by Paul Beckman Edited by Tony Davis Typeset by Gower Associates Table of Contents About the author vi About the technical reviewer vi Acknowledgements vii Introduction viii Code Download x Chapter 1: Eating SQL Server installations for breakfast 11 Specification, installation, configuration 12 Specifying the physical server 12 Ready to install – almost 14 Installation done, now to configure 19 Bon Appétit 31 Chapter 2: The SQL Server landscape 32 What information is required? 33 Automating information retrieval 44 Summary 59 Chapter 3: The migratory data 61 Mapping out the data migration solution 62 The data source 63 Bulk data transfer tools 64 SSIS 72 Data comparison tools 78 "High Availability" tools 84 Summary 93 Chapter 4: Managing data growth 94 Common causes of space issues 95 Being a model DBA 96 Indexes and large row counts 107 TempDB 115 A query to determine current space utilization 119 Summary 122 Chapter 5: DBA as detective 123 System tables versus DMVs 123 Tracking down database performance issues 124 Automating discovery of problems 136 Summary 143 Chapter 6: Monitoring and notifications 145 Types of monitoring and notifications 145 Enabling notifications 148 Backup failure notification 154 Performance issues 159 Stopped services and disk space shortage 166 Summary 168 Chapter 7: Securing access to SQL Server 169 Overview of security challenges 169 Finding SQL logins, Windows users and groups 171 Find Windows Active Directory group membership 175 Find SQL users at the database level 179 Loading up the DBA repository with security data 182 Finding service accounts with WMIC 182 . SQL Server Tacklebox Essential Tools and Scripts for the day-to-day DBA Rodney Landrum High Performance SQL Server ISBN: 978-1-906434-24-3 SQL Server Tacklebox Essential. Securing access to SQL Server 169 Overview of security challenges 169 Finding SQL logins, Windows users and groups 171 Find Windows Active Directory group membership 175 Find SQL users at the. viii Code Download x Chapter 1: Eating SQL Server installations for breakfast 11 Specification, installation, configuration 12 Specifying the physical server 12 Ready to install – almost 14