Author | Jess Pomfret, JessPomfret.com |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Get-DbaDbLogSpace on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaDbLogSpace.
Gets information on the database transaction log usage for each instance(s) of SQL Server.
Returns transaction log size and space used for each database on the SQL Server instance(s).
This can be used to monitor how much of your allocated transaction log space is in use, and whether it is nearing the point where it will need to grow.
Get-DbaDbLogSpace
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-Database] <String[]>]
[[-ExcludeDatabase] <String[]>]
[-ExcludeSystemDatabase]
[-EnableException]
[<CommonParameters>]
PS C:\> Get-DbaDbLogSpace -SqlInstance Server1
Returns the transaction log usage information for all databases on Server1
PS C:\> Get-DbaDbLogSpace -SqlInstance Server1 -Database Database1, Database2
Returns the transaction log usage information for both Database1 and Database 2 on Server1
PS C:\> Get-DbaDbLogSpace -SqlInstance Server1 -ExcludeDatabase Database3
Returns the transaction log usage information for all databases on Server1, except Database3
PS C:\> Get-DbaDbLogSpace -SqlInstance Server1 -ExcludeSystemDatabase
Returns the transaction log usage information for all databases on Server1, except the system databases
PS C:\> Get-DbaRegisteredServer -SqlInstance cmsServer | Get-DbaDbLogSpace -Database Database1
Returns the transaction log usage information for Database1 for a group of servers from SQL Server Central Management Server (CMS).
SQL Server name or SMO object representing the SQL Server to connect to. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
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 |
The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The database(s) to exclude - this list is auto-populated from the server.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Allows you to suppress output on system databases.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
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 |