Author | Brandon Abshire, netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Test-DbaIdentityUsage on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaIdentityUsage.
Analyzes IDENTITY column seed consumption and calculates percentage of available range used.
Scans IDENTITY columns across databases to calculate how much of the available seed range has been consumed based on data type limits (tinyint, smallint, int, bigint). This helps DBAs proactively identify tables approaching identity exhaustion before they hit maximum values and cause application failures. The function calculates percentage used by comparing current identity values against theoretical maximums, so you can plan remediation like reseeding or changing data types before problems occur.
Test-DbaIdentityUsage
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-Database] <Object[]>]
[[-ExcludeDatabase] <Object[]>]
[[-Threshold] <Int32>]
[-ExcludeSystem]
[-EnableException]
[<CommonParameters>]
PS C:\> Test-DbaIdentityUsage -SqlInstance sql2008, sqlserver2012
Check identity seeds for servers sql2008 and sqlserver2012.
PS C:\> Test-DbaIdentityUsage -SqlInstance sql2008 -Database TestDB
Check identity seeds on server sql2008 for only the TestDB database
PS C:\> Test-DbaIdentityUsage -SqlInstance sql2008 -Database TestDB -Threshold 20
Check identity seeds on server sql2008 for only the TestDB database, limiting results to 20% utilization of seed range or higher
The target SQL Server instance or 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 |
Specifies which databases to scan for IDENTITY column usage. Accepts multiple database names as an array.
Use this when you need to focus analysis on specific databases rather than scanning all databases on the instance.
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 specify a minimum % of the seed range being utilized. This can be used to ignore seeds that have only utilized a small fraction of the range.
Alias | |
Required | False |
Pipeline | false |
Default Value | 0 |
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 |