< Back
Measure-DbaDbVirtualLogFile
Post
NAME Measure-DbaDbVirtualLogFile
SYNOPSIS
Returns calculations on the database virtual log files for database on a SQL instance.
SYNTAX
Measure-DbaDbVirtualLogFile [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>
[[-SqlCredential] <Pscredential>] [[-Database] <System.Object[]>] [[-ExcludeDatabase] <System.Object[]>]
[-IncludeSystemDBs <Switch>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
Having a transaction log file with too many virtual log files (VLFs) can hurt database performance.
Too many VLFs can cause transaction log backups to slow down and can also slow down database recovery and, in
extreme cases, even affect insert/update/delete performance.
References:
http://www.sqlskills.com/blogs/kimberly ... r-too-few/
http://blogs.msdn.com/b/saponsqlserver/ ... database-r
ecovery.aspx
If you've got a high number of VLFs, you can use Expand-SqlTLogResponsibly to reduce the number.
PARAMETERS
-Database [<System.Object[]>]
Specifies the database(s) to process. Options for this list are auto-populated from the server. If
unspecified, all databases will be processed.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-ExcludeDatabase [<System.Object[]>]
Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-IncludeSystemDBs [<Switch>]
If this switch is enabled, system database information will be displayed.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
System.Collections.ArrayList
NOTES
Tags: VLF, Database
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Measure-DbaDbVirtualLogFile -SqlInstance sqlcluster
Returns all user database virtual log file counts for the sqlcluster instance.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Measure-DbaDbVirtualLogFile -SqlInstance sqlserver | Where-Object {$_.Count -ge 50}
Returns user databases that have 50 or more VLFs.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>@('sqlserver','sqlcluster') | Measure-DbaDbVirtualLogFile
Returns all VLF information for the sqlserver and sqlcluster SQL Server instances. Processes data via the pipeline.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Measure-DbaDbVirtualLogFile -SqlInstance sqlcluster -Database db1, db2
Returns VLF counts for the db1 and db2 databases on sqlcluster.
RELATED LINKS
https://dbatools.io/Measure-DbaDbVirtualLogFile
SYNOPSIS
Returns calculations on the database virtual log files for database on a SQL instance.
SYNTAX
Measure-DbaDbVirtualLogFile [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>
[[-SqlCredential] <Pscredential>] [[-Database] <System.Object[]>] [[-ExcludeDatabase] <System.Object[]>]
[-IncludeSystemDBs <Switch>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
Having a transaction log file with too many virtual log files (VLFs) can hurt database performance.
Too many VLFs can cause transaction log backups to slow down and can also slow down database recovery and, in
extreme cases, even affect insert/update/delete performance.
References:
http://www.sqlskills.com/blogs/kimberly ... r-too-few/
http://blogs.msdn.com/b/saponsqlserver/ ... database-r
ecovery.aspx
If you've got a high number of VLFs, you can use Expand-SqlTLogResponsibly to reduce the number.
PARAMETERS
-Database [<System.Object[]>]
Specifies the database(s) to process. Options for this list are auto-populated from the server. If
unspecified, all databases will be processed.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-ExcludeDatabase [<System.Object[]>]
Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-IncludeSystemDBs [<Switch>]
If this switch is enabled, system database information will be displayed.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
System.Collections.ArrayList
NOTES
Tags: VLF, Database
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Measure-DbaDbVirtualLogFile -SqlInstance sqlcluster
Returns all user database virtual log file counts for the sqlcluster instance.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Measure-DbaDbVirtualLogFile -SqlInstance sqlserver | Where-Object {$_.Count -ge 50}
Returns user databases that have 50 or more VLFs.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>@('sqlserver','sqlcluster') | Measure-DbaDbVirtualLogFile
Returns all VLF information for the sqlserver and sqlcluster SQL Server instances. Processes data via the pipeline.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Measure-DbaDbVirtualLogFile -SqlInstance sqlcluster -Database db1, db2
Returns VLF counts for the db1 and db2 databases on sqlcluster.
RELATED LINKS
https://dbatools.io/Measure-DbaDbVirtualLogFile