I want to fix the identity gap bug in SQL Server 2012 via the -T272 startup parameter.

How can I automate this after installation? I found no install parameter for startup parameters.

  • 1
    One correction, the trace flag for this should be added with a lowercase t so -t272 instead of -T272. It is noted here
    – user507
    Dec 23, 2015 at 14:45

2 Answers 2


If you go just over half way down on this link you will see the startup parameter for trace flags.

You can add them in the configuration manager here:

enter image description here

In this case it would be -T272 with the capital T. Per the link the lower case t is for specific flags used by the support engineers.

EDIT @MaxVernon pointed out I'd missed the point of the question :) Shawn Melton has a post here were he discusses what you are trying to do. He has a script that you can run to add startup parameters. Mike Fal then wrote a followup here where he shares a function he wrote called Set-SQLStartupParameters that is supposed to be somewhat safer than Shawn's method.

Here is Shawn's code: (Mike's requires a download from GitHub so you can follow the links if you'd like that one.)

$server = 'MyServer'
$sqlservice = "MSSQLSERVER"
$sqlagentservice = "SQLSERVERAGENT"
$flagsToAdd = ';-T1117;-T1118;-T3226"

Add-Type -AssemblyName "Microsoft.SqlServer.SqlWmiManagement,Version=,Culture=neutral,PublicKeyToken=89845dcd8080cc91"
$sqlwmi = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer $server
$wmisvc = $sqlwmi.Services | where {$_.name -eq $sqlservice}
$wmisvc.StartupParameters = $wmisvc.StartupParameters + $flagsToAdd

Start-Sleep -seconds 15

$wmiAgent = $sqlwmi.Services | where {$_.name -eq $sqlagentservice}

You can automate the addition of startup parameters e.g. adding -T271 or -T1117 or -T1118, etc using PowerShell as a post install step.

Since you are running on sql server 2012, you can use my script to find out what trace flags are set as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.