diff --git a/andy-levy/BackupBasics/.vscode/settings.json b/andy-levy/BackupBasics/.vscode/settings.json new file mode 100644 index 0000000..625b81c --- /dev/null +++ b/andy-levy/BackupBasics/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "jupyter.jupyterServerType": "local" +} \ No newline at end of file diff --git a/andy-levy/BackupBasics/00_Before_Starting.ps1 b/andy-levy/BackupBasics/00_Before_Starting.ps1 new file mode 100644 index 0000000..efac52d --- /dev/null +++ b/andy-levy/BackupBasics/00_Before_Starting.ps1 @@ -0,0 +1,10 @@ +<# +Do this before starting new session +#> +Clear-Host; +Remove-DbaDatabase -SqlInstance flexo\sql17 -database stackoverflow2010 -confirm:$false; +Remove-Item -force -Path 'C:\SQL\Backup\FLEXO$SQL17\StackOverflow2010' -recurse -confirm:$false; +Restore-DbaDatabase -SqlInstance FLEXO\sql17 -DatabaseName StackOverflow2010 -ReplaceDbNameInFile -WithReplace -Path C:\Datasets\StackOverflow2010.bak; +Invoke-DbaQuery -SqlInstance FLEXO\sql17 -Database msdb -Query "exec sp_delete_database_backuphistory @database_name='StackOverflow2010';"; +Start-DbaAgentJob -SqlInstance FLEXO\sql17 -Job "DatabaseBackup - USER_DATABASES - FULL" -Wait; +Start-DbaAgentJob -SqlInstance FLEXO\sql17 -Job "DatabaseBackup - USER_DATABASES - Log" -Wait; \ No newline at end of file diff --git a/andy-levy/BackupBasics/00_Why_Azure_Data_Studio.ipynb b/andy-levy/BackupBasics/00_Why_Azure_Data_Studio.ipynb new file mode 100644 index 0000000..684ab36 --- /dev/null +++ b/andy-levy/BackupBasics/00_Why_Azure_Data_Studio.ipynb @@ -0,0 +1,38 @@ +{ + "metadata": { + "kernelspec": { + "name": "SQL", + "display_name": "SQL", + "language": "sql" + }, + "language_info": { + "name": "sql", + "version": "" + }, + "extensions": { + "azuredatastudio": { + "version": 1, + "views": [] + } + } + }, + "nbformat_minor": 2, + "nbformat": 4, + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Why Azure Data Studio?\r\n", + "\r\n", + "With Azure Data Studio, we can mix text (in Markdown form), code, and the code's output, into a single package.\r\n", + "\r\n", + "We can then hand that package to someone else, ask them to run it, save the results, and send it back.\r\n", + "\r\n", + "This lets us keep the code nicely organized with the output, and intersperse instructions and other documentation." + ], + "metadata": { + "azdata_cell_guid": "c5ce23b2-0603-47b4-9f4d-c63b228e2883" + } + } + ] +} \ No newline at end of file diff --git a/andy-levy/BackupBasics/01_Installation.ps1 b/andy-levy/BackupBasics/01_Installation.ps1 new file mode 100644 index 0000000..ab8e3bb --- /dev/null +++ b/andy-levy/BackupBasics/01_Installation.ps1 @@ -0,0 +1,23 @@ +Clear-Host; +<# +Installation & Maintenance + +Check for an existing dbatools module installation +#> +Get-Module -ListAvailable -Name dbatools; + +<# +Trust the PowerShell Gallery +#> +Set-PSRepository -Name PSGallery -InstallationPolicy Trusted; + +<# +Update the existing module or install if it's not there +#> + +if (Get-Module -ListAvailable -Name dbatools) { + Update-Module -Name dbatools -Verbose; +} +else { + Install-Module -Name dbatools -Scope CurrentUser -Verbose; +} diff --git a/andy-levy/BackupBasics/02_Conventions.ps1 b/andy-levy/BackupBasics/02_Conventions.ps1 new file mode 100644 index 0000000..d35cec6 --- /dev/null +++ b/andy-levy/BackupBasics/02_Conventions.ps1 @@ -0,0 +1,39 @@ +Clear-Host; +<# +# Conventions +## Getting Help +Every dbatools function has extensive comment-based help accessible via `Get-Help`. This help is also available at https://docs.dbatools.io/ + +`Find-DbaCommand ` is your friend! Use this function to locate functions related to what you need to do. +#> +$BackupFunctions = Find-DbaCommand -Pattern backup; + +$BackupFunctions.Count; + +$BackupFunctions; + +<# +## Naming Conventions + +* dbatools follows standard Powershell function naming conventions + * All dbatools function names follow the convention `Verb-DbaNoun` + * Most `Get`s have a corresponding `Set` +* Functions with `Db` in their name _usually_ want to operate on the database level, not the whole instance. +#> +<# +## Splatting + +Variable splatting is a method in Powershell where we can pass a collection of parameters to a function. This makes it easier to: +* Read without scrolling horizontally +* Dynamically change the parameter list passed to a function +For more information, see [`get-help about_splatting`](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-7.1) + +When using splatting with switch parameters, you must explicitly state `$true` or `$false` for the switch value. For example, `-Verbose` becomes `Verbose = $true;` +#> + +$BackupParams = @{ + SqlInstance = "FLEXO\sql17"; + Path = $BackupPath; + Database = "satellites"; + CreateFolder = $true; +} \ No newline at end of file diff --git a/andy-levy/BackupBasics/03_Instance_Objects.ps1 b/andy-levy/BackupBasics/03_Instance_Objects.ps1 new file mode 100644 index 0000000..34f9571 --- /dev/null +++ b/andy-levy/BackupBasics/03_Instance_Objects.ps1 @@ -0,0 +1,43 @@ +clear-host; +<# +# Instance-level Objects +## Keys & Certificates +### Functions Demonstrated +* `Backup-DbaServiceMasterKey` +* `Backup-DbaDbMasterKey` +* `Backup-DbaDbCertificate` + +### Service Master Key +#> + +$KeyBackupPassword = "MyP@$$w3rd" | ConvertTo-SecureString -AsPlainText -Force; +$KeyBackupParams = @{ + SqlInstance = "FLEXO\sql17"; + Path = "C:\SQL\Backup"; + Password = $KeyBackupPassword; +}; +Backup-DbaServiceMasterKey @KeyBackupParams; + +<# +### Database Master Key +#> + +$KeyBackupParams += @{ + Database = "master"; +}; + +Backup-DbaDbMasterKey @KeyBackupParams; + +<# +### Certificates +#> +$CertBackupParams = @{ + SqlInstance = "FLEXO\sql17"; + Path = "C:\SQL\Backup"; + EncryptionPassword = "My0th3rP@ssw0rD" | ConvertTo-SecureString -AsPlainText -Force; + DecryptionPassword = "bathrobe.rifleman.resent.demit" | ConvertTo-SecureString -AsPlainText -Force; # This is the password you set when creating the certificate + Database = "master"; + Certificate = "TDECert_2021"; +}; + +Backup-DbaDbCertificate @CertBackupParams; \ No newline at end of file diff --git a/andy-levy/BackupBasics/04_Basic_Backup_Restore.ps1 b/andy-levy/BackupBasics/04_Basic_Backup_Restore.ps1 new file mode 100644 index 0000000..6a4de35 --- /dev/null +++ b/andy-levy/BackupBasics/04_Basic_Backup_Restore.ps1 @@ -0,0 +1,114 @@ +Clear-Host; +<# +# Database Backup +## Basic Backup +### Function Demonstrated +* `Backup-DbaDatabase` +#> +$BackupPath = "C:\SQL\Backup\"; +$BackupParams = @{ + SqlInstance = "FLEXO\sql17"; + Path = $BackupPath; + Database = "satellites"; + CreateFolder = $true; +} +$BackupResult = Backup-DbaDatabase @BackupParams; + +$BackupResult | Format-List -Property *; + +# Save this for later +$SingleBackupFile = $BackupResult.BackupPath; + + +<# +Let's go a bit more complex +- Copy-only +- Multiple files +- Compression +- Checksum & Verify +- Custom timestamp format +- Adjust `MaxTransferSize` and `BufferCount` + +See https://sirsql.net/2012/12/13/20121212automated-backup-tuning/ for scripts to test your own backup performance +#> +$BackupParams += @{ + CopyOnly = $true; + Type = "Full"; + FileCount = 4; + CompressBackup = $true; + Checksum = $true; + Verify = $true; + BufferCount = 1000; + MaxTransfersize = 2 * 1MB; + TimeStampFormat = "yyyy-MMM-dd HH.mm.ss"; +} +$BackupResult = Backup-DbaDatabase @BackupParams; + +$BackupResult | Format-List -Property *; + +<# +What are we running? + +The -OutputScriptOnly switch parameter tells -Backup-DbaDatabase to not perform the backup but instead show the T-SQL to execute the backup. +#> +$BackupParams += @{ + OutputScriptOnly = $true; +} + +Backup-DbaDatabase @BackupParams | Set-Clipboard; +<# + +#> + +<# +## Restoring the Latest Backup +* The `-Path` parameter specifies a path to search for backups. If multiple backups are found, the most recent one will be used. +* `-Database` is the name the database will have when restored, not the original name of the database when it was backed up. + +### Function Demonstrated +* `Restore-DbaDatabase` +#> +Clear-Host; +$RestoreParams = @{ + SqlInstance = "FLEXO\sql19"; + Path = "C:\SQL\Backup\Satellites"; + Database = "Satellites19"; +} +$RestoreResult = Restore-DbaDatabase @RestoreParams; + +$RestoreResult | Format-List -Property *; + +<# +## Restoring a Specific Backup +If the database name we're restoring to already exists, `-WithReplace` will overwrite it. **Use with caution!** + +### Function Demonstrated +* `Set-DbaDbOwner` +#> +$RestoreParams["Path"] = $SingleBackupFile; +$RestoreParams += @{ + WithReplace = $true; +} +$RestoreResult = Restore-DbaDatabase @RestoreParams; + +$RestoreResult | Format-List -Property *; + +Set-DbaDbOwner -SqlInstance FLEXO\sql19 -Database Satellites19 -TargetLogin sa; + +<# +## Just Looking! + +Maybe I'm just looking to learn how to construct a `RESTORE DATABASE` SQL statement. Other times, I just want to review the statement before it's executed. + +The `-ReplaceDbNameInFile` renames the pysical files to match the database name when restored. +#> + +$RestoreParams += @{ + OutputScriptOnly = $true; + ReplaceDbNameInFile = $true; +} + +Restore-DbaDatabase @RestoreParams | Set-Clipboard; +<# + +#> \ No newline at end of file diff --git a/andy-levy/BackupBasics/05_Point_In_Time_Restore.ps1 b/andy-levy/BackupBasics/05_Point_In_Time_Restore.ps1 new file mode 100644 index 0000000..65cd325 --- /dev/null +++ b/andy-levy/BackupBasics/05_Point_In_Time_Restore.ps1 @@ -0,0 +1,67 @@ +Clear-Host; +<# +# Point In Time Restore +Who hasn't accidentally dropped a table? + +## Function Demonstrated: +* `Invoke-DbaQuery` +#> + +$PreUpdateTime = Get-Date; +$SOUpdateParams = @{ + SqlInstance = "FLEXO\sql17"; + Database = "StackOverflow2010"; + Query = "drop table [Users];"; +} +Invoke-DbaQuery @SOUpdateParams; + +<# +Let's restore the database so we can fix the data + +Take a log backup so we have something to work with +#> +Start-DbaAgentJob -SqlInstance FLEXO\sql17 -Job "DatabaseBackup - USER_DATABASES - Log" -Wait; + +<# +Now we'll restore the database to a new one to use as a reference +#> +$RestoreParams = @{ + SqlInstance = "FLEXO\sql17"; + Path = 'C:\sql\Backup\FLEXO$SQL17\StackOverflow2010\'; + DatabaseName = "StackOverflow2010"; + RestoredDatabaseNamePrefix = "Restored"; + RestoreTime = $PreUpdateTime; + ReplaceDbNameInFile = $true; + MaintenanceSolutionBackup = $true; + WithReplace = $true; +} +$RestoreResult = Restore-DbaDatabase @RestoreParams; + +$RestoreResult | Format-List -Property *; + +$RestoredDBName = $RestoreResult[-1].Database; + +<# +Database is restored, let's verify the table is there +#> + +$SOQueryParams = @{ + SqlInstance = "FLEXO\sql17"; + Database = "StackOverflow2010"; + Query = "select count(*) as UserCount from [Users];" +} + +Invoke-DbaQuery @SOQueryParams | Format-Table -AutoSize; + +$SOQueryParams["Database"] = $RestoredDBName; +Invoke-DbaQuery @SOQueryParams | Format-Table -AutoSize; + +<# +## Cleanup + +Data looks good in the restored database, so we'll fix things up in the live database using that data (not shown), then remove the restored database. +## Function Demonstrated: +* `Remove-DbaDatabase` +#> + +Remove-DbaDatabase -SqlInstance FLEXO\SQL17 -Database $RestoredDBName; \ No newline at end of file diff --git a/andy-levy/BackupBasics/06_Backup_Setup.ps1 b/andy-levy/BackupBasics/06_Backup_Setup.ps1 new file mode 100644 index 0000000..e1d9a8e --- /dev/null +++ b/andy-levy/BackupBasics/06_Backup_Setup.ps1 @@ -0,0 +1,21 @@ +Clear-Host; +<# +# Basic Backup Setup +## Where do backups go? +### Function Demonstrated +* `Get-DbaDefaultPath` +#> + +Get-DbaDefaultPath -SqlInstance FLEXO\Sql17; + +Get-DbaDefaultPath -SqlInstance FLEXO\Sql17,FLEXO\Sql19 | Select-Object ComputerName,ErrorLog; + +<# +## Check & Set Backup Compression +### Functions Demonstrated +* `Get-DbaSpConfigure` +* `Set-DbaSpConfigure` +#> + +Get-DbaSpConfigure -SqlInstance FLEXO\Sql17 -Name DefaultBackupCompression; +Set-DbaSpConfigure -SqlInstance FLEXO\Sql17 -Name DefaultBackupCompression -Value 1; \ No newline at end of file diff --git a/andy-levy/BackupBasics/07_Scheduled_Backups.ps1 b/andy-levy/BackupBasics/07_Scheduled_Backups.ps1 new file mode 100644 index 0000000..2f20e2d --- /dev/null +++ b/andy-levy/BackupBasics/07_Scheduled_Backups.ps1 @@ -0,0 +1,103 @@ +Clear-Host; +<# +# Scheduled Backups +Manual backups are one thing, but we should be scheduling our backups to run regularly. + +dbatools makes it easy to install & schedule backups with [Ola Hallengren's Maintenance Solution](https://ola.hallengren.com/). + +## Installation +`Install-DbaMaintenanceSolution` retrieves the latest version from Github _or_ can use a locally-stored copy. + +### Function Demonstrated +* `Install-DbaMaintenanceSolution` +#> + +$InstallParams = @{ + SqlInstance = "FLEXO\sql19"; + Solution = "All"; + Database = "DBAThings"; + CleanupTime = 25; + InstallJobs = $true; + LogToTable = $true; + ReplaceExisting = $true; + Force = $true; +} +Install-DbaMaintenanceSolution @InstallParams; +<# +Just need to update? +#> +Update-DbaMaintenanceSolution -SqlInstance FLEXO\sql19 -Database DBAThings; + +<# +## Verifying Installation +Ola's scripts get installed with a categoy of "Database Maintenance" so we can filter the list of installed jobs. +### Function Demonstrated +* `Get-DbaAgentJob` +#> + +Get-DbaAgentJob -SqlInstance FLEXO\sql19 -Category "Database Maintenance" | Select-Object -Property Name; + +<# +## Check job info + +Do the backup jobs have schedules assigned to them? +#> + +$JobInfoParams = @{ + SqlInstance = "FLEXO\sql19"; + Job = @("DatabaseBackup - USER_DATABASES - Log", "DatabaseBackup - USER_DATABASES - Full"); +} + +Get-DbaAgentJob @JobInfoParams | Select-Object Name, @{n = "ScheduleCount"; e = { $_.JobSchedules.Count } } + +<# +## Scheduling + +Let's assign 5-minute and 15-minute schedules to our Log and Full backup jobs, respectively. + +### Functions Demonstrated +* `New-DbaAgentSchedule` +* `Set-DbaAgentJob` +* `Start-DbaAgentJob` +#> +$StandardParams = @{ + SqlInstance = "FLEXO\sql19"; + FrequencyType = "Daily"; + FrequencyInterval = 1; + FrequencySubdayType = "Minutes"; + Force = $true; +} + +$FiveMinuteParams = $StandardParams; +$FiveMinuteParams += @{ + Schedule = "Five Minutes"; + FrequencySubdayInterval = 5; +} +$FifteenMinuteParams = $StandardParams; +$FifteenMinuteParams += @{ + Schedule = "Fifteen Minutes"; + FrequencySubdayInterval = 15; +} + +$EveryFiveMinutes = New-DbaAgentSchedule @FiveMinuteParams; +$EveryFifteenMinutes = New-DbaAgentSchedule @FifteenMinuteParams; + +$LogBackupParams = @{ + SqlInstance = "FLEXO\sql19"; + Job = "DatabaseBackup - USER_DATABASES - LOG"; + Schedule = $EveryFiveMinutes; +}; + +$FullBackupParams = @{ + SqlInstance = "FLEXO\sql19"; + Job = "DatabaseBackup - USER_DATABASES - FULL"; + Schedule = $EveryFifteenMinutes; +}; + +Set-DbaAgentJob @LogBackupParams; +Set-DbaAgentJob @FullBackupParams; + +<# +Start the full backup job +#> +Start-DbaAgentJob -SqlInstance FLEXO\sql19 -Job "DatabaseBackup - USER_DATABASES - FULL"; \ No newline at end of file diff --git a/andy-levy/BackupBasics/08_Backup_History_Integrity.ps1 b/andy-levy/BackupBasics/08_Backup_History_Integrity.ps1 new file mode 100644 index 0000000..18f81d4 --- /dev/null +++ b/andy-levy/BackupBasics/08_Backup_History_Integrity.ps1 @@ -0,0 +1,116 @@ +Clear-Host; +<# +# Checking on Backups +## Last Backup of Each Database + +`Get-DbaLastBackup` retrieves the most recent backup of each database. +### Function Demonstrated +* `Get-DbaLastBackup` +#> + +Get-DbaLastBackup -SqlInstance FLEXO\sql17 | Format-Table -AutoSize; + +<# +## Backup History for One Database +### Function Demonstrated +* `Get-DbaDbBackupHistory` +#> + +Get-DbaDbBackupHistory -SqlInstance FLEXO\sql17 -Database stackoverflow2010 | Sort-Object -Property Start; + +<# +## Recent Backups +#> + +$HistoryParams = @{ + SqlInstance = "FLEXO\sql17"; + IncludeCopyOnly = $true; + Since = (Get-Date).AddDays(-1); + DeviceType = "Disk"; +} +Get-DbaDbBackupHistory @HistoryParams | Sort-Object -Property Start | Format-Table -AutoSize; + +<# +### Let's send that to Excel instead +### Function Demonstrated +* `Export-Excel` +#> + +$BackupHistory = Get-DbaDbBackupHistory @HistoryParams; + +$ExcelParams = @{ + Path = "C:\users\andy\documents\BackupHistory.xlsx"; + ClearSheet = $true; + AutoSize = $true; + FreezeTopRow = $true; + BoldTopRow = $true; + AutoFilter = $true; + Show = $true; +} +$BackupHistory | Export-Excel @ExcelParams; + +<# +## Backup Integrity +Backups don't mean much if they can't be restored, right? How can we test that we have good, usable backups of our databases? + +And then, how can we prove that we're doing it? +### Function Demonstrated +* `Test-DbaLastBackup` +#> +$BackupTestParams = @{ + SqlInstance = "FLEXO\sql17"; + Destination = "FLEXO\sql19"; + Database = @("DBAThings", "Satellites"); +} +$BackupTestResults = Test-DbaLastBackup @BackupTestParams; +$BackupTestResults | Format-List -Property *; + +<# +## DBCC History to Table +### Functions Demonstrated +* `ConvertTo-DbaDataTable` +* `Write-DbaDataTable` +#> + +$OutputParams = @{ + SqlInstance = "FLEXO\sql19"; + Database = "DBAThings"; + Schema = "dbo"; + Table = "BackupValidation"; + AutoCreateTable = $true; + UseDynamicStringLength = $true; +} +$BackupTestResults | ConvertTo-DbaDataTable | Write-DbaDataTable @OutputParams; + +<# +The auditors are coming! Provide documentation! +#> +$ExcelParams["Path"] ="C:\users\andy\documents\BackupVerification.xlsx"; +$QueryParams = @{ + SqlInstance = "FLEXO\sql19"; + Database = "DBAThings"; + Query = "select * from BackupValidation"; +} +Invoke-DbaQuery @QueryParams | ConvertTo-DbaDataTable | Export-Excel @ExcelParams; + +<# +## Backup Speed +How fast are our backups? +### Function Demonstrated +* `Measure-DbaBackupThroughput` +#> +$ThroughputParams = @{ + SqlInstance = "flexo\Sql17"; + Type = "Full" +} +$MeasurementFields = @( + "SqlInstance" + , "Database" + , "MaxBackupDate" + , "AvgThroughput" + , "AvgDuration" + , "MinThroughput" + , "MaxThroughput" + , "BackupCount" +) +Measure-DbaBackupThroughput @ThroughputParams | Select-object -Property $MeasurementFields | Format-Table -AutoSize; \ No newline at end of file diff --git a/andy-levy/BackupBasics/09_Preparing_for_the_Worst.ps1 b/andy-levy/BackupBasics/09_Preparing_for_the_Worst.ps1 new file mode 100644 index 0000000..cdc902e --- /dev/null +++ b/andy-levy/BackupBasics/09_Preparing_for_the_Worst.ps1 @@ -0,0 +1,9 @@ +Clear-Host; +<# +# Preparing for the Worst + +### Function Demonstrated +* `Export-DbaInstance` +#> +Get-Help Export-DbaInstance; +Export-DbaInstance -SqlInstance FLEXO\sql17 -Path C:\SQL\Export; \ No newline at end of file diff --git a/andy-levy/BackupBasics/99_Reset_Environment.ps1 b/andy-levy/BackupBasics/99_Reset_Environment.ps1 new file mode 100644 index 0000000..6b8a3d1 --- /dev/null +++ b/andy-levy/BackupBasics/99_Reset_Environment.ps1 @@ -0,0 +1,20 @@ +<# +# Reset Environment +Do this after the demos are done +#> +Clear-Host; +Set-DbaSpConfigure -SqlInstance FLEXO\sql17 -Name DefaultBackupCompression -Value 0; +Remove-Item c:\users\andy\documents\BackupHistory.xlsx; +Remove-Item C:\users\andy\documents\BackupVerification.xlsx; +get-childitem -path C:\SQL\Backup -File | Remove-Item +Get-ChildItem -path C:\SQL\Export -recurse | remove-item -force -confirm:$false -recurse; +Remove-Item -Force -recurse -confirm:$false "C:\SQL\Backup\Satellites"; +remove-item -Force -Recurse -Confirm:$false 'C:\SQL\Backup\FLEXO$SQL17\RestoredStackOverflow2010' +Remove-DbaDatabase -SqlInstance FLEXO\sql19 -Database Satellites19 -Confirm:$false; +Remove-DbaDatabase -SqlInstance FLEXO\sql17 -Database StackOverflow2010-Restored -Confirm:$false; +Restore-DbaDatabase -SqlInstance FLEXO\sql17 -DatabaseName StackOverflow2010 -ReplaceDbNameInFile -WithReplace -Path C:\Datasets\StackOverflow2010.bak; +Start-DbaAgentJob -SqlInstance FLEXO\sql17 -Job "DatabaseBackup - USER_DATABASES - FULL" -Wait; +Start-DbaAgentJob -SqlInstance FLEXO\sql17 -Job "DatabaseBackup - USER_DATABASES - LOG"; +# Remove Ola jobs from flexo\sql19 +Get-DbaAgentJob -SqlInstance FLEXO\sql19 -Category "Database Maintenance" | Remove-DbaAgentJob; +(Get-DbaDbTable -SqlInstance FLEXO\sql19 -database dbathings | Where-Object { $PSItem.name -in @("BackupValidation", "CommandLog") }).DropIfExists(); \ No newline at end of file diff --git a/andy-levy/BackupBasics/Backup Basics with Powershell and dbatools - DBAFun.pptx b/andy-levy/BackupBasics/Backup Basics with Powershell and dbatools - DBAFun.pptx new file mode 100644 index 0000000..e76404f Binary files /dev/null and b/andy-levy/BackupBasics/Backup Basics with Powershell and dbatools - DBAFun.pptx differ diff --git a/andy-levy/BackupBasics/Backup Basics with Powershell and dbatools.pptx b/andy-levy/BackupBasics/Backup Basics with Powershell and dbatools.pptx new file mode 100644 index 0000000..19ebc76 Binary files /dev/null and b/andy-levy/BackupBasics/Backup Basics with Powershell and dbatools.pptx differ diff --git a/andy-levy/BackupBasics/PASS Data Summit.code-workspace b/andy-levy/BackupBasics/PASS Data Summit.code-workspace new file mode 100644 index 0000000..6970324 --- /dev/null +++ b/andy-levy/BackupBasics/PASS Data Summit.code-workspace @@ -0,0 +1,26 @@ +{ + "folders": [ + { + "path": "." + }, + { + "name": "SQL Backups", + "path": "c:\\sql\\backup" + }, + { + "name": "Export", + "path": "c:\\sql\\export" + } + ], + "settings": { + "workbench.colorTheme": "Visual Studio Light", + "editor.fontWeight": "normal", + "window.zoomLevel": 0, + "editor.wordWrap": "on", + "editor.wrappingStrategy": "advanced", + "editor.fontSize": 16, + "terminal.integrated.fontFamily": "consolas", + "terminal.integrated.fontSize": 16, + "editor.minimap.enabled": false + } +} \ No newline at end of file diff --git a/andy-levy/BackupBasics/links.md b/andy-levy/BackupBasics/links.md new file mode 100644 index 0000000..1c01667 --- /dev/null +++ b/andy-levy/BackupBasics/links.md @@ -0,0 +1,5 @@ +* [GitHub repository](https://github.com/alevyinroc/community-presentations/tree/master/andy-levy/BackupBasics) +* [dbatools main site](https://dbatools.io/) +* [dbatools documentation](https://docs.dbatools.io/) +* [SQL Server Community Slack](https://sqlslack.com/) +* [Learn dbatools in a Month of Lunches](https://www.manning.com/books/learn-powershell-in-a-month-of-lunches?query=learn%20powershell%20in%20a%20month%20of%20lunches) diff --git a/andy-levy/Dbatools.pptx b/andy-levy/DbatoolsForTheUninitiated/Dbatools.pptx similarity index 100% rename from andy-levy/Dbatools.pptx rename to andy-levy/DbatoolsForTheUninitiated/Dbatools.pptx diff --git a/andy-levy/Import-Imdb.ps1 b/andy-levy/DbatoolsForTheUninitiated/Import-Imdb.ps1 similarity index 100% rename from andy-levy/Import-Imdb.ps1 rename to andy-levy/DbatoolsForTheUninitiated/Import-Imdb.ps1 diff --git a/andy-levy/Invoke-Demo.ps1 b/andy-levy/DbatoolsForTheUninitiated/Invoke-Demo.ps1 similarity index 99% rename from andy-levy/Invoke-Demo.ps1 rename to andy-levy/DbatoolsForTheUninitiated/Invoke-Demo.ps1 index 3eea784..b579964 100644 --- a/andy-levy/Invoke-Demo.ps1 +++ b/andy-levy/DbatoolsForTheUninitiated/Invoke-Demo.ps1 @@ -75,6 +75,7 @@ Get-DbaDbBackupHistory -SqlInstance $SQL16; Get-DbaDbBackupHistory -SqlInstance $SQL16 -Verbose; # Where are the backups being written? +# You can change this on Windows but not Linux Get-DbaDefaultPath -SqlInstance $SQL16; Invoke-Item -Path (Get-DbaDefaultPath -SqlInstance $SQL16).Backup; diff --git a/andy-levy/Invoke-DemoContainers.ps1 b/andy-levy/DbatoolsForTheUninitiated/Invoke-DemoContainers.ps1 similarity index 100% rename from andy-levy/Invoke-DemoContainers.ps1 rename to andy-levy/DbatoolsForTheUninitiated/Invoke-DemoContainers.ps1 diff --git a/andy-levy/SampleDataSources.txt b/andy-levy/DbatoolsForTheUninitiated/SampleDataSources.txt similarity index 100% rename from andy-levy/SampleDataSources.txt rename to andy-levy/DbatoolsForTheUninitiated/SampleDataSources.txt diff --git a/andy-levy/Start-Containers.ps1 b/andy-levy/DbatoolsForTheUninitiated/Start-Containers.ps1 similarity index 100% rename from andy-levy/Start-Containers.ps1 rename to andy-levy/DbatoolsForTheUninitiated/Start-Containers.ps1 diff --git a/andy-levy/abstract.txt b/andy-levy/DbatoolsForTheUninitiated/abstract.txt similarity index 100% rename from andy-levy/abstract.txt rename to andy-levy/DbatoolsForTheUninitiated/abstract.txt