Simon's SQL

SQL,DBA,tuning,Trouble Shooting,Performance

Archive for the ‘Common’ Category

SQLSaturday #740 – Orange County – [StepbyStep] SQL server Index operation for beginner to expert

Posted by Simon Cho on 04/16/2018

Thank you for joining the SQL Saturday #740 – Orange County meeting.

Here is the Presentation file for “[StepbyStep] SQL server Index operation for beginner to expert”.

 

SQLSaturday#740_OrangeCounty

Advertisements

Posted in Common | Tagged: , | Leave a Comment »

Indexed View can’t create online in the beginning.

Posted by Simon Cho on 03/08/2018

https://docs.microsoft.com/en-us/sql/relational-databases/indexes/guidelines-for-online-index-operations

Initial unique clustered index on a view is exclusive from Online Index operation.

However, unique clustered index is very required for indexed view.

Posted in Common | Tagged: , | Leave a Comment »

SQL Saturday #696 – Redmond

Posted by Simon Cho on 02/11/2018

I uploaded the presentation file on SQL Sat website.

Please check the below link.

http://www.sqlsaturday.com/696/Sessions/Schedule.aspx

Posted in Common | Leave a Comment »

An existing connection was forcibly closed by the remote host

Posted by Simon Cho on 01/19/2018

A couple of cases for this error message.

  1. Network device hardware failure.
  2. Old Driver version
  3. SQL bug. Please check the latest patch.
  4. TCP Chimney setting and the SyncAttackProtect setting.
  5. AG listener or Endpoint port misconfiguration.
  6. Encryption/Decryption issue during data transit.
    1. SSL or TLS cipher mismatch
    2. AG endpoint encryption method discrepancy.
  7. During AG or Mirroring failover transit.
  8. Network packet loss due to any reason
    1. Firewall blocking for certain case.
    2. Jumbo frame or MTU size misconfiguration.
  9. Login Authentication issue.

https://sqlperformance.com/2013/11/system-configuration/ag-connectivity

https://blogs.msdn.microsoft.com/developingfordynamicsgp/2013/12/03/tcp-chimney-setting-and-sql-server-error-tcp-provider-an-existing-connection-was-forcibly-closed-by-the-remote-host/

https://blogs.msdn.microsoft.com/docast/2017/07/27/sql-connectivity-troubleshooting-checklist/

https://technet.microsoft.com/en-us/library/ms187005(v=sql.105).aspx

https://documentation.red-gate.com/clone2/troubleshooting/installation-issues/an-existing-connection-was-forcibly-closed-by-the-remote-host-error

http://sirsql.net/content/2016/11/09/availability-groups-issue-with-2016-cu2/

Posted in Common | Tagged: | Leave a Comment »

Meltdown and Spectre update for SQL 2012 and SQL 2014

Posted by Simon Cho on 01/18/2018

Finally, MS release new service pack update for SQL 2012 and SQL 2014.

Please follow the below link for guidance for SQL server.

All official links keep updating in the same article.

SQL Server – https://support.microsoft.com/en-us/help/4073225/guidance-for-sql-server
Windows Server – https://support.microsoft.com/en-us/help/4072698/windows-server-guidance-to-protect-against-the-speculative-execution

 

Here is the recent update for SQL 2012 and SQL 2014.

4057117 Description of the security update for SQL Server 2014 SP2 CU: January 16, 2018
4057120 Description of the security update for SQL Server 2014 SP2 GDR: January 16, 2018
4057116 Description of the security update for SQL Server 2012 SP4 GDR: January 12, 2018 

 

Here are all supported versions’ link.

SQL Server 2017 GDR
SQL Server 2016 SP1 CU7*
SQL Server 2016 SP1 GDR
SQL Server 2016 RTM CU
SQL Server 2016 RTM GDR 
SQL Server 2008 SP4
SQL Server 2008 R2 SP3
SQL Server 2012 SP4 GDR
SQL Server 2012 SP3 CU
SQL Server 2012 SP3 GDR
SQL Server 2014 SP2 CU*
SQL Server 2014 SP2 GDR 

Posted in Common | Tagged: , , , , | Leave a Comment »

Meltdown and Spectre

Posted by Simon Cho on 01/10/2018

<Google Prject Zero>

It started from “Google Project Zero”.

https://googleprojectzero.blogspot.com/

Variants of this issue are known to affect many modern processors, including certain processors by Intel, AMD and ARM. For a few Intel and AMD CPU models, we have exploits that work against real software. We reported this issue to Intel, AMD and ARM on 2017-06-01.

 

Here is the guide line for SQL Server and Windows Server.

SQL Server – https://support.microsoft.com/en-us/help/4073225/guidance-for-sql-server
Windows Server – https://support.microsoft.com/en-us/help/4072698/windows-server-guidance-to-protect-against-the-speculative-execution

SQL Server Patch available for below version.

SQL 2012 and SQL 2014 should release soon.

SQL Server 2017 CU3*
SQL Server 2017 GDR
SQL Server 2016 SP1 CU7*
SQL Server 2016 SP1 GDR
SQL Server 2016 RTM CU
SQL Server 2016 RTM GDR
SQL Server 2008 SP4 (This is new version of SP4. Version number is slightly different.)
SQL Server 2008 R2 SP3(This is new version of SP3. Version number is slightly different.)

It seems like not that many articles reported SQL 2008 SP4 and SQL Server 2008 R2 SP3 with this patch.

 

<Here is the related blogs and articles>

https://www.brentozar.com/archive/2018/01/sql-server-patches-meltdown-spectre-attacks/

https://www.sqlskills.com/blogs/glenn/microsoft-sql-server-updates-for-meltdown-and-spectre-exploits/

 

Perfermance

https://cloudblogs.microsoft.com/microsoftsecure/2018/01/09/understanding-the-performance-impact-of-spectre-and-meltdown-mitigations-on-windows-systems/

 

ploited Vulnerability CVE Exploit
Name
Public Vulnerability Name Windows Changes Silicon Microcode Update ALSO Required on Host
Spectre 2017-5753 Variant 1 Bounds Check Bypass Compiler change; recompiled binaries now part of Windows Updates

Edge & IE11 hardened to prevent exploit from JavaScript

No
Spectre 2017-5715 Variant 2 Branch Target Injection Calling new CPU instructions to eliminate branch speculation in risky situations Yes
Meltdown 2017-5754 Variant 3 Rogue Data Cache Load Isolate kernel and user mode page tables No

In general, our experience is that Variant 1 and Variant 3 mitigations have minimal performance impact, while Variant 2 remediation, including OS and microcode, has a performance impact.

  • With Windows 10 on newer silicon (2016-era PCs with Skylake, Kabylake or newer CPU), benchmarks show single-digit slowdowns, but we don’t expect most users to notice a change because these percentages are reflected in milliseconds.
  • With Windows 10 on older silicon (2015-era PCs with Haswell or older CPU), some benchmarks show more significant slowdowns, and we expect that some users will notice a decrease in system performance.
  • With Windows 8 and Windows 7 on older silicon (2015-era PCs with Haswell or older CPU), we expect most users to notice a decrease in system performance.
  • Windows Server on any silicon, especially in any IO-intensive application, shows a more significant performance impact when you enable the mitigations to isolate untrusted code within a Windows Server instance. This is why you want to be careful to evaluate the risk of untrusted code for each Windows Server instance, and balance the security versus performance tradeoff for your environment.

 

Posted in Common | Tagged: , , , | Leave a Comment »

SQL Compression backup with TDE

Posted by Simon Cho on 01/10/2018

SQL Compression backup wasn’t work before SQL 2016.

 

<SQL Server 2014 and below>

https://msdn.microsoft.com/library/bb934049(SQL.120).aspx

Encrypted data compresses significantly less than equivalent unencrypted data. If TDE is used to encrypt a database, backup compression will not be able to significantly compress the backup storage. Therefore, using TDE and backup compression together is not recommended.

 

<After SQL server 2016 and above>

It could work with special command.!

https://blogs.msdn.microsoft.com/sqlcat/2016/06/20/sqlsweet16-episode-1-backup-compression-for-tde-enabled-databases/

It is important to know that while backing up a TDE-enable database, the compression will kick in ONLY if MAXTRANSFERSIZE is specified in the BACKUP command. Moreover, the value of MAXTRANSFERSIZE must be greater than 65536 (64 KB). The minimum value of the MAXTRANSFERSIZE parameter is 65536, and if you specify MAXTRANSFERSIZE = 65536 in the BACKUP command, then compression will not kick in. It must be “greater than” 65536. In fact, 65537 will do just good. It is recommended that you determine your optimum MAXTRANSFERSIZE through testing, based on your workload and storage subsystem. The default value of MAXTRANSFERSIZE for most devices is 1 MB, however, if you rely on the default, and skip specifying MAXTRANSFERSIZE explicitly in your BACKUP command, compression will be skipped.

 

Please Note :

Update April 6th, 2017

We have recently discovered some issues related to the use of TDE and backup compression in SQL Server 2016. While we fix them, here are some tips to help you avoid running into those known issues:

  • Currently it is not advisable to use striped backups with TDE and backup compression
  • If your database has virtual log files (VLFs) larger than 4GB then do not use backup compression with TDE for your log backups. If you don’t know what a VLF is, start here.
  • Avoid using WITH INIT for now when working with TDE and backup compression. Instead, for now you can use WITH FORMAT.

Posted in Common | Tagged: , , | Leave a Comment »

Update statistics blocking issue(Part 1)

Posted by Simon Cho on 11/30/2017

Update statistics is known as online operation.

Detail lock mode is in below blog.

https://www.mssqltips.com/sqlservertip/4608/does-updating-sql-server-statistics-cause-blocking/

 

However, update statistics could create seriouly blocking issue such as “SCH-M” in certain case.

Here is detail lock mode in certain case.

<Database name="TEST">
  <Locks>
    <Lock request_mode="S" request_status="GRANT" request_count="1" />
  </Locks>
  <Objects>
    <Object name="Tbl_cdc1" schema_name="dbo">
      <Locks>
        <Lock resource_type="METADATA.INDEXSTATS" index_name="PK_Tbl_cdc1" request_mode="Sch-S" request_status="GRANT" request_count="2" />
        <Lock resource_type="METADATA.STATS" request_mode="Sch-M" request_status="CONVERT" request_count="1" />
        <Lock resource_type="METADATA.STATS" request_mode="Sch-S" request_status="GRANT" request_count="1" />
        <Lock resource_type="OBJECT" request_mode="Sch-S" request_status="GRANT" request_count="2" />
        <Lock resource_type="OBJECT.UPDSTATS" request_mode="X" request_status="GRANT" request_count="1" />
      </Locks>
    </Object>
  </Objects>
</Database>

Please check that “request_mode=“Sch-M” request_status=”CONVERT“”.

I’m currently investigating detail.

I’ll share later in Part2.

 

Simon

Update statistics blocking issue(Part 1)

Posted in Common | Tagged: , | Leave a Comment »

WMI broken FCI or SQL Server

Posted by Simon Cho on 10/23/2017

Get-WmiObject -namespace "root\mscluster" -class MSCluster_Resource

Get-WmiObject : Invalid namespace

mofcomp C:\Windows\System32\wbem\ClusWMI.mof

PS C:\Windows\system32> mofcomp C:\Windows\System32\wbem\ClusWMI.mof
Microsoft (R) MOF Compiler Version 6.2.9200.16398
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: C:\Windows\System32\wbem\ClusWMI.mof
MOF file has been successfully parsed
Storing data in the repository…
Done!

 

 

Here is for SQL Server WMI issue.
Expected error message when WMI doesn’t registered properly.

The following exception occurred while trying to enumerate the collection: "An exception occurred in SMO while trying to manage a service.".
At line:xx char:xxx
+ $wmi.xxxx
+ ~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException
 + FullyQualifiedErrorId : ExceptionInGetEnumerator

Another error message when open SQL configuration manage.

Cannot connect to WMI provider. You do not have permission or the server is unreachable

 

 

 

 

 

 

 

 

 

<Solution>

Please check path and Version number in below script.

//SQL 2008
mofcomp "%programfiles(x86)%\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof"
//SQL 2012
mofcomp "%programfiles(x86)%\Microsoft SQL Server\110\Shared\sqlmgmproviderxpsp2up.mof"
//SQL 2014
mofcomp "%programfiles(x86)%\Microsoft SQL Server\120\Shared\sqlmgmproviderxpsp2up.mof"
//SQL 2016
mofcomp "%programfiles(x86)%\Microsoft SQL Server\130\Shared\sqlmgmproviderxpsp2up.mof"
//SQL 2017
mofcomp "%programfiles(x86)%\Microsoft SQL Server\140\Shared\sqlmgmproviderxpsp2up.mof"

Posted in Common | Tagged: , , | Leave a Comment »

Cannot connect to WMI provider. You do not have permission or the server is unreachable. Note that you can only manage SQL Server 2005 and later servers with SQL Server Configuration Manager.

Posted by Simon Cho on 10/23/2017

https://www.linkedin.com/pulse/how-fix-sql-server-configuration-manager-cannot-connect-mohamed-fekry/

 

Posted in Common | Leave a Comment »

Auto DB Deployment basic – SQL Angeles

Posted by Simon Cho on 06/21/2017

Please download Presentation and Demo script.

 

Auto DB deployment basic

(Free DBA work from DB deployment, just put the click button to DevOps.)

SQL server Deployment /배포/패치/점검 자동화 기초

부제 – DBA 잠좀 자게 해주세요. F5 클릭은 컴터가 알아서

 

아직도  DB 서버 배포를 손으로 하나요?

SQL package 를 이용해서 수십대의 DB에 자동으로 빠르게 배포하는방법에 대해서 살펴보겠습니다.

 

날짜

06/21/2017 03:00~05:00 (UTC)

06/21/2017 00:00~02:00 (EDT)

06/21/2017 22:00~24:00 (CDT)

06/20/2017 20:00 ~ 22:00 (PDT)

06/21/2017 12:00 ~ 14:00 (KOR)

 

장소 : 222 N Sepuveda Blvd, El Segundo, CA, 90245

온라인 링크 :   https://meet.lync.com/sqlpass365-sqlpass/sqlangeles/MMGM08Y1 (이어폰 준비)

페에스북 라이브 방송 : https://www.facebook.com/sqlmvp (스터디 시간에 맞춰서 방송합니다.)

카카오톡 오픈 채팅 : SQL Angeles 로 검색해서 채팅 참여 가능 합니다.

주의 사항 :  스피커로 청취시 반드시 마이크는 음소거로 설정.

 

Simon Cho

Database Engineer\DevOps Engineer

VISA DBA

SQL Saturday Speaker

SQL Angeles Co-founder

 

Email : simon@simonsql.com

Blog : https://simonsql.com/

LinkedIn : https://www.linkedin.com/in/simonsql/

 

[주차 안내]

길건너 해빗 버거 주차 후 도보로 이동 (약 3분 거리)

 

[Sponsored]

Posted in Common | Tagged: , | Leave a Comment »

SQLSaturday in Los Angeles 6/10

Posted by Simon Cho on 05/31/2017

We are quickly approaching 6/10.
http://www.sqlsaturday.com/640/eventhome.aspx

Top 5 reasons why you have to attend SQL Saturday in LA event

Excellent panel of 40+ Speakers:

2 x Past PASS Presidents + 1 PASS Regional Mentor

2 x Microsoft Certified Masters (MCM)

5 x Microsoft Certified Trainers (MCT)

6 x PASS Speakers

7 x Microsoft Most Valuable Professionals (MVP)

9 x Microsoft Certified Solutions Experts (MCSE)

6 x Microsoft Certified Solutions Associate (MCSA)
Free education – Please see schedule for more details

Free food – we will have coffee, orange juice and pastries for breakfast; pizza, beverages and fresh fruit for lunch

Two beautiful venues with enough room for 300 attendees

A chance to win great prizes

 

P.S. One more reason to attend a SQL Saturday in LA – attend and get a FREE e-book by O’Reilly Media!

Posted in Common | Tagged: | Leave a Comment »

SQL Saturday #613 – Redmond Presentation

Posted by Simon Cho on 04/15/2017

Today is the first day I visit the Microsoft Headquarters in Redmond.

Thank you for coming in SQL Saturday in Redmond.

 

Here are my presentation file and the demo script.

Presentation file

Demo

Posted in Common | Tagged: | Leave a Comment »

SQL Saturday #611 – Orange County Presentation

Posted by Simon Cho on 04/03/2017

Finally, I’ve completed my presentations at SQL Saturday – Orange County!

There were only 3 audiences when I did the 2nd presentation at Orange county 3 years ago.

Today, I got full audiences.

I really appreciated who came to my session and SQL Saturday.

It really encourages me and I get lots of comments from people.

 

Here is the presentation file and Demo file.

 

  1. Build ETL efficiently (10x) with Minimal Logging
    1. Presentation file is here.
  2. Myths and Truths about SQL Server Transaction
    1. Presentation file is here.
    2. Demo file is here.

 

Thank you for attending.

 

http://www.sqlsaturday.com/611/Sessions/Schedule.aspx

 

 

 

 

 

Posted in Common | Tagged: , | Leave a Comment »

SSMS 2016 Release tracking

Posted by Simon Cho on 03/07/2017

https://docs.microsoft.com/en-us/sql/ssms/sql-server-management-studio-changelog-ssms

Posted in Common | Tagged: | Leave a Comment »

Start SQL Server in Single-User Mode

Posted by Simon Cho on 03/06/2017

It’s really helpful in a very rare case.

The application name is case sensitive.

 

net start mssqlserver /m”Microsoft SQL Server Management Studio – Query”

net start mssqlserver /m”sqlcmd”

 

https://msdn.microsoft.com/en-us/library/ms188236.aspx

Posted in Common | Tagged: | Leave a Comment »

sys.sysobjvalues

Posted by Simon Cho on 02/23/2017

 

https://jongurgul.com/blog/tag/sysobjvalues/

Posted in Common | Tagged: , | Leave a Comment »

SQL Angeles Meeting 2/14 – Los Angeles

Posted by Simon Cho on 02/15/2017

SQL Angeles,

We had a meeting at 2/14, Los Angeles.

Here are the presentation file and Demo script.

Topic : Transaction Management and the Transaction Log

DownLoad

SQLPassNew February : sqlpass_news_chapter-deck-february-2017-2

 

SQL Angeles is the Local Chapter based on Los Angeles area.

Our community is for Korean SQL people.

So, we do speak in Korean during the presentation.

This time is the first try with Skype Business Online.

 

We had 5 people from Local and 9 people joined in Skype Business and shared the session together.

Thank you very much for participated in.

 

Here is the detail information how to register and join us.

http://sqlmvp.kr/220936150336

 

 

Posted in Common | Tagged: , | Leave a Comment »

Delayed Durability

Posted by Simon Cho on 02/14/2017

  • ALTER DATABASE SET DELAYED_DURABILITY = {option}
  • Disabled –Normal behavior durability guaranteed.(Default)
  • Allowed –Allowed at the DB Level, Transaction has to specify durability options, default is a durable transaction.
  • COMMIT TRAN……. WITH (DELAYED_DURABILITY=ON)
  • FORCED –Changes default durability for the DB to “delayed”. Can be useful for Applications bottlenecked on Log IO, that can tolerate some Data loss on a failure.

 

https://msdn.microsoft.com/en-us/library/dn449490(v=sql.120).aspx

 

http://info.tricoresolutions.com/blog/delayed-durability-diminishes-i/o-throughput-to-improve-performance-in-the-sql-query

Posted in Common | Tagged: | Leave a Comment »

parameter sniffing recompile options

Posted by Simon Cho on 02/06/2017

https://sqlperformance.com/2013/08/t-sql-queries/parameter-sniffing-embedding-and-the-recompile-options

Posted in Common | Tagged: , | Leave a Comment »