-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated and refactored for newest System.Commandline version (#112)
- *FIXED:* Update to ensure all Queue messages are retrieved efficiently - *ADDED:* New utility method `sbm batch dequeue` to remove all messages from the Service Bus Queue topic (without processing them) - *UPDATED:* Code clean up and refactoring to accommodate latest version of System.CommandLine - *FIXED:* Issue with SQL text syntax higlighting formatting in .NET 5.0 - **NOTE:** Removed "Construct Command Line" menu options from Windows UI. Users should leverage the generated help docs for sbm.exe
- Loading branch information
1 parent
ac2be13
commit 0738839
Showing
56 changed files
with
1,393 additions
and
3,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
Michael McKechney | ||
([[email protected]](mailto:[email protected])) \ | ||
[www.SqlBuildManager.com](https://mmckechney.github.io/SqlBuildManager/) \ | ||
Copyright 2004-2020 | ||
Copyright 2004-2021 | ||
|
||
------ | ||
|
||
|
@@ -637,28 +637,27 @@ Basic Command Line Execution | |
## Command Line Arguments | ||
|
||
Sql Build Manager can be run directly via command line or through the | ||
SqlBuildManager.Console.exe helper application. The advantage of using | ||
`sbm` application. The advantage of using | ||
the "console" application is that you will be able to record exit code | ||
values as well as stream the standard output and error text into any | ||
automation or scheduling software that you may be using. | ||
|
||
The command line also has the ability to run on Linux and/or run massively parallel updates leveraging Azure Batch | ||
|
||
### For command line details go [here](commandline.md) | ||
|
||
## Command Line Examples | ||
|
||
## Command Line Examples | ||
**Run standard unattended Sql build** | ||
|
||
**Run standard unattended Sql build****\ | ||
**Runs the specified .sbm build file on the designated server using the | ||
Runs the specified .sbm build file on the designated server using the | ||
parameters and target databases defined in the project. The command line | ||
execution uses Windows authentication of the executing process to | ||
connect to the server and database(s). As with in interactive execution, | ||
the results are saved in the .sbm file for review. | ||
|
||
- SqlBuildManager.Console.exe /Action=Build /PackageName=".sbm file name" | ||
/server=myserver | ||
|
||
``` | ||
SqlBuildManager.Console.exe /Action=Build /PackageName="ProjectUpdate.sbm" /server=ProdServer | ||
``` bash | ||
sbm build --packagename "ProjectUpdate.sbm" --server ProdServer | ||
``` | ||
|
||
**Run an unattended Sql build with manual database override | ||
|
@@ -670,11 +669,8 @@ The command line execution uses Windows authentication of the executing | |
process to connect to the server and database(s). As with in interactive | ||
execution, the results are saved in the .sbm file for review. | ||
|
||
- SqlBuildManager.Console.exe /Action=Build /PackageName=".sbm file name" /server=server | ||
/override=default,override | ||
|
||
``` | ||
SqlBuildManager.Console.exe /Action=Build /PackageName="ProjectUpdate.sbm" /server=ProdServer /override=Main,Copy1 | ||
``` bash | ||
sbm build --packagename "ProjectUpdate.sbm" --server ProdServer --override "Main,Copy1" | ||
``` | ||
|
||
Note that multiple overrides may be set if the build file contains more | ||
|
@@ -688,13 +684,10 @@ authentication of the executing process to connect to the server and | |
database(s). As with in interactive execution, the results are saved in | ||
the .sbm file for review. | ||
|
||
``` | ||
SqlBuildManager.Console.exe /Action=Build /PackageName="ProjectUpdate.sbm" /override="prod release.multiDb" | ||
``` bash | ||
sbm build --packagename "ProjectUpdate.sbm" --override "prod release.multiDb" | ||
``` | ||
|
||
See [Advanced Command Line Execution](#Advanced-Command-Line-Execution) for | ||
return codes. | ||
|
||
Targeting Multiple Servers and Databases | ||
======================================== | ||
|
||
|
@@ -815,9 +808,6 @@ configuration file. You will then be prompted to save the query as a | |
generated configuration setting will be loaded in the Multiple Database | ||
Run Configuration window. | ||
|
||
|
||
- | ||
|
||
Threaded Multi-Server Database Execution | ||
---------------------------------------- | ||
|
||
|
@@ -859,24 +849,6 @@ For each database you want to execute against, add an additional line in | |
the configuration file (i.e. each line equates to an additional thread). | ||
Finally, save the file with a .cfg extension | ||
|
||
See [Advanced Command Line Execution](#AdvancedCommandLineExecution) for | ||
the command line syntax to execute your threaded builds. | ||
|
||
Remote Service Execution and Deployment | ||
======================================= | ||
|
||
While the tool has the feature for [Targeting Multiple Servers and | ||
Databases](#TargetingMultipleServersandDatabases), you can take that | ||
multi-target, multi-threaded execution one step further and distribute | ||
that load across multiple -->Execution Servers--> as well. It builds on the | ||
multiple server functionality and extends it to send build requests via | ||
a remote service call to remote computers that will handle the actual | ||
processing of the SQL scripts. You can spit the load amongst all of your | ||
execution servers for maximum efficiency and minimum deployment time. | ||
|
||
Overview | ||
-------- | ||
|
||
Advanced Script Handling | ||
======================== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
@description('Prefix to prepend to account names') | ||
param namePrefix string | ||
@allowed([ | ||
'Basic' | ||
'Standard' | ||
]) | ||
@description('The messaging tier for service Bus namespace') | ||
param eventhubSku string = 'Standard' | ||
|
||
@allowed([ | ||
1 | ||
2 | ||
4 | ||
]) | ||
@description('MessagingUnits for premium namespace') | ||
param skuCapacity int = 1 | ||
|
||
@description('Location for all resources.') | ||
param location string = resourceGroup().location | ||
|
||
var batchAccountName_var = '${namePrefix}batchacct' | ||
var storageAccountName_var = '${namePrefix}storage' | ||
var namespaceName_var = '${namePrefix}eventhubnamespace' | ||
var eventHubName = '${namePrefix}eventhub' | ||
var serviceBusName_var = '${namePrefix}servicebus' | ||
|
||
|
||
resource storageAccountName 'Microsoft.Storage/storageAccounts@2018-07-01' = { | ||
name: storageAccountName_var | ||
location: location | ||
sku: { | ||
name: 'Standard_LRS' | ||
} | ||
kind: 'StorageV2' | ||
properties: { | ||
networkAcls: { | ||
bypass: 'AzureServices' | ||
virtualNetworkRules: [] | ||
ipRules: [] | ||
defaultAction: 'Allow' | ||
} | ||
supportsHttpsTrafficOnly: false | ||
encryption: { | ||
services: { | ||
file: { | ||
enabled: true | ||
} | ||
blob: { | ||
enabled: true | ||
} | ||
} | ||
keySource: 'Microsoft.Storage' | ||
} | ||
accessTier: 'Hot' | ||
} | ||
} | ||
|
||
resource batchAccountName 'Microsoft.Batch/batchAccounts@2017-09-01' = { | ||
name: batchAccountName_var | ||
location: location | ||
properties: { | ||
autoStorage: { | ||
storageAccountId: storageAccountName.id | ||
} | ||
poolAllocationMode: 'BatchService' | ||
} | ||
dependsOn:[ | ||
storageAccountName | ||
] | ||
} | ||
|
||
resource eventHubNamespace 'Microsoft.EventHub/namespaces@2017-04-01' = { | ||
name: namespaceName_var | ||
location: location | ||
sku: { | ||
name: eventhubSku | ||
tier: eventhubSku | ||
capacity: skuCapacity | ||
} | ||
} | ||
|
||
resource eventHubNamespace_eventHubName 'Microsoft.EventHub/namespaces/eventhubs@2017-04-01' = { | ||
name: '${eventHubNamespace.name}/${eventHubName}' | ||
properties: { | ||
messageRetentionInDays: 1 | ||
partitionCount: 5 | ||
status: 'Active' | ||
} | ||
dependsOn: [ | ||
eventHubNamespace | ||
] | ||
} | ||
|
||
resource namespaceName_eventHubName_batchbuilder 'Microsoft.EventHub/namespaces/eventhubs/authorizationRules@2017-04-01' = { | ||
name: '${eventHubNamespace_eventHubName.name}/batchbuilder' | ||
|
||
properties: { | ||
rights: [ | ||
'Listen' | ||
'Send' | ||
] | ||
} | ||
dependsOn: [ | ||
eventHubNamespace | ||
] | ||
} | ||
|
||
resource serviceBusName 'Microsoft.ServiceBus/namespaces@2018-01-01-preview' = { | ||
name: serviceBusName_var | ||
location: location | ||
sku: { | ||
name: 'Standard' | ||
tier: 'Standard' | ||
capacity: 1 | ||
} | ||
properties: { | ||
zoneRedundant: false | ||
} | ||
} | ||
|
||
resource serviceBusName_RootManageSharedAccessKey 'Microsoft.ServiceBus/namespaces/AuthorizationRules@2017-04-01' = { | ||
name: '${serviceBusName.name}/RootManageSharedAccessKey' | ||
properties: { | ||
rights: [ | ||
'Listen' | ||
'Manage' | ||
'Send' | ||
] | ||
} | ||
dependsOn: [ | ||
serviceBusName | ||
] | ||
} | ||
|
||
resource serviceBusName_sqlbuildmanager 'Microsoft.ServiceBus/namespaces/topics@2018-01-01-preview' = { | ||
name: '${serviceBusName.name}/sqlbuildmanager' | ||
properties: { | ||
defaultMessageTimeToLive: 'P14D' | ||
maxSizeInMegabytes: 4096 | ||
requiresDuplicateDetection: false | ||
duplicateDetectionHistoryTimeWindow: 'PT10M' | ||
enableBatchedOperations: true | ||
status: 'Active' | ||
supportOrdering: true | ||
autoDeleteOnIdle: 'P10675199DT2H48M5.4775807S' | ||
enablePartitioning: true | ||
enableExpress: false | ||
} | ||
dependsOn: [ | ||
serviceBusName | ||
] | ||
} | ||
|
||
resource serviceBusName_sqlbuildmanager_sbmtopicpolicy 'Microsoft.ServiceBus/namespaces/topics/authorizationRules@2018-01-01-preview' = { | ||
name: '${serviceBusName_sqlbuildmanager.name}/sbmtopicpolicy' | ||
properties: { | ||
rights: [ | ||
'Manage' | ||
'Listen' | ||
'Send' | ||
] | ||
} | ||
dependsOn: [ | ||
serviceBusName | ||
] | ||
} | ||
|
||
resource serviceBusName_sqlbuildmanager_sbmsubscription 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2018-01-01-preview' = { | ||
name: '${serviceBusName_sqlbuildmanager.name}/sbmsubscription' | ||
properties: { | ||
lockDuration: 'PT30S' | ||
requiresSession: false | ||
defaultMessageTimeToLive: 'P14D' | ||
deadLetteringOnMessageExpiration: true | ||
deadLetteringOnFilterEvaluationExceptions: true | ||
maxDeliveryCount: 10 | ||
status: 'Active' | ||
enableBatchedOperations: true | ||
autoDeleteOnIdle: 'P14D' | ||
} | ||
dependsOn: [ | ||
serviceBusName | ||
] | ||
} | ||
|
||
resource serviceBusName_sqlbuildmanager_sbmsubscriptionsession 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2018-01-01-preview' = { | ||
name: '${serviceBusName_sqlbuildmanager.name}/sbmsubscriptionsession' | ||
properties: { | ||
lockDuration: 'PT30S' | ||
requiresSession: true | ||
defaultMessageTimeToLive: 'P14D' | ||
deadLetteringOnMessageExpiration: true | ||
deadLetteringOnFilterEvaluationExceptions: true | ||
maxDeliveryCount: 10 | ||
status: 'Active' | ||
enableBatchedOperations: true | ||
autoDeleteOnIdle: 'P14D' | ||
} | ||
dependsOn: [ | ||
serviceBusName | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.