Skip to content

Commit a10a8cd

Browse files
updates for latest
1 parent 090e705 commit a10a8cd

24 files changed

+4590
-27563
lines changed

Diff for: notebooks/NotDotNet/dbatools/00-CreateContainers.ipynb

+314-717
Large diffs are not rendered by default.

Diff for: notebooks/NotDotNet/dbatools/01-Introduction.ipynb

+209-5,739
Large diffs are not rendered by default.

Diff for: notebooks/NotDotNet/dbatools/02-BackupsRestores.ipynb

+61-42
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@
5252
" Write-Output \"If they are read the logs - the code is below in a block for you\"\n",
5353
" Write-Output \"docker logs dbatools_SQL2019_1\"\n",
5454
" Write-Output \"docker logs dbatools_SQL2019-1_1\"\n",
55-
"}"
56-
],
57-
"metadata": {
58-
"azdata_cell_guid": "0fdc5436-f5cc-4d79-b516-4dc5df94046a"
55+
"}\n",
56+
"# Run this first to make sure output width does not mess with output - Update output buffer size to prevent clipping in Visual Studio output window.\n",
57+
"if( $Host -and $Host.UI -and $Host.UI.RawUI ) {\n",
58+
" $rawUI = $Host.UI.RawUI\n",
59+
" $oldSize = $rawUI.BufferSize\n",
60+
" $typeName = $oldSize.GetType( ).FullName\n",
61+
" $newSize = New-Object $typeName (500, $oldSize.Height)\n",
62+
" $rawUI.BufferSize = $newSize\n",
63+
" }"
64+
],
65+
"metadata": {
66+
"azdata_cell_guid": "0fdc5436-f5cc-4d79-b516-4dc5df94046a",
67+
"tags": [
68+
"hide_input"
69+
]
5970
},
6071
"outputs": [],
6172
"execution_count": null
@@ -143,7 +154,7 @@
143154
{
144155
"cell_type": "code",
145156
"source": [
146-
"Backup-DbaDatabase -SqlInstance $SQL1 -SqlCredential $SqlCredential -Path /var/opt/mssql/backups/SQL1"
157+
"Backup-DbaDatabase -SqlInstance $SQL1 -Path /var/opt/mssql/backups/SQL1"
147158
],
148159
"metadata": {
149160
"azdata_cell_guid": "b7ab61aa-1fc6-429e-a3ea-1dd7392227e6"
@@ -163,7 +174,7 @@
163174
{
164175
"cell_type": "code",
165176
"source": [
166-
"Get-DbaFile -SqlInstance $SQL1 -SqlCredential $SqlCredential -Path /var/opt/mssql/backups/SQL1"
177+
"Get-DbaFile -SqlInstance $SQL1 -Path /var/opt/mssql/backups/SQL1"
167178
],
168179
"metadata": {
169180
"azdata_cell_guid": "efeea9db-76b8-4dcb-83d2-937243622a4a"
@@ -211,7 +222,7 @@
211222
{
212223
"cell_type": "code",
213224
"source": [
214-
"Get-DbaFile -SqlInstance $SQL2 -SqlCredential $SqlCredential -Path /var/opt/mssql/backups/SQL2"
225+
"Get-DbaFile -SqlInstance $SQL2 -Path /var/opt/mssql/backups/SQL2"
215226
],
216227
"metadata": {
217228
"azdata_cell_guid": "1bb7509c-91eb-4a59-aec2-81c56d203a7a"
@@ -233,7 +244,7 @@
233244
{
234245
"cell_type": "code",
235246
"source": [
236-
"Backup-DbaDatabase -SqlInstance $SQL2 -SqlCredential $SqlCredential -CreateFolder -Path /var/opt/mssql/backups/SQL2 -CompressBackup -WarningAction SilentlyContinue"
247+
"Backup-DbaDatabase -SqlInstance $SQL2 -CreateFolder -Path /var/opt/mssql/backups/SQL2 -CompressBackup -WarningAction SilentlyContinue"
237248
],
238249
"metadata": {
239250
"azdata_cell_guid": "5bed2ffe-a7cd-49f5-af20-079c4cf7c6a4"
@@ -286,7 +297,7 @@
286297
{
287298
"cell_type": "code",
288299
"source": [
289-
"Get-DbaLastBackup -SqlInstance $SQL1,$SQL2 -SqlCredential $SqlCredential -WarningAction SilentlyContinue | Format-Table "
300+
"Get-DbaLastBackup -SqlInstance $SQL1,$SQL2 -WarningAction SilentlyContinue | Format-Table "
290301
],
291302
"metadata": {
292303
"azdata_cell_guid": "d453929d-b352-48f4-a4c6-837d8c2f0c33"
@@ -301,28 +312,44 @@
301312
"\n",
302313
"Thats ok, dbatools supports many of the excellent community tooling including Ola Hallengrens solution.\n",
303314
"\n",
304-
"You can install Ola Hallengren like this (except in containers)\n",
305-
"\n",
306-
"````\n",
307-
"$installDbaMaintenanceSolutionSplat = @{\n",
308-
" SqlInstance = $sql1\n",
309-
" InstallJobs = $true\n",
310-
" ReplaceExisting = $true\n",
311-
" LogToTable = $true\n",
312-
" OutputFileDirectory = '/var/opt/mssql/backups/SQL1'\n",
313-
" BackupLocation = '/var/opt/mssql/backups/SQL1'\n",
314-
" CleanupTime = 72\n",
315-
" Solution = 'All'\n",
316-
" Database = 'master'\n",
317-
"}\n",
318-
"Install-DbaMaintenanceSolution @installDbaMaintenanceSolutionSplat -Verbose\n",
319-
"````\n",
320-
"\n",
321-
"Lets have a look at the Agent Jobs on the Instance"
315+
"You can install Ola Hallengren like this (except in containers)"
322316
],
323317
"metadata": {
324318
"azdata_cell_guid": "c850b8bd-2e8f-409a-a4e5-fdcae21ccc83"
325-
}
319+
},
320+
"attachments": {}
321+
},
322+
{
323+
"cell_type": "code",
324+
"source": [
325+
"$installDbaMaintenanceSolutionSplat = @{\r\n",
326+
" SqlInstance = $sql1,$sql2\r\n",
327+
" InstallJobs = $true\r\n",
328+
" ReplaceExisting = $true\r\n",
329+
" LogToTable = $true\r\n",
330+
" OutputFileDirectory = '/var/opt/mssql/backups/SQL1'\r\n",
331+
" BackupLocation = '/var/opt/mssql/backups/SQL1'\r\n",
332+
" CleanupTime = 72\r\n",
333+
" Solution = 'All'\r\n",
334+
" Database = 'master'\r\n",
335+
"}\r\n",
336+
"Install-DbaMaintenanceSolution @installDbaMaintenanceSolutionSplat"
337+
],
338+
"metadata": {
339+
"azdata_cell_guid": "82e9376c-9403-4c34-8414-4e103e1c4799"
340+
},
341+
"outputs": [],
342+
"execution_count": null
343+
},
344+
{
345+
"cell_type": "markdown",
346+
"source": [
347+
"Lets have a look at the Agent Jobs on the Instance"
348+
],
349+
"metadata": {
350+
"azdata_cell_guid": "6ec8b7ae-9572-4c58-b456-4274a7ef8cf5"
351+
},
352+
"attachments": {}
326353
},
327354
{
328355
"cell_type": "code",
@@ -349,6 +376,7 @@
349376
{
350377
"cell_type": "code",
351378
"source": [
379+
"$SQL1 = Connect-DbaInstance -SqlInstance $SqlInstances[0] -SqlCredential $SqlCredential \n",
352380
"$Jobs = 'DatabaseBackup - SYSTEM_DATABASES - FULL' ,'DatabaseBackup - USER_DATABASES - FULL'\n",
353381
"Start-DbaAgentJob -SqlInstance $sql1 -Job $Jobs"
354382
],
@@ -382,17 +410,17 @@
382410
{
383411
"cell_type": "markdown",
384412
"source": [
385-
"When the jobs have finished, lets have a look at the files.\n",
386-
"We need to alter the file path to include the current container name from the results above"
413+
"When the jobs have finished, lets have a look at the files."
387414
],
388415
"metadata": {
389416
"azdata_cell_guid": "f3aadd24-cca4-4b35-b8dd-d3ac5a368e5f"
390-
}
417+
},
418+
"attachments": {}
391419
},
392420
{
393421
"cell_type": "code",
394422
"source": [
395-
"Get-DbaFile -SqlInstance $sql1 -Path '/var/opt/mssql/data/01a539677f71/AdventureWorks2017/FULL'"
423+
"Get-DbaFile -SqlInstance $sql1 -Path '/var/opt/mssql/backups/SQL1/f443490967e7/AdventureWorks2017/FULL'"
396424
],
397425
"metadata": {
398426
"azdata_cell_guid": "921b24d2-7e38-43ec-8ad1-ea467f78b165"
@@ -517,7 +545,7 @@
517545
"cell_type": "code",
518546
"source": [
519547
"Write-Output \"Starting Restoring\"\n",
520-
"Restore-DbaDatabase -SqlInstance $SQL1 -Path /var/opt/mssql/data/ca2f813564a4 -MaintenanceSolutionBackup\n",
548+
"Restore-DbaDatabase -SqlInstance $SQL1 -Path /var/opt/mssql/backups/SQL1/f443490967e7 -MaintenanceSolutionBackup\n",
521549
"Write-Output \"Finished\""
522550
],
523551
"metadata": {
@@ -572,15 +600,6 @@
572600
"metadata": {
573601
"azdata_cell_guid": "52e22e31-3690-489e-8e11-281de30a162b"
574602
}
575-
},
576-
{
577-
"cell_type": "code",
578-
"source": [],
579-
"metadata": {
580-
"azdata_cell_guid": "8aa56d1e-0541-450c-8324-681820d632bd"
581-
},
582-
"outputs": [],
583-
"execution_count": null
584603
}
585604
]
586605
}

0 commit comments

Comments
 (0)