52
52
" Write-Output \" If they are read the logs - the code is below in a block for you\"\n " ,
53
53
" Write-Output \" docker logs dbatools_SQL2019_1\"\n " ,
54
54
" 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
+ ]
59
70
},
60
71
"outputs" : [],
61
72
"execution_count" : null
143
154
{
144
155
"cell_type" : " code" ,
145
156
"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"
147
158
],
148
159
"metadata" : {
149
160
"azdata_cell_guid" : " b7ab61aa-1fc6-429e-a3ea-1dd7392227e6"
163
174
{
164
175
"cell_type" : " code" ,
165
176
"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"
167
178
],
168
179
"metadata" : {
169
180
"azdata_cell_guid" : " efeea9db-76b8-4dcb-83d2-937243622a4a"
211
222
{
212
223
"cell_type" : " code" ,
213
224
"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"
215
226
],
216
227
"metadata" : {
217
228
"azdata_cell_guid" : " 1bb7509c-91eb-4a59-aec2-81c56d203a7a"
233
244
{
234
245
"cell_type" : " code" ,
235
246
"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"
237
248
],
238
249
"metadata" : {
239
250
"azdata_cell_guid" : " 5bed2ffe-a7cd-49f5-af20-079c4cf7c6a4"
286
297
{
287
298
"cell_type" : " code" ,
288
299
"source" : [
289
- " Get-DbaLastBackup -SqlInstance $SQL1,$SQL2 -SqlCredential $SqlCredential - WarningAction SilentlyContinue | Format-Table "
300
+ " Get-DbaLastBackup -SqlInstance $SQL1,$SQL2 -WarningAction SilentlyContinue | Format-Table "
290
301
],
291
302
"metadata" : {
292
303
"azdata_cell_guid" : " d453929d-b352-48f4-a4c6-837d8c2f0c33"
301
312
" \n " ,
302
313
" Thats ok, dbatools supports many of the excellent community tooling including Ola Hallengrens solution.\n " ,
303
314
" \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)"
322
316
],
323
317
"metadata" : {
324
318
"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" : {}
326
353
},
327
354
{
328
355
"cell_type" : " code" ,
349
376
{
350
377
"cell_type" : " code" ,
351
378
"source" : [
379
+ " $SQL1 = Connect-DbaInstance -SqlInstance $SqlInstances[0] -SqlCredential $SqlCredential \n " ,
352
380
" $Jobs = 'DatabaseBackup - SYSTEM_DATABASES - FULL' ,'DatabaseBackup - USER_DATABASES - FULL'\n " ,
353
381
" Start-DbaAgentJob -SqlInstance $sql1 -Job $Jobs"
354
382
],
382
410
{
383
411
"cell_type" : " markdown" ,
384
412
"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."
387
414
],
388
415
"metadata" : {
389
416
"azdata_cell_guid" : " f3aadd24-cca4-4b35-b8dd-d3ac5a368e5f"
390
- }
417
+ },
418
+ "attachments" : {}
391
419
},
392
420
{
393
421
"cell_type" : " code" ,
394
422
"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'"
396
424
],
397
425
"metadata" : {
398
426
"azdata_cell_guid" : " 921b24d2-7e38-43ec-8ad1-ea467f78b165"
517
545
"cell_type" : " code" ,
518
546
"source" : [
519
547
" 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 " ,
521
549
" Write-Output \" Finished\" "
522
550
],
523
551
"metadata" : {
572
600
"metadata" : {
573
601
"azdata_cell_guid" : " 52e22e31-3690-489e-8e11-281de30a162b"
574
602
}
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
584
603
}
585
604
]
586
605
}
0 commit comments