블로그 이미지
SQL Server VS. 석이 minsouk@hotmail.com MSSQL 쿼리성능 관련해 궁금한 사항이 있다면 언제나 누구나 TeamViewer + Line (네이버 japan 메신저) 에 minsouk1 추가 후 연락주세요~ 010-9967-0955 보미아빠

카테고리

보미아빠, 석이 (452)
밥벌이 (16)
싸이클 (1)
일상 (1)
Total222,037
Today129
Yesterday150

달력

« » 2018.10
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

공지사항

1

분류없음 / 2017.12.30 02:03

https://youtu.be/FK2k1JSrRE0

Posted by 보미아빠

디폴트 인스턴스에 모든 traceflag 를 다 지우고 변수에 있는것들만 추가해준다. 


#Get SQL Server Instance Path:

$TraceFlags = "-T1117 -T1118"

$SQLService = "SQL Server (MSSQLSERVER)"; 

$SQLInstancePath = "";

$SQLServiceName = ((Get-Service | WHERE { $_.DisplayName -eq $SQLService }).Name).Trim();

If ($SQLServiceName.contains("`$")) { $SQLServiceName = $SQLServiceName.SubString($SQLServiceName.IndexOf("`$")+1,$SQLServiceName.Length-$SQLServiceName.IndexOf("`$")-1) }

foreach ($i in (get-itemproperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server").InstalledInstances)

{

  If ( ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL").$i).contains($SQLServiceName) ) 

  { $SQLInstancePath = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\"+`

  (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL").$i}

$SQLInstancePath


#Delete All Param

$ParamCount = (Get-ItemProperty "$SQLInstancePath\MSSQLServer\Parameters" | Select SQLArg*  | Format-List | Out-String ).Split(":").Count -8

for ($i=0; $i -le $ParamCount; $i++)

{

    $ParamNumber = $i + 3

    Remove-ItemProperty -Path "$SQLInstancePath\MSSQLServer\Parameters" -Name ("SQLArg$ParamNumber") 

}


#Add New Param 

$ParamNumber = 3

$TraceFlags.Split(" ") | ForEach {

    $ParamValue = "$_"

    New-ItemProperty -Path "$SQLInstancePath\MSSQLServer\Parameters" -Name ("SQLArg$ParamNumber") -Value $ParamValue -PropertyType String -Force | Out-Null

    $ParamNumber++

}

(Get-ItemProperty "$SQLInstancePath\MSSQLServer\Parameters" | Select SQLArg*  | Format-List | Out-String ).trim() -replace "SQLArg","`tSQLArg"


Posted by 보미아빠

prepare in...

분류없음 / 2017.12.09 11:00
PreparedStatement statement = connection.prepareStatement("Select * from test where field in (?)");
Array array = statement.getConnection().createArrayOf("VARCHAR", new Object[]{"A1", "B2","C3"});
statement.setArray(1, array);
ResultSet rs = statement.executeQuery();


Posted by 보미아빠

최근에 달린 댓글

최근에 받은 트랙백

글 보관함