commands

^

Set-DbaDbFileGrowth

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

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

Synopsis

Sets databases to a non-default growth and growth type. 64MB by default.

To get the file growth, use Get-DbaDbFile.

Description

Sets databases to a non-default growth and growth type. 64MB by default.

To get the file growth, use Get-DbaDbFile.

Syntax

Set-DbaDbFileGrowth
    [[-SqlInstance] <DbaInstanceParameter[]>]
    [[-SqlCredential] <PSCredential>]
    [[-Database] <String[]>]
    [[-GrowthType] <String>]
    [[-Growth] <Int32>]
    [[-FileType] <String>]
    [[-InputObject] <Database[]>]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Set-DbaDbFileGrowth -SqlInstance sql2016 -Database test  -GrowthType GB -Growth 1

Sets the test database on sql2016 to a growth of 1GB

Example: 2
PS C:\> Get-DbaDatabase -SqlInstance sql2016 -Database test | Set-DbaDbFileGrowth -GrowthType GB -Growth 1

Sets the test database on sql2016 to a growth of 1GB

Example: 3
PS C:\> Get-DbaDatabase | Set-DbaDbFileGrowth -SqlInstance sql2017, sql2016, sql2012

Sets all database files on sql2017, sql2016, sql2012 to 64MB.

Example: 4
PS C:\> Set-DbaDbFileGrowth -SqlInstance sql2017, sql2016, sql2012 -Database test -WhatIf

Shows what would happen if the command were executed

Example: 5
PS C:\> Set-DbaDbFileGrowth -SqlInstance sql2017 -Database test -GrowthType GB -Growth 1 -FileType Data

Sets growth to 1GB for only data files for database test

Optional Parameters

-SqlInstance

The target SQL Server instance or instances.

Alias
Required False
Pipeline false
Default Value
-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 name of the target databases

Alias
Required False
Pipeline false
Default Value
-GrowthType

The growth type, MB by default - valid values are MB, KB, GB or TB.

Alias
Required False
Pipeline false
Default Value MB
Accepted Values KB,MB,GB,TB
-Growth

The growth value. 64 by default.

Alias
Required False
Pipeline false
Default Value 64
-FileType

Apply changes to only DATA, LOG or ALL files

Alias
Required False
Pipeline false
Default Value All
Accepted Values All,Data,Log
-InputObject

Allows piping from Get-DbaDatabase

Alias
Required False
Pipeline true (ByValue)
Default Value
-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