Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit testing for your database infrastructure

Similar presentations


Presentation on theme: "Unit testing for your database infrastructure"— Presentation transcript:

1 Unit testing for your database infrastructure
dbachecks Unit testing for your database infrastructure

2 About Me 1 Frank Henninger dbachecks 10+ years as a DBA
Oracle on Linux IBM DB2LUW on AIX SQL Server on Windows Contributor for dbatools and dbachecks Contact info SQLCommunity Twitter 1

3 And how does it apply to you?
dbachecks What is unit testing? And how does it apply to you? At a high-level, unit testing refers to the practice of testing certain functions and areas – or units – of our code. -Tom McFarlin How many of you spent time as software developers? What do they mean when they talk about unit tests? How does that apply to a typical dba? 2

4 Where’s your checklist?
dbachecks Where’s your checklist? You have one, right? Why do we need one? Consistency Best Practices Dot the i’s Cross the t’s Every dba needs to have a checklist for system install. It’s pretty much a given that without one, every instance will be setup differently. Checklists are a key method of enforcing standards. So a checklist is great, however, we all know that environments change over time. 3 1

5 Checklists aren’t everything
dbachecks Checklists aren’t everything All environments change Backup location Network setup Users Best Practices Upgrades A checklist isn’t foolproof. Item’s can and will be skipped. The environment may change. Users need managed. Best practices change. An environment is in constant flux What is the oldest environment you support? Were you around to set it up? How has the environment changed? 4

6 Yup, I pulled a switcheroo
dbachecks Environment testing Yup, I pulled a switcheroo We need a way to constantly check our environment to make sure common practices stay in place over time. This is where dbachecks comes to the rescue. 5

7 dbachecks Powershell to the rescue Pester DBATools PSFramework 6
dbachecks is a framework created by and for SQL Server pros who need to validate their environments. Basically, we all share similar checklists and mostly just the server names and RPO/RTO/etc change. Pester DBATools PSFramework Test and mock framework for PowerShell. Community driven module to help make dba’s lives easier Configuration management and logging DBAChecks sits on top of three other excellent powershell modules. Pester which is supported by Microsoft itself. DBATools which has a community of several thousand members behind it. PSFramework excellent module from Fred Wienmann to manage and persist configurations. 6

8 Prebuilt tests 7 Agent Database Domain HADR Instance Log Shipping
dbachecks Prebuilt tests Agent Database Agent account set to automatic, Operators exist, Mail profile setup, Standard alerts, etc. Last Backup Time, Backup location accessible, Suspect Page detection, Future File Growth, Orphaned Users, Recovery Model Domain HADR Host in correct domain and OU Cluster Health Instance Log Shipping AD-Hoc workload, Supported Build, Valid AD User, Backup Access Path, Linked Server Connectivity, Orphaned Files Primary and Secondary status Maintenance Solution Server Ola’s Maintenance Solution installed, Jobs setup, Full/Diff/Log backups due Disk Capacity, Disk Allocation Unit, SPN setup 7

9 dbachecks How-To Install find-module dbachecks | install-module -SkipPublisherCheck Skip publisher check is needed due to Pester dependency1 Powershell 4+ required. 8 1https://github.com/pester/Pester/wiki/Installation-and-Update

10 Demo Time Installation List of Checks Groups & Tags Initial Run
dbachecks Demo Time Installation List of Checks Groups & Tags Initial Run Reporting via PowerBI Configuration Stacking configuration Advanced Reporting 13

11 Usage Find commands via Get-Command -Module dbachecks
See all checks with Get-DbcCheck Each check has a group and a unique tag Multiple checks can be run at once Multiple instances can be tested Tests proceed linearly. Documentation available at 9

12 dbachecks Usage Tests are run via the Invoke-DbcCheck command. 10

13 Configuration Tests can be configured with Set-DbcConfig
dbachecks Configuration Tests can be configured with Set-DbcConfig Available configuration items can be seen via Get-DbcConfig Export a configuration to import it later Configuration persists for the user unless reset or overridden. 11

14 Reporting A PowerBI dashboard is available for basic reporting.
dbachecks Reporting A PowerBI dashboard is available for basic reporting. Data must be exported using Update-DbcPowerBiDataSource 12

15 Databases are your friend...
dbachecks Advanced Reporting Databases are your friend... 14

16 Advanced Reporting Table Definition 15 dbachecks
CREATE TABLE checks.Results ( SqlInstance sysname NOT NULL , CollectionTime DATETIME2(7) NOT NULL , CollectionTimeUTC DATETIME2(7) NOT NULL , CheckName sysname NOT NULL , ParametersJSON NVARCHAR(MAX) NULL , TimeMS INT NOT NULL DEFAULT -1 , ErrorRecord NVARCHAR(MAX) NULL , ParameterizedSuiteName NVARCHAR(MAX) NULL , Passed BIT NOT NULL , Show NVARCHAR(MAX) NULL , FailureMessage NVARCHAR(MAX) NULL , Name NVARCHAR(MAX) NULL , Result NVARCHAR(MAX) NULL , Context NVARCHAR(MAX) NULL , StackTrace NVARCHAR(MAX) NULL ) ON CHECKS TEXTIMAGE_ON CHECKS; GO 15

17 dbachecks Advanced Reporting Grafana Dashboards 16

18 Questions? 17

19 CREDITS Shapes & Icons Images & Backgrounds Fonts COLORS
dbachecks CREDITS Shapes & Icons Images & Backgrounds Vectorial Shapes in this Template were created by SlidesPPT.com. Icons on this template have been downloaded from Corner Graphics Designed by Pio_pio - Freepik.com The photos in this template have been downloaded from The Backgrounds from Starline - Freepik.com COLORS Fonts The fonts used in this template are taken from Google fonts. ( Calibri) Download the fonts from the following url: #142906 #548035 #230739 #8c59b4 #ffcc00 #f0a94d template by SlidesPPT.com

20 Title of My Presentation
CREDITS Icons Icons made by Kiranshastry from and licensed by CC 3.0 BY Icons made by Nikita Golubev from and licensed by CC 3.0 BY


Download ppt "Unit testing for your database infrastructure"

Similar presentations


Ads by Google