Microsoft SQL Server 2008 Administration with Windows PowerShell docx

580 912 1
Microsoft SQL Server 2008 Administration with Windows PowerShell docx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Microsoft ® SQL Server ® 2008 Administration with Windows PowerShell ™ www.wrox.com $59.99 USA $71.99 CAN Wrox guides are crafted to make learning programming languages and technologies easier than you think. Written by programmers for programmers, they provide a structured, tutorial format that will guide you through all the techniques involved. Recommended Computer Book Categories Database Management General ISBN: 978-0-470-47728-1 Arul Kumaravel, Jon White, Naixin Li, Scott Happell, Guohui Xie, Krishna C. Vutukuri Updates, source code, and Wrox technical support at www.wrox.com Wrox Programmer to Programmer TM Professional Windows PowerShell ™ Programming: Snap-ins, Cmdlets, Hosts, and Providers Secure, reliable, and scalable, SQL Server 2008 delivers a dynamic, smart, and productive data platform for all your data-related needs and offers many new features that will change how you administer a database server. Among these new features is the ability to use Windows PowerShell 2.0 scripts to automate and manage various aspects of the Windows environment. Written by well-known and highly respected SQL Server experts, this nuts-and- bolts guide brings together the best of both worlds—database and system administration—to help you manage, automate, and control your environment. You’ll discover how to construct effective and practical solutions that can improve SQL Server administration and monitoring while saving you countless hours of manual effort and ensuring more consistent results. Packed with clear, well-constructed examples throughout, this tutorial-based resource covers the fundamentals of Windows PowerShell so you can get started writing scripts in Windows PowerShell to perform SQL Server 2008 administration tasks immediately. What you will learn from this book ● How Windows Management Instrumentation Providers for SQL Server enable you to manage SQL Server services and network connectivity ● How to manage SQL Server objects, including the new policy objects using the new SQL Server 2008 support for Windows PowerShell ● Ways to use SQL Server Management Objects to create database and database objects, and backup and restore databases ● Techniques for building an SQL Server inventory over an existing or new environment ● Tips for installing, monitoring, collecting performance data, database scripting, and more, using Windows PowerShell ● Various programming features such as inputs, outputs, debugging, functions, and more. Who this book is for This book is for SQL Server database administrators, developers, or system administrators who are looking to manage SQL Server 2008 using Windows PowerShell 2.0. No previous Windows PowerShell experience is assumed. Enhance Your Knowledge Advance Your Career Microsoft ® SQL Server ® 2008 Administration with Windows PowerShell ™ MAK Yan Pan spine=1.152" Updates, source code, and Wrox technical support at www.wrox.com Microsoft ® SQL Server ® 2008 Administration with Windows PowerShell ™ Ananthakumar Muthusamy, Yan Pan Wrox Programmer to Programmer TM Wrox Programmer to Programmer TM Arul Kumaravel, Jon White, Naixin Li, Scott Happell, Guohui Xie, Krishna C. Vutukuri Updates, source code, and Wrox technical support at www.wrox.com Wr ox Prog ram mer to Prog ram mer TM Professional Windows PowerShell ™ Programming: Snap-ins, Cmdlets, Hosts, and Providers Enhance Your Knowledge Advance Your Career Professional SQL Server 2008 Administration ISBN 978-0-470-24796-9 This book is intended for developers, DBAs, and casual users who hope to administer or may already be administering a SQL Server 2008 system and its business intelligence features, such as Integration Services. This book is a professional book, meaning the authors assume that you know the basics about how to query an SQL Server and have some rudimentary concepts of SQL Server already. For example, this book does not show you how to create a database or walk you through the installation of SQL Server using the wizard. Instead, the author of the installation chapter may provide insight into how to use some of the more advanced concepts of the installation. Although this book does not cover how to query an SQL Server database, it does cover how to tune the queries you’ve already written. Microsoft SQL Server 2008 Administration with Windows PowerShell ISBN 978-0-470-47728-1 If you’re an SQL Server database administrator, this book will make your life easier. Windows PowerShell is an administrative scripting tool that allows you to automate many tasks you’re probably currently doing by hand. This nuts-and-bolts guide shows you how to create Windows PowerShell scripts to administer almost every aspect of SQL Server. Professional Windows PowerShell Programming: Snapins, Cmdlets, Hosts and Providers ISBN 978-0-470-17393-0 Providing you with the programmer’s approach to understanding Windows PowerShell, this book introduces the concepts, components, and development techniques for building software packages that leverage the power of PowerShell. Beginning Microsoft SQL Server 2008 Administration ISBN 978-0-470-44091-9 This book teaches you how to develop the skills required to successfully administer an SQL Server 2008 database; no prior experience is required. The material covers system installation and configuration/architecting, implementing and monitoring security controls, configuring and managing network communications, automating administration tasks, disaster prevention and recovery, performance monitoring, optimizing and ensuring high availability, as well as major SQL Server 2008 components including Integration Services, Reporting Services, Analysis Services, and Service Broker. Microsoft ® SQL Server ® 2008 Administration with Windows PowerShell ™ Get more out of WROX.com Programmer to Programmer ™ Interact Take an active role online by participating in our P2P forums Wrox Online Library Hundreds of our books are available online through Books24x7.com Wrox Blox Download short informational pieces and code to keep you up to date and out of trouble! Chapters on Demand Purchase individual book chapters in pdf format Join the Community Sign up for our free monthly newsletter at newsletter.wrox.com Browse Ready for more Wrox? We have books and e-books available on .NET, SQL Server, Java, XML, Visual Basic, C#/ C++, and much more! Contact Us. We always like to get feedback from our readers. Have a book idea? Need community support? Let us know by e-mailing wrox-partnerwithus@wrox.com spine=1.152" Professional SQL Server ® 2008 Administration with Windows PowerShell ™ Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Chapter 1: What Is Windows PowerShell? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 2: Windows PowerShell Command Types, Snap-ins, and cmdlets 15 Chapter 3: Windows PowerShell Programming, Scripting, Error Handling, andDebugging 43 Chapter 4: Windows PowerShell Functions, Parameters, Sourcing, Scopes, and User Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Chapter 5: Working with the File System, Registry, and Variables . . . . . . . . . 93 Chapter 6: Working with Event Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Chapter 7: Working with Windows Services and Processes . . . . . . . . . . . . . . . . 141 Chapter 8: Working with WMI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Chapter 9: WMI Provider for Configuration Management . . . . 197 Chapter 10: WMI Provider for Server Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Chapter 11: Windows PowerShell in SQL Server 2008 Environment, SQLServerPowerShellProvider 241 Chapter 12: Managing Policies through SQLSERVER:\SQLPolicy . . . . . . . . 259 Chapter 13: Windows PowerShell and SMO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Chapter 14: Building SQL Server Standards and PowerShell Coding Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Chapter 15: Building SQL Server Inventory . . . . . . . . . . 333 Chapter 16: SQL Server Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 Chapter 17: Collecting SQL Server Performance and Host Performance Data 401 Chapter 18: Monitoring SQL Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 Chapter 19: Monitoring Disk Space Usage, Database Files, and Backups . . 451 Chapter 20: Defining Policies. . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Chapter 21: Generating Database Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Appendix A: cmdlets . . . . . . . . . . . . 507 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 Professional SQL Server ® 2008 Administration with Windows PowerShell ™ Professional SQL Server ® 2008 Administration with Windows PowerShell ™ Muthusamy Anantha Kumar Yan Pan Wiley Publishing, Inc. Professional SQL Server ® 2008 Administration with Windows PowerShell ™ Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2009 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-47728-1 Manufactured in the United States of America 10987654321 Library of Congress Cataloging-in-Publication Data Kumar, Muthusamy Anantha, 1974- Microsoft SQL server 2008 administration with Windows Powershell / Muthusamy Anantha Kumar, Yan Pan. p. cm. Includes index. ISBN 978-0-470-47728-1 (paper/website) 1. SQL server. 2. Windows PowerShell (Computer program language) I. Pan, Yan, 1976- II. Title. QA76.73.W56K96 2009 005.2’82 dc22 2009013304 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at www.wiley.com/go/permissions . Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read. For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. SQL Server and Windows PowerShell are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. About the Authors Muthusamy Anantha Kumar, aka MAK (MCTS, MCITP: Database Administrator 2008), is currently the Senior SQL Server Database Engineer for a leading global financial services firm on Wall Street. He has published many online articles as a contributing columnist for DatabaseJournal.com .Healsopub- lished online articles for SQL-Server-Performance.com and SQLServercentral.com . His articles can be found at www.mssqlengineering.com . He also teaches SQL Server Database Administration online at the University of West Florida. MAK has been working in information technology formorethan10years.Hehasworkedinthetechnol- ogy side of the finance, dot com, B2B, and software industries. His past clients include Fort James, Boston Financial, PCConnection, PurchaseSoft, Merrill Lynch, and Jefferies. MAK holds an M.B.A. degree and various certifications in the computer field. He also teaches Microsoft SQL Server and has taught many SQL Server developers and DBAs. He has master’s degree in Business Administration. MAK lives in New Jersey. He can be reached at mak_999@yahoo.com . Yan Pan (MCITP, MCDBA, OCA) is a Senior DBA for a leading global financial services firm, where her daily duties include administering hundreds of SQL Server and Oracle servers of every possible version, working with business units, and troubleshooting database performance problems. She is also a contributing columnist for DatabaseJournal.com . Her articles can be found at www.yanpansql.com . Previously, Yan worked as a SQL Server DBA and a .NET developer at Data Based Ads, Inc., and devel- oped two .NET Web applications. Before that, she worked at AT&T Research Labs. She designed OLAP cubes with SQL Server Analysis Services and developed PivotTable reports for regional managers. She has master’s degrees in Computer Science and Physics. Yan lives in Chicago, IL. She can be reached at yanpansql@yahoo.com . [...]... run on Windows XP, Windows Vista, Windows Server 2003, and Windows Server 2008 Although Windows PowerShell is included as part of Windows Server 2008, it is not installed by default on Windows XP, Windows 2003, or Windows Vista At the time of writing, Windows PowerShell 1.0 is visible as a feature in Windows Server 2008 that can be turned on Windows PowerShell 1.0 is also installed with Exchange Server. .. handling in PowerShell It covers all Windows administration related to SQL Server 2008 using Windows PowerShell 2.0 It also introduces Windows Management Instrumentation (WMI) and explains how to write WMI scripts in Windows PowerShell to perform system and SQL Server 2008 administrative tasks This book also covers the WMI providers for SQL Server These useful providers enable you to manage SQL Server services... monitor SQL Server events You will also discover the new Eventing feature in Windows PowerShell 2.0 Additionally, the new SQL Server 2008 support for Windows PowerShell is presented It illustrates the SQL Server PowerShell provider and SQLSERVER: drive You will also learn how to manage SQL Server objects, including the new policy objects One more important topic this book covers is using SQL Server. .. administer every aspect of the SQL Server 2008 Database Engine Using a very hands-on approach, this book guides you through the basics of Windows PowerShell, the available Windows PowerShell components that have been integrated into SQL Server 2008, and the actual administration tasks By providing clear, well-structured examples, SQL Server 2008 Administration with Windows PowerShell shows you how to... Provider for Server Events WMI Query Language (WQL) Event Handling with Windows PowerShell 2.0 Monitoring Errors from the SQL Server Error Log Monitoring Deadlocks Monitoring Blockings Monitoring Login Changes and Failed Login Attempts Monitoring Databases Monitoring Database Objects Summary Chapter 11: Windows PowerShell in SQL Server 2008 Environment, SQL Server PowerShell Provider sqlps Utility SQLSERVER:... Collecting SQL Server Performance and Host Performance Data SQL Server Performance Data Collection SQL Server Host Performance Data Collection Summary Chapter 18: Monitoring SQL Server Pinging SQL Server Hosts Checking SQL Server related Services on SQL Server Hosts Checking Uptime of SQL Server Hosts Monitoring Windows Event Logs Monitoring SQL Server Error Log Monitoring Blockings Monitoring Deadlocks... features in SQL Server 2008 and provides plenty of examples demonstrating how to manage SQL Server 2008 using Windows PowerShell 2.0 This book is also appropriate for those who have some exposure to systems administration and SQL Server administration, or for those who want to expand their skill set to include administration What This Book Covers This book covers the fundamentals of Windows PowerShell. .. also discover the new Eventing feature in Windows PowerShell 2.0 Chapters 11 and 12 take on the Windows PowerShell support that has been integrated into SQL Server 2008, namely, the SQLSERVER: drive These two chapters will focus on the SQL and SQLPolicy folders separately Chapter 13 shows you how to write SQL Server Management Objects (SMO) programs in Windows PowerShell 2.0 This chapter covers various... book have been tested on SQL Server 2008 with NET Framework 3.5 and Windows PowerShell 2.0 CTP3 We tested all the scripts on Windows XP, Windows Server 2008, and Windows Vista Most of the scripts and code illustrated here work under Windows PowerShell 1.0 as well, although you may notice that the output of such scripts and codes differs slightly, and that remoting under Windows PowerShell 1.0 is not possible... Drive and Invoke-Sqlcmd cmdlet SQL Snap-ins Encoding and Decoding Uniform Resource Name (URN) Summary xvi 219 220 221 225 226 229 233 235 236 239 241 241 245 245 256 258 Contents Chapter 12: Managing Policies through SQLSERVER:\SQLPolicy SQLSERVER:\SQLPolicy Folder Conditions Policies Summary Chapter 13: Windows PowerShell and SMO PowerShell and the SQLConnection NET Class Working with SQL Server using . 531 Professional SQL Server ® 2008 Administration with Windows PowerShell ™ Professional SQL Server ® 2008 Administration with Windows PowerShell ™ Muthusamy. Windows PowerShell in SQL Server 2008 Environment, SQL Server PowerShell Provider 241 sqlps Utility 241 SQLSERVER: Drive and Invoke-Sqlcmd cmdlet 245 SQL

Ngày đăng: 05/03/2014, 20:20

Từ khóa liên quan

Mục lục

  • Microsoft SQL Server 2008 Administration with Windows PowerShell

    • About the Authors

    • Credits

    • Acknowledgments

    • Contents

    • Introduction

      • Who This Book Is For

      • What This Book Covers

      • How This Book Is Structured

      • What You Need to Use This Book

      • Conventions

      • Source Code

      • Errata

      • Chapter 1: What Is Windows PowerShell?

        • Command-Line Interfaces versus Graphical User Interfaces

        • Prerequisites for Installing Windows PowerShell 2.0

        • Installing Windows PowerShell

        • Launching Windows PowerShell

        • Summary

        • Chapter 2: Windows PowerShell Command Types, Snap-ins, and cmdlets

          • PowerShell Command Types

          • PowerShell Snap-ins

          • PowerShell cmdlet Syntax

          • Getting Help

Tài liệu cùng người dùng

Tài liệu liên quan