Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Peter A. Carter

Rating No ratings yet

The market is trending toward a much smaller ratio of DBAs to SQL Server instances, but this book will help you meet this new reality by harnessing automation to continue building and maintaining reliable database platform services for your SQL Server enterprise. The book will help you automate your workload and manage more databases and instances with greater ease and efficiency by combining metadata-driven automation with the power of PowerShell. You'll soon be able to automate your new instance-builds and centralize your maintenance. This book walks you through automating the SQL Server build processes and maintenance of multiple instances from a single location, as well as how to use database metadata to drive your automation. With a heavier focus on PowerShell, this 2nd edition highlights modern techniques, such as configuration management. Also new in this edition, you will learn how to use PowerShell modules such as SqlServer and DBATools, which is a popular community module that you can rely on to keep your database estate running smoothly. You will understand the benefits of centralizing maintenance to better keep your enterprise responding with reliable performance to the loads placed upon it by your business. The book helps you become faster and better at what you do for a living, and thus will boost your value within the job market. What You Will Learn • Automate SQL Server installation and configuration • Apply techniques such as Desired State Configuration to prevent drift on your servers and instances • Increase your value to your organization by automating low-value tasks and focusing your time on the higher-value ones • Take advantage of database metadata to drive automation, allowing you to build intelligent automated routines • Promote and demonstrate how to modernize database maintenance across your enterprise • Apply tools such as PowerShell with modern techniques to increase your value in the job market

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical playbook for SQL Server DBAs who must manage ever more instances with ever less headcount, showing how to combine PowerShell, community modules, and metadata-driven routines into a single automated maintenance platform. Best for working DBAs and platform engineers who already know T-SQL and want to move from hand-crafted scripts to repeatable, centralized automation. 【Book Arc】 - **Opening (~0%–10%)**: Sets up the shrinking DBA-to-instance ratio as the core problem, then builds the T-SQL foundation — XML handling, `FOR XML` modes, and the XML `query`/`value`/`nodes` methods — that later automation reads from. - **Early (~10%–32%)**: Moves into PowerShell fundamentals (execution policy, Verb-Noun standards, variables, operators, flow control, modules) and then into Desired State Configuration, covering configurations, resources, and the Get/Test/Set model that prevents server drift. - **Middle (~32%–48%)**: Works through the Microsoft `sqlserver` module in practice — `Invoke-SqlCmd` basics, parameters, error output, execution context, and managing logins, roles, users, credentials, and Availability Groups, including backup/restore and adding databases to an AG. - **Late (~48% onward)**: Introduces the community `DbaTools` module as the answer to `sqlserver`'s gaps, focusing on end-to-end login/user management and SQL Server Agent artifacts, with pointers to the full command list. - **Ending**: The excerpts do not cover the closing chapters in detail, so the final synthesis of metadata-driven automation and centralized maintenance is only implied by the blurb and table of contents. 【Key Takeaways】 - **Automation is a headcount strategy, not a hobby** (Opening): The book frames scripting as the way to keep service quality steady as DBA-to-instance ratios shrink. - **T-SQL is the data layer of your automation** (Opening): XML output from `FOR XML` and the XML methods let queries feed structured data into scripts rather than just returning rows. - **PowerShell discipline pays off later** (Early): Approved verbs, meaningful variable names, and explicit typing are presented as maintainability rules, not style preferences. - **DSC is the antidote to configuration drift** (Early): Configurations describe desired state; resources implement it via Get/Test/Set, so servers self-correct instead of being manually re-fixed. - **`Invoke-SqlCmd` returns rich objects, not strings** (Middle): You must work with properties like `$Database.name`, and can pass variables, timeouts, and error output deliberately. - **The `sqlserver` module has real gaps** (Middle): Logins, users, and Agent artifacts often require dropping into SMO or switching modules. - **`DbaTools` fills those gaps** (Late): With hundreds of cmdlets, it offers end-to-end management the Microsoft module does not, especially for security objects and Agent jobs. - **Centralized maintenance is the payoff** (Late): Managing many instances from one location is the recurring goal connecting DSC, modules, and metadata-driven routines. 【Reading Tips】 - Deep-read the DSC chapter if you own drift problems; skim the PowerShell fundamentals if you already script daily. - Treat the `sqlserver` vs. `DbaTools` comparison as a decision guide — note which tasks force you into SMO. - Run the examples against a default instance with AdventureWorks2022, as the book assumes; set execution policy to Unrestricted for the samples. - Keep the DbaTools command list open alongside the book; the text deliberately covers only selected gaps. - Extract the patterns (parameter splatting, variable arrays, timeout settings) rather than memorizing individual cmdlets. 【Coverage Limits】 This guide is based on stratified excerpts covering roughly the first half of the book plus the table of contents; later chapters on metadata-driven automation and centralized maintenance are only partially represented, so specifics there are inferred from the blurb rather than the excerpts.
Excerpt 1
ation, allowing you to build intelligent automated routines • Promote and demonstrate how to modernize database maintenance across your enterprise • Apply to...
View in text
Excerpt 2
tement FROM sys.query_store_plan ; value and nodes Methods The value method will extract a singleton value from an XML document, mapped to a SQL Server data...
View in text
Excerpt 3
ganizations which use either azure or arc-enabled servers. the DSC code has actually been branched, so that DSC 1.1 is still supported but not maintained. th...
View in text
Excerpt 4
here, so we will need to interact with SMO. The script in Listing 4-21 uses a similar technique to the example above, where we added our Login to the dbcreat...
View in text
Excerpt 5
yyyyMMdd startTime The time when the schedule should begin. acceptable formats are hhMMss with a 24-hour clock endTime The time when the schedule should end....
View in text
Excerpt 6
th the $InstanceName variable, placing a \ between the two. This concatenated value populates the $ConnectionString variable, which can then be passed into t...
View in text
Excerpt 7
; " } foreach ($database in $databases) { Invoke-DbaQuery @params -Database $database } This script uses the XML data() method technique to build and execute...
View in text
Excerpt 8
re, an instance name will become the key of the entity. 192 Chapter 8 Building an
View in text
Tags
AI categories
DatabaseDevOpsProgramming Language
ISBN: 8868811502
Publisher: Apress
Publish Year: 2025
Language: English
Pages: 296
File Format: PDF
File Size: 4.5 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…