commands

^

Update-DbaMaintenanceSolution

Author Andreas Jordan, @JordanOrdix
Availability Windows, Linux, macOS

 

Synopsis

Download and Update SQL Server Maintenance Solution created by Ola Hallengren (https://ola.hallengren.com)

Description

This script will download and update the latest version of SQL Server Maintenance Solution created by Ola Hallengren. Only the stored procedure will be updated. All tables and jobs will stay untouched.

So this can only be used until a new version of the procedures need a new version of the tables or jobs. In this case you have to completely reinstall the SQL Server Maintenance Solution with Install-DbaMaintenanceSolution.

Syntax

Update-DbaMaintenanceSolution
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [[-Database] <String>]
    [[-Solution] <String[]>]
    [[-LocalFile] <String>]
    [-Force]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Update-DbaMaintenanceSolution -SqlInstance RES14224 -Database DBA

Updates Ola Hallengren's Solution objects on RES14224 in the DBA database.

Example: 2
PS C:\> Install-DbaMaintenanceSolution -SqlInstance RES14224 -Database DBA -Solution Backup

This will update the stored procedure DatabaseBackup only, even if other parts of the solution are also installed.

Required Parameters

-SqlInstance

The target SQL Server instance onto which the Maintenance Solution will be updated.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential). Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported. For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-Database

The database where Ola Hallengren's solution is currently installed. Defaults to master.

Alias
Required False
Pipeline false
Default Value master
-Solution

Specifies which portion of the Maintenance solution to update. Valid values are All (full solution), Backup, IntegrityCheck and IndexOptimize. Defaults to All, but only existing procedures will be replaced.

Alias
Required False
Pipeline false
Default Value All
Accepted Values All,Backup,IntegrityCheck,IndexOptimize,CommandExecute
-LocalFile

Specifies the path to a local file to install Ola's solution from. This should be the zip file as distributed by the maintainers. If this parameter is not specified, the latest version will be downloaded from https://github.com/olahallengren/sql-server-maintenance-solution

Alias
Required False
Pipeline false
Default Value
-Force

If this switch is enabled, the Ola's solution will be downloaded from the internet even if previously cached.

Alias
Required False
Pipeline false
Default Value False
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False
-WhatIf

If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.

Alias cf
Required False
Pipeline false
Default Value

 

Want to see the source code for this command? Check out Update-DbaMaintenanceSolution on GitHub.
Want to see the Bill Of Health for this command? Check out Update-DbaMaintenanceSolution.