<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7571776149258983219</id><updated>2026-06-01T19:12:33.983+05:30</updated><category term="ALWAYS ON"/><category term="Administration"/><category term="Performance"/><category term="SQL Azure"/><category term="Partitioning"/><category term="Adventureworks TSQL paractice series"/><category term="SQL Server clustering on Linux"/><category term="Clustering"/><category term="Azure Managed Instance"/><category term="replication"/><category term="Oracle"/><category term="SQL Server Multi Subnet on Linux"/><category term="SSIS"/><category term="powershell"/><title type='text'>RDBMS HUB</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>105</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-6795049476884209502</id><published>2021-09-14T15:35:00.003+05:30</published><updated>2021-09-14T15:35:49.371+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Administration"/><title type='text'>Syspolicy Purge History job getting failed </title><content type='html'>&lt;p&gt;Hi Friends,&lt;/p&gt;&lt;p&gt;This is a very simple post where I will provide&amp;nbsp; a solution for the failure of the job &quot;syspolicy_purge_history&quot;.&amp;nbsp;&lt;/p&gt;&lt;p&gt;In my environment we had SQL 2017 on one of the machines and later I was asked to install SQL 2012. After the installation as you know, this job would get created automatically.&lt;/p&gt;&lt;p&gt;This job contains 3 steps out of which the job is getting failed at the 3rd step with the below error message&lt;/p&gt;&lt;p&gt;&lt;b&gt;The error information returned by PowerShell is: &#39;Could not load file or assembly &#39;file:///D:\Program Files (x86)\Microsoft SQL Server\140\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSSnapins.dll&#39; or one of its dependencies.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;It can be fixed quite easily by just changing the environment variables. When it comes to root cause this happened as the newly installed SQL Version (lower)&amp;nbsp; PowerShell module being sit to the bottom of the PowerShell Module list. As a result, it looks for higher version when executing the Powershell Script.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqHeENHvfNCt_NP_FIl9goGiUhQzxnI36C-fz1dOCI7q4lnhSgGeURhhZtQM_8uGAHSXE5f2YivfPNYR2WY4ObTAu9TK6uy4mn_N2Cif0KgKZzwWF7fjYeq0_ccMSSSATTs4ch0NdrBDk/s829/ps_purge_1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;696&quot; data-original-width=&quot;829&quot; height=&quot;538&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqHeENHvfNCt_NP_FIl9goGiUhQzxnI36C-fz1dOCI7q4lnhSgGeURhhZtQM_8uGAHSXE5f2YivfPNYR2WY4ObTAu9TK6uy4mn_N2Cif0KgKZzwWF7fjYeq0_ccMSSSATTs4ch0NdrBDk/w640-h538/ps_purge_1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;select the PSModulepath and click on Edit button&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO0hw-6waNfz3Y9k7ay15jkCQCS9uGzQMSpvIBWfDZ-rd2Z6yIiFx8LvTwm1SZ4LJ9jpV3fkumHwKiQ6vrr83x6lIFQ9qZ-osRXerNp-3eTgrHV6NdHY1c0P4bIHChqQjZuthYcxENxzk/s818/ps_purge_2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;818&quot; data-original-width=&quot;739&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO0hw-6waNfz3Y9k7ay15jkCQCS9uGzQMSpvIBWfDZ-rd2Z6yIiFx8LvTwm1SZ4LJ9jpV3fkumHwKiQ6vrr83x6lIFQ9qZ-osRXerNp-3eTgrHV6NdHY1c0P4bIHChqQjZuthYcxENxzk/w578-h640/ps_purge_2.PNG&quot; width=&quot;578&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As you can see from the above image the 2017 version is sitting on top of 2012 hence we just need to move up 2012 ahead of 2017 to overcome this error.&lt;/p&gt;&lt;p&gt;I believe sometimes small tips will save lot of time hence sharing this.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks for Reading.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/6795049476884209502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/6795049476884209502?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/6795049476884209502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/6795049476884209502'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2021/09/syspolicy-purge-history-job-getting.html' title='Syspolicy Purge History job getting failed '/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqHeENHvfNCt_NP_FIl9goGiUhQzxnI36C-fz1dOCI7q4lnhSgGeURhhZtQM_8uGAHSXE5f2YivfPNYR2WY4ObTAu9TK6uy4mn_N2Cif0KgKZzwWF7fjYeq0_ccMSSSATTs4ch0NdrBDk/s72-w640-h538-c/ps_purge_1.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-6441270615625860236</id><published>2021-05-16T01:31:00.003+05:30</published><updated>2021-05-16T01:31:39.654+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Administration"/><title type='text'>A Bizarre  scenario of connecting to Database Engine with different tools</title><content type='html'>&lt;p&gt;Hi Friends,&lt;/p&gt;&lt;p&gt;I wish all of you are doing safe and my sincere prayers to all of them who lost their lives during this battle with the on-going Pandemic. I am not able to focus on my work as many of my families got affected and I am trying my best to come out of this.&lt;/p&gt;&lt;p&gt;This post is more of a questionnaire rather than a solution. I got a mail last week saying the application team are getting time out Errors when they are trying to connect to Secondary replicas for reporting purpose.&lt;/p&gt;&lt;p&gt;As we know my initial checks are with Always ON Routing and couldn&#39;t find any issues in that.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Later I started checking from my end and surprisingly I didn&#39;t find any issues with SQL Server Management Studio from the Jump Server.&lt;/p&gt;&lt;p&gt;Then I tested the same with SQLCMD and I got the below Error.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjantfqYxHIECuoy46Kg7VytuGgvREScQi0dyRi6IjVlv3fxq9NxAZdJZyj6XEPfFJj-9yQlpo9vihAOIl4QnGW-RPj8jDPLzgv1Kg4ohXGmfnzUlzd8ZOQ4Hb3W4ZNLSBp2RCGGaeSjaQ/s962/sqlcmd_blog1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;68&quot; data-original-width=&quot;962&quot; height=&quot;46&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjantfqYxHIECuoy46Kg7VytuGgvREScQi0dyRi6IjVlv3fxq9NxAZdJZyj6XEPfFJj-9yQlpo9vihAOIl4QnGW-RPj8jDPLzgv1Kg4ohXGmfnzUlzd8ZOQ4Hb3W4ZNLSBp2RCGGaeSjaQ/w640-h46/sqlcmd_blog1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;I am really not sure what went wrong as the same is working from SSMS then I tried from UDL by selecting SQL Server Native Client as the driver and I got the below error&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSX2en0aD8wf1vER6wpozb-6txBTa1k7uFXhxnxnt9yn0978YrSTQ9b_0qdnn750ivHILTLWfXR6YPTCfepsYj266dVzyQpdt_hSPS9GalKz5Vyx8d98r3nV9ThRCJ981-WWMy3pprJP8/s717/UDL_blog1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;262&quot; data-original-width=&quot;717&quot; height=&quot;234&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSX2en0aD8wf1vER6wpozb-6txBTa1k7uFXhxnxnt9yn0978YrSTQ9b_0qdnn750ivHILTLWfXR6YPTCfepsYj266dVzyQpdt_hSPS9GalKz5Vyx8d98r3nV9ThRCJ981-WWMy3pprJP8/w640-h234/UDL_blog1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;As mentioned I am not getting the error messages from SSMS however from SQLCMD or UDL file it it not working. I don&#39;t have Azure Data Studio to test this out unfortunately.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Login time out Expired&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Unable to complete login process due to delay in opening the server connection&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;span&gt;Later I tested the same from my Monitoring server &amp;amp; Reporting server instead of the jump server and from both the servers the results are fine.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;span&gt;I understood now there lies some problem from the Jump server but how to prove as said in the title this is really weird as there are no issues from SSMS.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;span&gt;So I started thinking bit further and made use of -l parameter to my SQLCMD usage&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgph0-6LDV8Hku0wYpIaKHlZKhMT5DU9C-soVbWSSl5cPIOE8Z7_PH9zLNAbkAH7OnNCk04Kbcpo3sJimKULOKkZpZmx2r2wNBTJOiMwkVcHEzqeZhn31nFlSUkvzPsjTzWS6512i-ucS8/s993/sqlcmd_blog2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;184&quot; data-original-width=&quot;993&quot; height=&quot;118&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgph0-6LDV8Hku0wYpIaKHlZKhMT5DU9C-soVbWSSl5cPIOE8Z7_PH9zLNAbkAH7OnNCk04Kbcpo3sJimKULOKkZpZmx2r2wNBTJOiMwkVcHEzqeZhn31nFlSUkvzPsjTzWS6512i-ucS8/w640-h118/sqlcmd_blog2.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;This time I am able to connect to the Listener as you can see from the above image if I don&#39;t use that I got the error&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;I thought of doing the same for my UDL test connection too&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5ixGRzTHGNwrw5FIq1Y2ItMlcdnY6weo0Lh7BqjOAFzfYQk48xNQE5TwJkI71Ci1vFIvGQxhD9udwSTOZXTVBZgppQWtc2mUj108GfosN13pdsdybg4e96I6wDXcWdX0u-tB2OxRnd-8/s554/UDL_blog2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;408&quot; data-original-width=&quot;554&quot; height=&quot;295&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5ixGRzTHGNwrw5FIq1Y2ItMlcdnY6weo0Lh7BqjOAFzfYQk48xNQE5TwJkI71Ci1vFIvGQxhD9udwSTOZXTVBZgppQWtc2mUj108GfosN13pdsdybg4e96I6wDXcWdX0u-tB2OxRnd-8/w400-h295/UDL_blog2.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEYcNN1LYalkqhGc5gvLZUy5hYcrLSCWOi8DEOxZx3iEP_HEH3X0i-PP8A_oJoWti07XvnEqK7YLJv1_bF2fJklL0XnQ1lu6YcU9ewdXUxTlyWIRxrB_HyOywC1Sx0fA1iRziqfFeogGQ/s576/UDL_blog3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;200&quot; data-original-width=&quot;576&quot; height=&quot;139&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEYcNN1LYalkqhGc5gvLZUy5hYcrLSCWOi8DEOxZx3iEP_HEH3X0i-PP8A_oJoWti07XvnEqK7YLJv1_bF2fJklL0XnQ1lu6YcU9ewdXUxTlyWIRxrB_HyOywC1Sx0fA1iRziqfFeogGQ/w400-h139/UDL_blog3.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic-Ot2icC2EKZj6RN04OcNwQpQq9zJSCdKoShNGIX57qpH8XZjdFGTFOb-vkjTNtf8CU2YVb45BICkglZJy9FPOtSfbDH6hOth9mXut3JueQmuU-ZNKZ82mYUmXYFi27iFxBL9ZCkqn7M/s719/UDL_blog4.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;719&quot; data-original-width=&quot;639&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic-Ot2icC2EKZj6RN04OcNwQpQq9zJSCdKoShNGIX57qpH8XZjdFGTFOb-vkjTNtf8CU2YVb45BICkglZJy9FPOtSfbDH6hOth9mXut3JueQmuU-ZNKZ82mYUmXYFi27iFxBL9ZCkqn7M/w355-h400/UDL_blog4.PNG&quot; width=&quot;355&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;As you can see we have an option to set the connection time out property as well as Application Intent there. And the connection went fine only if I made use of &quot;MICROSOFT OLEDB PROVIDER FOR SQL SERVER&quot; but not with &quot;SQL SERVER NATIVE CLIENT 11.0&quot;.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Now the questions left with me are&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;1) How come SSMS is working fine?&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;2) Why there are no issues from Monitoring server and Reporting server but only from Jump server?&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;3) why only with OLEDB provider but not with Native client?&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;To debunk this I tried further and got the below solutions but I am not sure if these are the right answers.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;1)How come from SSMS?&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Because SSMS uses&amp;nbsp;.Net SqlClient Data Provider below is the image which confirms the same. Also I made use of below powershell script to see if I am getting the proper server names with &amp;amp; with out Application Intent.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3O-sIOzOZiUlfD5TrTGXLQVAxXeMIE7ZYTqrXr23UW5ZNGKlA2unvn1VB9YAZZmnTen5o9ZDCBjIoZrM-4-JGeyKeNPhdNzIgiFVWMgpHbzkOpfCI3X7fzbTzV2zeAAEtC4zz7SkiSaI/s1176/sqlcmd_blog3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;159&quot; data-original-width=&quot;1176&quot; height=&quot;86&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3O-sIOzOZiUlfD5TrTGXLQVAxXeMIE7ZYTqrXr23UW5ZNGKlA2unvn1VB9YAZZmnTen5o9ZDCBjIoZrM-4-JGeyKeNPhdNzIgiFVWMgpHbzkOpfCI3X7fzbTzV2zeAAEtC4zz7SkiSaI/w640-h86/sqlcmd_blog3.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;[string] $Server= &quot;ListenerName&quot;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;[string] $Database = &quot;DBNAME&quot;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;[string] $SqlQuery= $(&quot;SELECT @@servername&quot;)&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$Command = New-Object System.Data.SQLClient.SQLCommand&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$Command.Connection = $Connection&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$SqlConnection = New-Object System.Data.SqlClient.SqlConnection&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$SqlConnection.ConnectionString = &quot;Server = $Server; Database = $Database; Integrated Security = True;&quot;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$SqlCmd = New-Object System.Data.SqlClient.SqlCommand&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$SqlCmd.CommandText = $SqlQuery&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$SqlCmd.Connection = $SqlConnection&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$SqlAdapter.SelectCommand = $SqlCmd&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$DataSet = New-Object System.Data.DataSet&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$SqlAdapter.Fill($DataSet)&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$DataSet.Tables[0] | out-file &quot;C:\jump\powershell.txt&quot;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;2) Why there are no issues from Monitoring server and Reporting server but only from Jump server?&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For this I ran tracert and from the jump server and from the monitoring server below is the output . The picture says it all. Form the jump server as expected I got multiple hops and some times time outs as well.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidLu0I0uYPrrMbIb4SkHW_UPcUlLtFYOXlRVSEjhLZqiO_DN2Ezl9eOORpgf7bgoHW2UuwX3ai9NZUSBuZX61eKEjkksRj7mClpmWolK04uBuFUgdW0-z0W8bjpydIUN-vz2gHZ-QnYko/s593/sqlcmd_blog4.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;134&quot; data-original-width=&quot;593&quot; height=&quot;90&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidLu0I0uYPrrMbIb4SkHW_UPcUlLtFYOXlRVSEjhLZqiO_DN2Ezl9eOORpgf7bgoHW2UuwX3ai9NZUSBuZX61eKEjkksRj7mClpmWolK04uBuFUgdW0-z0W8bjpydIUN-vz2gHZ-QnYko/w400-h90/sqlcmd_blog4.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3VoRzm8vfC7kvgWsMBXxuq7xxTfO57_DGY8NS6P6ZV3rLGHRbQZ8u8GGV4jbUfsFFMst3BG5V3jHDbkZ76oSXAaWifotHDOAavcux89LyELenKp8ezbTESwhxP2mONiJWpDiKMI3btrU/s678/sqlcmd_blog5.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;227&quot; data-original-width=&quot;678&quot; height=&quot;134&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3VoRzm8vfC7kvgWsMBXxuq7xxTfO57_DGY8NS6P6ZV3rLGHRbQZ8u8GGV4jbUfsFFMst3BG5V3jHDbkZ76oSXAaWifotHDOAavcux89LyELenKp8ezbTESwhxP2mONiJWpDiKMI3btrU/w400-h134/sqlcmd_blog5.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;3) why only with OLEDB provider but not with Native client?&lt;/p&gt;&lt;p&gt;Well I don&#39;t have an answer for this but as per the below link there are no updates being shipped with SQL Server Native Client.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/sql/connect/connect-history?view=sql-server-ver15&quot; target=&quot;_blank&quot;&gt;https://docs.microsoft.com/en-us/sql/connect/connect-history?view=sql-server-ver15&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Conclusion: To Mitigate the issue I made use of -l parameter and the issue got resolved to certain extent and this is how I worked to answer my self to the questions pose while connecting to DB Engine from different tools.&lt;/p&gt;&lt;p&gt;Hope you Learned something new and Happy Reading. Stay Safe.&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/6441270615625860236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/6441270615625860236?isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/6441270615625860236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/6441270615625860236'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2021/05/a-bizarre-scenario-of-connecting-to.html' title='A Bizarre  scenario of connecting to Database Engine with different tools'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjantfqYxHIECuoy46Kg7VytuGgvREScQi0dyRi6IjVlv3fxq9NxAZdJZyj6XEPfFJj-9yQlpo9vihAOIl4QnGW-RPj8jDPLzgv1Kg4ohXGmfnzUlzd8ZOQ4Hb3W4ZNLSBp2RCGGaeSjaQ/s72-w640-h46-c/sqlcmd_blog1.PNG" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-6152491880050120907</id><published>2021-03-27T11:54:00.001+05:30</published><updated>2021-03-27T11:54:56.164+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Performance"/><title type='text'>How to make use of SP_BlitzCache to resolve performance issues</title><content type='html'>&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;Hi Mates,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;
It has been almost 2 months since I posted something in my blog. In this post I
would like to share one of the performance issues of what we had in my
Environment.&lt;br /&gt;
&lt;br /&gt;
I wonder how we will work without our beloved SQL giants say (Paul Randal &amp;amp;
his Team, Brent Ozar and many more). Their contribution to SQLServer is immense
and it&#39;s helping DBA&#39;s to achieve their tasks.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;Coming to the problem
I got an invitation to join a performance issue and they observed the
transactions are getting timed out. Eventually everyone feels it&#39;s Database
issue.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;Unfortunately, I do
not know much about the Environment and we got the access to the databases
recently.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;When checked I could
see blocking however it did not last for more than 5 seconds. I came to know that
environment handles card processing which means every transaction has to happen with in 15 seconds.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;So Back to title how SP_BlitzCache helped me? When I ran the SP I could see one of the stored procedures being prone to Deadlocks and Blocking.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18px;&quot;&gt;Upon Looking further this SP has some few 100 lines of code and one of the table has got only one clustered index.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;After running&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18px;&quot;&gt;SP_BlitzCache I could see this SP is going for trivial optimization instead of full.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18px;&quot;&gt;If you are aware of trivial plans then you can read further&amp;nbsp; if not below is the link which explains about trivial plans&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;a href=&quot;https://www.erikdarlingdata.com/tasting-menu/the-sql-server-performance-tasting-menu-trivial-plans/&quot; target=&quot;_blank&quot;&gt;https://www.erikdarlingdata.com/tasting-menu/the-sql-server-performance-tasting-menu-trivial-plans/&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;That SP is getting executed quite frequently (57 executions per minute) and there are too many Lock Escalations too.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;What is the problem with trivial plans? It will not give us missing index recommendation.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;My initial suggestion is to make use of Trace flag 8757&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;OPTION(QUERYTRACEON 8757).&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;I made use of this in lower environment and re-run the query and as expected the execution plan come up with Missing Index recommendation.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1UL5cMib3dCvwYr4wBxzR7uXZ89vRAfMjteD7HJuiSiTS1G5jX-lEQCGbvVs32SztBm8gtvqn-JNW7FtdB-NEeyGvZvtVGgIx1ATUVM_XD5Fe2QMPTM1FMsdDBxFPTZpyKqWoMWz85mo/s1226/trivial+plans.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;165&quot; data-original-width=&quot;1226&quot; height=&quot;86&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1UL5cMib3dCvwYr4wBxzR7uXZ89vRAfMjteD7HJuiSiTS1G5jX-lEQCGbvVs32SztBm8gtvqn-JNW7FtdB-NEeyGvZvtVGgIx1ATUVM_XD5Fe2QMPTM1FMsdDBxFPTZpyKqWoMWz85mo/w640-h86/trivial+plans.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;so now the question is should we make use of trace flag all the time to &lt;/span&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;achieve&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&amp;nbsp;Full optimization? Well, not really once you create that missing non clustered index you don&#39;t need that trace flag any more as SQL Engine will go for FULL optimization automatically.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;Before the index creation we used to get Deadlock and Blocking alerts quite frequently after that all the alerts got hassle free.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;Once again I would like to thanks Brent Ozar for his great help to the SQL Community.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoListParagraph&quot; style=&quot;margin-left: 108.0pt; mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/6152491880050120907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/6152491880050120907?isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/6152491880050120907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/6152491880050120907'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2021/03/how-to-make-use-of-spblitzcache-to.html' title='How to make use of SP_BlitzCache to resolve performance issues'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1UL5cMib3dCvwYr4wBxzR7uXZ89vRAfMjteD7HJuiSiTS1G5jX-lEQCGbvVs32SztBm8gtvqn-JNW7FtdB-NEeyGvZvtVGgIx1ATUVM_XD5Fe2QMPTM1FMsdDBxFPTZpyKqWoMWz85mo/s72-w640-h86-c/trivial+plans.PNG" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-5521060398431085488</id><published>2021-01-29T19:45:00.002+05:30</published><updated>2021-01-29T19:47:01.423+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure Managed Instance"/><title type='text'>How to restore Database from one Managed instance to other</title><content type='html'>&lt;p&gt;Hi Mates,&lt;/p&gt;&lt;p&gt;Today I would like to share about restoring a database from one Managed Instance to other. We have 2 methods to achieve this.&lt;/p&gt;&lt;p&gt;1) Traditional way of using Azure Storage Explorer&lt;/p&gt;&lt;p&gt;2) Azure CLI&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;unfortunately as of now we can&#39;t perform this using Azure portal&lt;/p&gt;&lt;p&gt;When it comes to Traditional way we need to backup the database to blob storage container. you can use command or GUI to achieve this.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Before doing this we need to configure that and in our environment we don&#39;t have permissions hence informed to Hosting team to create one. upon getting the information we need to create credentials under security in Management Studio&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg25VmUcqlBewJVEGoUB3fHtnk1I-cSjMCC1VI4jgpoJXuv240f9xqc4Ez2ymP2lbUNWV52M_aA-ocrKGAmqB7q_Aux1_fAZgJZDGSfRRulElTaJB1C4XVjFCO2OM1__VojJJz6zyHlqTA/s701/azureMI_cred.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;541&quot; data-original-width=&quot;701&quot; height=&quot;494&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg25VmUcqlBewJVEGoUB3fHtnk1I-cSjMCC1VI4jgpoJXuv240f9xqc4Ez2ymP2lbUNWV52M_aA-ocrKGAmqB7q_Aux1_fAZgJZDGSfRRulElTaJB1C4XVjFCO2OM1__VojJJz6zyHlqTA/w640-h494/azureMI_cred.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;After that you can trigger the backup using TSQL command or GUI like below. Keep in mind we can trigger copy-only backups&amp;nbsp; as the backups will be taken care automatically in MI&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;BACKUP DATABASE [XXXXXXX]&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot; /&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;TO URL = &#39;&lt;/span&gt;&lt;a class=&quot;sc-dqBHgY hiPvaM&quot; data-renderer-mark=&quot;true&quot; href=&quot;https://sapaysqltest01.blob.core.windows.net/paysqltestdbpb/AUTOTEST_Test_20200424.bak&quot; style=&quot;background-color: white; color: #0052cc; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; letter-spacing: -0.08px; text-decoration-line: none; white-space: pre-wrap;&quot; title=&quot;https://sapaysqltest01.blob.core.windows.net/paysqltestdbpb/AUTOTEST_Test_20200424.bak&quot;&gt;https://XXXXXX.blob.core.windows.net/XXXXX/XXXX_20200424.bak&lt;/a&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&#39;&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot; /&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;WITH COPY_ONLY&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHf1obR0p6CK3LsbQwdaCHw_McUcbGWQYasinOtAmuB0SegawlTRq3US_3LWf5S6z04bSZvYIR-JDgYP_rutfWgnl0HuZjYqo17eWxWz00EG66SJNRAB2GQBeyRO6vX-cYA_vqbtgakOQ/s914/azure_backup.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;631&quot; data-original-width=&quot;914&quot; height=&quot;442&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHf1obR0p6CK3LsbQwdaCHw_McUcbGWQYasinOtAmuB0SegawlTRq3US_3LWf5S6z04bSZvYIR-JDgYP_rutfWgnl0HuZjYqo17eWxWz00EG66SJNRAB2GQBeyRO6vX-cYA_vqbtgakOQ/w640-h442/azure_backup.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;once done you can check your backups in Azure storage Explorer where we have option of upload/Download&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ2dAbKRSO7ObWrUCoR7r_7toij6lsuW13_WZb3hpu4XHlyVypfCLTZEYnTHWYsJfc9NU_qE_WmtDwJYo9tB9J7tyqRukU4qUtq6pMHle7SUsSigPQdYhdxO8HK6SKgnDMXBqCKRPOOLY/s910/download_azure_mi.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;67&quot; data-original-width=&quot;910&quot; height=&quot;48&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ2dAbKRSO7ObWrUCoR7r_7toij6lsuW13_WZb3hpu4XHlyVypfCLTZEYnTHWYsJfc9NU_qE_WmtDwJYo9tB9J7tyqRukU4qUtq6pMHle7SUsSigPQdYhdxO8HK6SKgnDMXBqCKRPOOLY/w640-h48/download_azure_mi.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;In this case we need to download the backup to our local server and then need to upload the backup file to another Managed instance blob container.&amp;nbsp;&lt;br /&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9WaqDEVw_Ye02YRQz9RYQEypNnimoVAix212KSNZsPbw5oxb8gdKNB6845OYKSyZJgpCT8AJBYefYW_jJh5k54XHZwgwwwxlnzTVhSAr_47IuDX4n44aBSbzVaUk7mI6kTwc4bqSEYro/s1321/Download_storgae_MI.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;97&quot; data-original-width=&quot;1321&quot; height=&quot;46&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9WaqDEVw_Ye02YRQz9RYQEypNnimoVAix212KSNZsPbw5oxb8gdKNB6845OYKSyZJgpCT8AJBYefYW_jJh5k54XHZwgwwwxlnzTVhSAr_47IuDX4n44aBSbzVaUk7mI6kTwc4bqSEYro/w640-h46/Download_storgae_MI.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #172b4d; font-size: 16px; letter-spacing: -0.08px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;After Uploading the file we need to perform the restore.&lt;/p&gt;&lt;p&gt;restore database [XXXXXX] from URL=&#39;https://XXXXX.blob.core.windows.net/XXXX/XXX_backup_2021_01_29_130404.bak&#39;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Unlike in on-premises we can&#39;t run with stats as it throws an error. Interestingly when I tried to perform restore from GUI I got the below error. Probably it might be due to permission issue&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSjJLt_dHPUIDY9JAclgic1IwWt5ID26EzJ5RMeKlTLijxVh-GA7suCXGVEDRFyjhtCQMQDMsWSV2kczZDh5SVp6Sbxr3pjOgKUv64Jl-C-shIWGaFaOIWPVelXsFQLzuxvxolIg4_3G0/s932/restore_error_mi.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;319&quot; data-original-width=&quot;932&quot; height=&quot;220&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSjJLt_dHPUIDY9JAclgic1IwWt5ID26EzJ5RMeKlTLijxVh-GA7suCXGVEDRFyjhtCQMQDMsWSV2kczZDh5SVp6Sbxr3pjOgKUv64Jl-C-shIWGaFaOIWPVelXsFQLzuxvxolIg4_3G0/w640-h220/restore_error_mi.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;We can go with first method provided if we don&#39;t have permissions to carry out using AZ&amp;nbsp;&lt;span style=&quot;background-color: #f2f2f2; color: #292929; font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 16px; letter-spacing: -0.352px; white-space: pre-wrap;&quot;&gt;az sql midb restore.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;In my Environment we don&#39;t have permissions to make use of that and I got the below error.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm3YzbOJ3CtsskZcI_6WiPD8MVfhjIU3urSwffoVeumPfTtyqAQaJ0erqYYpLaLLpYt1wwCOEKiHEEg7X9y6fJK6yAIa2BC3YCCk6rZP5luch_kc6SZvT9V5Lum5PoKekidAufsPhCHVE/s934/azmisqdbrestore.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;150&quot; data-original-width=&quot;934&quot; height=&quot;102&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm3YzbOJ3CtsskZcI_6WiPD8MVfhjIU3urSwffoVeumPfTtyqAQaJ0erqYYpLaLLpYt1wwCOEKiHEEg7X9y6fJK6yAIa2BC3YCCk6rZP5luch_kc6SZvT9V5Lum5PoKekidAufsPhCHVE/w640-h102/azmisqdbrestore.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;How to make use Azure CLI? At first install AZ CLI on your jump server. Then Launch PowerShell and run the command AZ Login which will redirect to your browser popping for user name and password.&lt;/p&gt;&lt;p&gt;Next we need to set subscription by running the below command. you can get the subscription details using portal or using commands&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;SFMono-Medium, &amp;quot;SF Mono&amp;quot;, &amp;quot;Segoe UI Mono&amp;quot;, &amp;quot;Roboto Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, Menlo, Consolas, Courier, monospace&quot; style=&quot;background-color: #f4f5f7; color: #172b4d; font-size: 14px; white-space: pre;&quot;&gt;az account &lt;/span&gt;&lt;span class=&quot;token&quot; face=&quot;SFMono-Medium, &amp;quot;SF Mono&amp;quot;, &amp;quot;Segoe UI Mono&amp;quot;, &amp;quot;Roboto Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, Menlo, Consolas, Courier, monospace&quot; style=&quot;background-color: #f4f5f7; color: #172b4d; font-size: 14px; white-space: pre;&quot;&gt;set&lt;/span&gt;&lt;span face=&quot;SFMono-Medium, &amp;quot;SF Mono&amp;quot;, &amp;quot;Segoe UI Mono&amp;quot;, &amp;quot;Roboto Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, Menlo, Consolas, Courier, monospace&quot; style=&quot;background-color: #f4f5f7; color: #172b4d; font-size: 14px; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot; face=&quot;SFMono-Medium, &amp;quot;SF Mono&amp;quot;, &amp;quot;Segoe UI Mono&amp;quot;, &amp;quot;Roboto Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, Menlo, Consolas, Courier, monospace&quot; style=&quot;background-color: #f4f5f7; color: #172b4d; font-size: 14px; white-space: pre;&quot;&gt;--&lt;/span&gt;&lt;span face=&quot;SFMono-Medium, &amp;quot;SF Mono&amp;quot;, &amp;quot;Segoe UI Mono&amp;quot;, &amp;quot;Roboto Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, Menlo, Consolas, Courier, monospace&quot; style=&quot;background-color: #f4f5f7; color: #172b4d; font-size: 14px; white-space: pre;&quot;&gt;subscription &lt;/span&gt;&lt;span class=&quot;token&quot; face=&quot;SFMono-Medium, &amp;quot;SF Mono&amp;quot;, &amp;quot;Segoe UI Mono&amp;quot;, &amp;quot;Roboto Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, Menlo, Consolas, Courier, monospace&quot; style=&quot;background-color: #f4f5f7; color: #36b37e; font-size: 14px; white-space: pre;&quot;&gt;&quot;Enter Subscription ID&quot;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;After that you need to run the below command&amp;nbsp;&lt;/p&gt;&lt;p&gt;az sql midb restore -g Source_Resource_group --mi Source_instance_name&amp;nbsp;&lt;/p&gt;&lt;p&gt;-n Source_database_name&amp;nbsp; &amp;nbsp;--dest-name Destination_database_name&lt;/p&gt;&lt;p&gt;&amp;nbsp;--time &quot;2021-01-29T11:30:00&quot; --dest-mi Dest_instance_name&amp;nbsp;&lt;/p&gt;&lt;p&gt;--dest-resource-group dest_resource_group&lt;/p&gt;&lt;p data-renderer-start-pos=&quot;1810&quot; style=&quot;background-color: white; line-height: 1.714; margin: 0.75rem 0px 0px; padding: 0px;&quot;&gt;Just to keep in Mind that Managed instance is making use of UTC time kindly adjust to your needs.&lt;/p&gt;&lt;p data-renderer-start-pos=&quot;1905&quot; style=&quot;background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; letter-spacing: -0.005em; line-height: 1.714; margin: 0.75rem 0px 0px; padding: 0px; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;code&quot; data-renderer-mark=&quot;true&quot; face=&quot;SFMono-Medium, &amp;quot;SF Mono&amp;quot;, &amp;quot;Segoe UI Mono&amp;quot;, &amp;quot;Roboto Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, Menlo, Consolas, Courier, monospace&quot; style=&quot;-webkit-box-decoration-break: clone; background-color: rgba(9, 30, 66, 0.08); border-radius: 3px; border-style: none; box-shadow: rgba(9, 30, 66, 0.08) -4px 0px 0px 0px, rgba(9, 30, 66, 0.08) 4px 0px 0px 0px; font-size: 13.712px; margin: 0px 4px; overflow: auto; padding: 2px 0px;&quot;&gt;&quot;TIME&quot;&lt;/span&gt; - managed instance is UTC time &lt;/p&gt;&lt;p data-renderer-start-pos=&quot;1945&quot; style=&quot;background-color: white; line-height: 1.714; margin: 0.75rem 0px 0px; padding: 0px;&quot;&gt;This way we can restore the database faster .&amp;nbsp;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/5521060398431085488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/5521060398431085488?isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5521060398431085488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5521060398431085488'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2021/01/how-to-restore-database-from-one.html' title='How to restore Database from one Managed instance to other'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg25VmUcqlBewJVEGoUB3fHtnk1I-cSjMCC1VI4jgpoJXuv240f9xqc4Ez2ymP2lbUNWV52M_aA-ocrKGAmqB7q_Aux1_fAZgJZDGSfRRulElTaJB1C4XVjFCO2OM1__VojJJz6zyHlqTA/s72-w640-h494-c/azureMI_cred.PNG" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-5659310358766418482</id><published>2021-01-11T02:46:00.001+05:30</published><updated>2021-01-11T02:46:08.379+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Azure"/><title type='text'>Alerting for Deadlocks in  SQL Azure and Monitoring using Azure SQL Analytics</title><content type='html'>&lt;p&gt;Hi Mates,&lt;/p&gt;&lt;p&gt;I always remember my childhood where my parents used to tell me it is only up to 17 years we need to study and thereafter we can enjoy. However after stepping into the IT industry I realized this is not true at all .&lt;/p&gt;&lt;p&gt;After the cloud expanded her wings at a rapid pace we just can&#39;t refrain ourselves.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Coming back to the topic although this is not too technical I just want to share how we can generate alerts for common scenarios like Deadlocks for Azure SQL Database.&lt;/p&gt;&lt;p&gt;I don&#39;t have a subscription to carry out testing even though I am very eager; however we can do a few things with a free subscription.&lt;/p&gt;&lt;p&gt;We just need to select alerts section under Azure database&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLY85cXxJmgdz41lWJlvt7u8RFxCtjkzRxsSPM59diuCKulwCEy2o8_H6CgWdacXfvYh5aKywJw6AXZTkg135WrrFckHyJfBL278dCGS93h4VQBNlLmYrNJ0dnrPidncV7-RLunla-ohs/s861/alerts_azure.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;861&quot; data-original-width=&quot;297&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLY85cXxJmgdz41lWJlvt7u8RFxCtjkzRxsSPM59diuCKulwCEy2o8_H6CgWdacXfvYh5aKywJw6AXZTkg135WrrFckHyJfBL278dCGS93h4VQBNlLmYrNJ0dnrPidncV7-RLunla-ohs/w220-h640/alerts_azure.PNG&quot; width=&quot;220&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Click on Alerts and select new alert&amp;nbsp; we nearly have 33 signals and out of which I selected Deadlocks as shown below.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN0TvNQiS1LkqASTDS7kDdp51W1pZnuDo4If8b12UKFvaC2wzAqSlgdr7qGrCJTWkJeY8AtEcCO-lWvWO9kDoYZMWkVCeepd0ofdYZ4w2xdq2t8i7rAnqkBZjX3w6EQEoQZgIihcWnSjw/s992/Deadlocks.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;779&quot; data-original-width=&quot;992&quot; height=&quot;502&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN0TvNQiS1LkqASTDS7kDdp51W1pZnuDo4If8b12UKFvaC2wzAqSlgdr7qGrCJTWkJeY8AtEcCO-lWvWO9kDoYZMWkVCeepd0ofdYZ4w2xdq2t8i7rAnqkBZjX3w6EQEoQZgIihcWnSjw/w640-h502/Deadlocks.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;upon selecting we need to specify the condition just like performance counter alert in perfmon. We do have static and Dynamic alerting mechanism.&amp;nbsp;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJlwDuYSoragFweuwZ_atXReQIvhSGtDLChwzKlhn_KAas82-fJ7Cq2jvBGyshMKNMEla_2eYq2ZayoKv-Fb0tqpM9qNPLJ79wzSjAy8aupMtjUjfx1hYvECCwdddnmKBrMi0T018OVsM/s974/static_azure.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;594&quot; data-original-width=&quot;974&quot; height=&quot;390&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJlwDuYSoragFweuwZ_atXReQIvhSGtDLChwzKlhn_KAas82-fJ7Cq2jvBGyshMKNMEla_2eYq2ZayoKv-Fb0tqpM9qNPLJ79wzSjAy8aupMtjUjfx1hYvECCwdddnmKBrMi0T018OVsM/w640-h390/static_azure.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;A Dynamic threshold uses advanced machine learning to automatically determine the threshold value using the metric&#39;s historical values and the sensitivity has been classified in to High, Medium and Low.&lt;/p&gt;&lt;p&gt;For a counter like Deadlocks we can go with Static and set the threshold value accordingly.&lt;/p&gt;&lt;p&gt;Post that under Action group we need to select notification type where I opted for Email and passed my Gmail details(For Testing)&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKNbnyRyHsDcVHjTVP4yr2TMfzVlMAePYPYssFCByHt4Hjr8YhTPRzkzWhUS8mFyjjZ7InaXmQfIwA9tRupmbp7lEXzH6hFhdwDOocmz8aufCAdWPDrHJAK0DUhC4OyBjDFhGXT29TSag/s1574/notification.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;199&quot; data-original-width=&quot;1574&quot; height=&quot;80&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKNbnyRyHsDcVHjTVP4yr2TMfzVlMAePYPYssFCByHt4Hjr8YhTPRzkzWhUS8mFyjjZ7InaXmQfIwA9tRupmbp7lEXzH6hFhdwDOocmz8aufCAdWPDrHJAK0DUhC4OyBjDFhGXT29TSag/w640-h80/notification.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0ROTtf4s0O2I8Y-Xq5UgcZFnXiWmt3_9tLyKl0RHemmxEQYLcplrS3suUVYmuoni5EGYk3-f6I3QvcUqM3xqK5qv5ySANUg2luWS9CstlvuV17j2LVLyqHgC7bXqLo70jirdld9QTQy8/s835/gmail_azure.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;812&quot; data-original-width=&quot;835&quot; height=&quot;622&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0ROTtf4s0O2I8Y-Xq5UgcZFnXiWmt3_9tLyKl0RHemmxEQYLcplrS3suUVYmuoni5EGYk3-f6I3QvcUqM3xqK5qv5ySANUg2luWS9CstlvuV17j2LVLyqHgC7bXqLo70jirdld9QTQy8/w640-h622/gmail_azure.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;After completing the above information finally under Alert rule details select the severity based on your requirement. This is how it looks finally&lt;div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXeQFQhuIdCjtTi2jnRhXwWUuMt7nKt311wfuQOagymjMzCi3HhMBBey3_hWwU_sB_lXlJ8NrYJ48q6n6zCJhK9uqIIuUFHphS4tIR8cov2gVRKwYXh0juGAszeURsJX-V9mYtk4Ge8PA/s810/fullpicture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;810&quot; data-original-width=&quot;631&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXeQFQhuIdCjtTi2jnRhXwWUuMt7nKt311wfuQOagymjMzCi3HhMBBey3_hWwU_sB_lXlJ8NrYJ48q6n6zCJhK9uqIIuUFHphS4tIR8cov2gVRKwYXh0juGAszeURsJX-V9mYtk4Ge8PA/w498-h640/fullpicture.PNG&quot; width=&quot;498&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now we can generate a deadlock scenario and can verify if we are getting Alerts.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi58Jkrn8BuBYH4RlcnkuSrhnnubnkFElLm_OYXM6AExriYX-TOPb-CEuz5pQhneCaSbGLRuYUzy8B4jflfJVwziLqC-t3eOkXWTZUaISCBY8DSw1IYkcMFXiE5YS75txahbbj9PiOqYYs/s1002/Azure_gmail.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;644&quot; data-original-width=&quot;1002&quot; height=&quot;412&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi58Jkrn8BuBYH4RlcnkuSrhnnubnkFElLm_OYXM6AExriYX-TOPb-CEuz5pQhneCaSbGLRuYUzy8B4jflfJVwziLqC-t3eOkXWTZUaISCBY8DSw1IYkcMFXiE5YS75txahbbj9PiOqYYs/w640-h412/Azure_gmail.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In my previous Article I explained how can we achieve Monitoring using Free tools.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.chiranjeevivamsydba.com/2021/01/make-use-of-free-monitoring-tools-for.html&quot; target=&quot;_blank&quot;&gt;https://www.chiranjeevivamsydba.com/2021/01/make-use-of-free-monitoring-tools-for.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This time I wanted to test native method of Azure SQL Analytics and it has some cool features where we just need to create&amp;nbsp;&lt;/p&gt;&lt;p&gt;1) Log Analytics workspace&lt;/p&gt;&lt;p&gt;2)Diagnostic setting&lt;/p&gt;&lt;p&gt;3) Azure SQL Analytics&lt;/p&gt;&lt;p&gt;I could have explained&amp;nbsp; this however it has already been clearly projected in the below links&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://eitanblumin.com/2020/03/17/azure-sql-analytics-monitoring/&quot; target=&quot;_blank&quot;&gt;https://eitanblumin.com/2020/03/17/azure-sql-analytics-monitoring/&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.sqlshack.com/getting-started-with-azure-sql-analytics/&quot; target=&quot;_blank&quot;&gt;https://www.sqlshack.com/getting-started-with-azure-sql-analytics/&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;For testing this time I created a Blocking scenario and this is how it looks for my workspace.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLjNUpQ1lQggn9q9Cmm3mz4Ve5Cyltv3kCZnToTSSTWKBFRQ88UwAIcAVAQwBIA0-3X4Mko-QrHXrvOhMsOd8E6sPF-NZ-m2qtkU6qpRgP6rrUG1AnlKjBY0DZ0JHldF3ctCarfHnP_JQ/s1152/Blocking.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;589&quot; data-original-width=&quot;1152&quot; height=&quot;328&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLjNUpQ1lQggn9q9Cmm3mz4Ve5Cyltv3kCZnToTSSTWKBFRQ88UwAIcAVAQwBIA0-3X4Mko-QrHXrvOhMsOd8E6sPF-NZ-m2qtkU6qpRgP6rrUG1AnlKjBY0DZ0JHldF3ctCarfHnP_JQ/w640-h328/Blocking.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I believe if we make use of Azure SQL Analytics and Free monitoring tools together then we can have everything in place.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/5659310358766418482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/5659310358766418482?isPopup=true' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5659310358766418482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5659310358766418482'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2021/01/alerting-for-deadlocks-in-sql-azure-and.html' title='Alerting for Deadlocks in  SQL Azure and Monitoring using Azure SQL Analytics'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLY85cXxJmgdz41lWJlvt7u8RFxCtjkzRxsSPM59diuCKulwCEy2o8_H6CgWdacXfvYh5aKywJw6AXZTkg135WrrFckHyJfBL278dCGS93h4VQBNlLmYrNJ0dnrPidncV7-RLunla-ohs/s72-w220-h640-c/alerts_azure.PNG" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-5740797747312005841</id><published>2021-01-01T21:47:00.003+05:30</published><updated>2021-01-01T21:49:13.646+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure Managed Instance"/><title type='text'>Make use of Free Monitoring Tools for SQL Server on-premises and Azure Managed Instance</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Hi Friends,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;I wish you a very warm New Year. As we know perhaps if there is any year
that we would have waited eagerly it will be 2021 for sure. Personally, for me it
is a mixed year however my blog last year had 40K views which for me is a huge
achievement.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;I would like to thank all of you for going through my posts and posting
your valuable comments.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Coming back to our discussion being a DBA the most important thing is to
have Monitoring in Place so that we can go back to History and see what drove
us to failure.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;If you are working in bigger firms obviously there will be Monitoring
tools in place. However, how about companies that cannot afford money.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;These days with the growing technology we need to keep ourselves updated
on a regular Basis. Today I am going to discuss 3 free tools which will be very
handy if you can make use of them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;a href=&quot;https://www.influxdata.com/&quot;&gt;&lt;span style=&quot;color: #336dc2;&quot;&gt;InfluxDB&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;is
an open-source time series database, developed in Go by InfluxData. InfluxDB is
optimized for fast, high-availability storage and retrieval of time series data
for metrics analysis. This can be installed on a single server or as a
clustered instance (Enterprise edition only).&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;a href=&quot;https://www.influxdata.com/time-series-platform/telegraf/&quot;&gt;&lt;span style=&quot;color: #336dc2;&quot;&gt;Telegraf&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;is an agent, written in
Go, for collecting, processing, aggregating, and writing metrics.&amp;nbsp;It must
be installed on all devices that need to be monitored, and all metrics
collected by Telegraf are pushed and stored in InfluxDB.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;a href=&quot;https://grafana.com/&quot;&gt;&lt;span style=&quot;color: #336dc2;&quot;&gt;Grafana&amp;nbsp;&lt;/span&gt;&lt;/a&gt;is
an open source, feature rich metrics dashboard and graph editor for Graphite,
Elasticsearch, OpenTSDB, Prometheus, and InfluxDB. Data stored on InfluxDB will
be visualized using Grafana.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Before explaining them, I would really like to thank&amp;nbsp;&lt;a href=&quot;https://tracyboggiano.com/archive/2018/02/setup-of-telegraf/&quot; target=&quot;_blank&quot;&gt;Tracyboggiano&lt;/a&gt;&amp;nbsp;She completely explained how to make use of
them. But in my blog, I will explain how to make use of them by installing
those tools in Windows Environment and even for Azure Managed instance.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;



















&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;I would like to proceed with installation of Grafana first and then I will just show case an example.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: #373737; font-family: arial;&quot;&gt;you can make use of the below link and just look into the instructions&amp;nbsp;of Grafana. you can ignore the rest&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: #373737; font-family: arial;&quot;&gt;&lt;a href=&quot;http://sqltouch.blogspot.com/2017/03/using-perfcollector-with-influxdb-and.html&quot; target=&quot;_blank&quot;&gt;http://sqltouch.blogspot.com/2017/03/using-perfcollector-with-influxdb-and.html&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: #373737; font-family: arial;&quot;&gt;In the above blog the author made use of perf collector which I am not making use of.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: #373737; font-family: arial;&quot;&gt;Once you are finished with the installation you can open the link&amp;nbsp;&lt;a href=&quot;http://localhost:3000&quot; target=&quot;_blank&quot;&gt;http://localhost:3000&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: #373737; font-family: arial;&quot;&gt;By default, Grafana listens on port 3000 so ensure that port is being opened on the firewall.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: #373737; font-family: arial;&quot;&gt;Coming back as said I will just share an example on how to make use of only Grafana. Many of you might already aware of Ring Buffers in SQL server. Using that we can capture 4 hours CPU history. Imagine you want a pictorial representation of the usage on all your servers then you can make use of Grafana.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUS5OR9BA9YuhEvWQBHVgpadp-YTIITHmuRV0XiBqMkuElYftgLDOBRW8w_ADw3LrgppMBmOxs_te-cRSm5tQk8tAFKWsgBiy0TdJzJiYYcUg7KX2EjM8drxfRT9HU4BAg8SK6sDO4Pfo/s900/grafana_cpu.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;455&quot; data-original-width=&quot;900&quot; height=&quot;325&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUS5OR9BA9YuhEvWQBHVgpadp-YTIITHmuRV0XiBqMkuElYftgLDOBRW8w_ADw3LrgppMBmOxs_te-cRSm5tQk8tAFKWsgBiy0TdJzJiYYcUg7KX2EjM8drxfRT9HU4BAg8SK6sDO4Pfo/w640-h325/grafana_cpu.PNG&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;H&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; How can we do this you can make use of the below links to understand how it works for sample Data.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-align: left; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;a href=&quot;https://www.sqlshack.com/overview-of-the-grafana-dashboard-with-sql/&quot; target=&quot;_blank&quot;&gt;https://www.sqlshack.com/overview-of-the-grafana-dashboard-with-sql/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;a href=&quot;https://www.mssqltips.com/sqlservertip/6008/sql-server-time-series-data-visualization-with-grafana/&quot; target=&quot;_blank&quot;&gt;https://www.mssqltips.com/sqlservertip/6008/sql-server-time-series-data-visualization-with-grafana/&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;For Visualizing CPU History against all your servers you can make use of the below query as an example&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;SELECT&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; $__timeEpoch([Event Time]​​ ),&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; [server Name] as &quot;metric&quot;,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; [SQL Server Process CPU Utilization] as SQL_UT,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; [Other Process CPU Utilization] as other_UT&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;FROM&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; [CPU_History]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;WHERE&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; $__timeFilter([Event Time])&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;ORDER BY&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; [Event Time] ASC&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;If you have data already being collected and it is time series based and you need graphical representation then there is no better than Grafana.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Coming back to other tools (Influx and Telegraf) you can make use of the above links for the installation.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;you need to install telegraf on any one of your test servers and in the configuration file to collect the data you just need to make the below changes in the output plugins and input plugins&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;urls = [&quot;http://XXX.XX.XXX.XXX:8086&quot;]# required&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; ## The target database for metrics (telegraf will create it if not exists).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;database = &quot;telegraf&quot; # required&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;On-premises&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;[[inputs.sqlserver]]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; servers = [&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; &amp;nbsp; &quot;Server=localhost;Port=1433;User Id=telegraf;Password=XXXXX;app name=telegraf;log=1;&quot;,&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Azure MI&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;[[inputs.sqlserver]]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; servers = [&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&quot;Server=XXXXXXX.database.windows.net;Port=1433;User Id=telegraf;Password=XXXXX$;app name=telegraf;log=1;&quot;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; ]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;once you are done below are some of the reports what you can see&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjC7yP1sycQiL36pZkE6tPfTBvWqdbAGyRo42vRl4Q4MGZSEyjz41L1szADJhVWZplmhxkddnPmwnNg-Np0qlAjQ1ryRgPqNBjc_Z_hX0zjvHE4PI66vTiYIOq-zQaFjCx6dS965xARQew/s1585/grafana_MI_1.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;294&quot; data-original-width=&quot;1585&quot; height=&quot;118&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjC7yP1sycQiL36pZkE6tPfTBvWqdbAGyRo42vRl4Q4MGZSEyjz41L1szADJhVWZplmhxkddnPmwnNg-Np0qlAjQ1ryRgPqNBjc_Z_hX0zjvHE4PI66vTiYIOq-zQaFjCx6dS965xARQew/w640-h118/grafana_MI_1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1NB82SqYvcncLzuFbnb3auNQaObZPs8IAPWRwoE-J8hd7TKqjSrEl5kQ7UQB6f7VwsAO05dC4Y3dBjmC6CdecQnE92gbvnWR-MM025Dz3BzXAFoZR_n8lnBm-6Gd8yXQ5Ex82G1ymDbE/s1578/grafana_onprem.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;247&quot; data-original-width=&quot;1578&quot; height=&quot;100&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1NB82SqYvcncLzuFbnb3auNQaObZPs8IAPWRwoE-J8hd7TKqjSrEl5kQ7UQB6f7VwsAO05dC4Y3dBjmC6CdecQnE92gbvnWR-MM025Dz3BzXAFoZR_n8lnBm-6Gd8yXQ5Ex82G1ymDbE/w640-h100/grafana_onprem.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAwhDQ91Q91AiUb4ceN_kOU9Rsug2ii2TANdn2C6e6zwWngUvbpd8Tr-eFuRxLNbxcf5XIhj8pCAzpZuiK63q9kEhDKpX3slP6BQzmDdeOsCvGv93_OcRoE-mAyurCk13zmqMy4cNbP34/s1746/grafana_comp.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;848&quot; data-original-width=&quot;1746&quot; height=&quot;310&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAwhDQ91Q91AiUb4ceN_kOU9Rsug2ii2TANdn2C6e6zwWngUvbpd8Tr-eFuRxLNbxcf5XIhj8pCAzpZuiK63q9kEhDKpX3slP6BQzmDdeOsCvGv93_OcRoE-mAyurCk13zmqMy4cNbP34/w640-h310/grafana_comp.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;H&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc5KfSHs43VtTaYVaU1EAXg-upEFwicCmBCHXBdNMPIfMKtHBAEBxh9CfDzTw3ePTBP69brQfnKsINmJzG6UiFFGuS4ed3aQ5U_sMClk8JC_FRjeBXxef_OwFzEzm_xXu_GEJfj4X22zs/s1774/grafana_comp1.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;413&quot; data-original-width=&quot;1774&quot; height=&quot;148&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc5KfSHs43VtTaYVaU1EAXg-upEFwicCmBCHXBdNMPIfMKtHBAEBxh9CfDzTw3ePTBP69brQfnKsINmJzG6UiFFGuS4ed3aQ5U_sMClk8JC_FRjeBXxef_OwFzEzm_xXu_GEJfj4X22zs/w640-h148/grafana_comp1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0cm; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #373737;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #373737; font-family: arial;&quot;&gt;&amp;nbsp;&amp;nbsp;As you can see you really get the feel of the Monitoring tool also if you are running on SQL Server 2016 you can make use of the Query store to work from a query standpoint as well. This is just my idea and you can go through my views and implement them as per your needs.&lt;/span&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span face=&quot;Arial, sans-serif&quot; style=&quot;color: #373737;&quot;&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/5740797747312005841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/5740797747312005841?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5740797747312005841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5740797747312005841'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2021/01/make-use-of-free-monitoring-tools-for.html' title='Make use of Free Monitoring Tools for SQL Server on-premises and Azure Managed Instance'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUS5OR9BA9YuhEvWQBHVgpadp-YTIITHmuRV0XiBqMkuElYftgLDOBRW8w_ADw3LrgppMBmOxs_te-cRSm5tQk8tAFKWsgBiy0TdJzJiYYcUg7KX2EjM8drxfRT9HU4BAg8SK6sDO4Pfo/s72-w640-h325-c/grafana_cpu.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-4418001187249987499</id><published>2020-12-23T02:33:00.002+05:30</published><updated>2020-12-23T02:33:25.239+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Azure"/><title type='text'>Change of TDE from Service Managed Key to Customer Managed Key in Azure Managed Instance</title><content type='html'>&lt;p&gt;Hi Friends,&lt;/p&gt;&lt;p&gt;This post is just to share my Experience and findings with respect to TDE in Azure.&amp;nbsp;&lt;/p&gt;&lt;p&gt;In our Environment we just have Azure Managed instance and I am still awaiting for my chance to work on Azure Virtual machines ,Azure SQL and Of course AWS.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Okay coming back to topic in Azure MI we have 2 options related to Transparent Data Encryption&lt;/p&gt;&lt;p&gt;1) Service Managed Key&lt;/p&gt;&lt;p&gt;2) Customer Managed Key&lt;/p&gt;&lt;p&gt;I don&#39;t have full permissions on Azure portal to carry out the testing on this however below links help you to understand on those.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.mssqltips.com/sqlservertip/6641/azure-sql-database-tde-customer-managed-keys/&quot; target=&quot;_blank&quot;&gt;https://www.mssqltips.com/sqlservertip/6641/azure-sql-database-tde-customer-managed-keys/&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;once your MI gets created by default TDE will operate in SMK Model.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRTUu0QyimrGoJZRNDRC8UPA_VWai73T2McxEw4q6mPz71J0ahcvmCno7MrxISIhD6dlS5IoHCQp5R56FOjfZIziaFHdVo4jHzrtrvgdwpxLeoWmjF93fdfeX6gdxElW-iCqzF6gRySI8/s372/TDE_SMK.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;135&quot; data-original-width=&quot;372&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRTUu0QyimrGoJZRNDRC8UPA_VWai73T2McxEw4q6mPz71J0ahcvmCno7MrxISIhD6dlS5IoHCQp5R56FOjfZIziaFHdVo4jHzrtrvgdwpxLeoWmjF93fdfeX6gdxElW-iCqzF6gRySI8/w640-h232/TDE_SMK.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I created a database by name TEST and it is encrypted by SMK however we have our own requirements and later Windows Team changed that to Customer Managed Key.&lt;/p&gt;&lt;p&gt;If you worked on MI by this time you know that we can initiate only copy-only full backups.&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Msg 41904, Level 16, State 2, Line 3&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;BACKUP DATABASE failed. SQL Database Managed Instance supports only COPY_ONLY full database backups which are initiated by user.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Msg 3013, Level 16, State 1, Line 3&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;BACKUP LOG is terminating abnormally.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;If you try to perform any other backups you will get the above message.&amp;nbsp; As said above TEST database got encrypted by SMK initially and later it got changed to Custom Managed key.&lt;/p&gt;&lt;p&gt;In the meanwhile I created Storage account to carry out the manual backups.&amp;nbsp;&lt;/p&gt;&lt;p&gt;When I started taking the backup I got the below error&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;Msg 41937, Level 16, State 1, Line 1&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;BACKUP WITH COPY_ONLY cannot be performed until after the next automatic BACKUP LOG operation&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;Msg 3013, Level 16, State 1, Line 1&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;BACKUP DATABASE is terminating abnormally.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Later I created one more database by name Ireland and triggered the copy only backups and no issues were identified with that. In Azure MI we have automated backups in place and for every 5 minutes we do have log backups but despite of waiting for 30 minutes the error still persisted.&lt;/p&gt;&lt;p&gt;I Later realized it could be because of encryption so I turned off the encryption using the below command&lt;/p&gt;&lt;p&gt;alter database TEST set encryption off&lt;/p&gt;&lt;p&gt;But when cross checked the state of the database it lasted in the below stage &quot;protection change in progress&quot;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRAa87HJCkB6mOH6tFv2MoY_Mo4Cijo30GMYEM549on6CdoiiHM4eMyHgPQ9tWq3vlc536ul12avFLmeyQV58LxQJVtuXofnanGCMkFOzxNOtPoF5xEaY-YZZVGePD99ARoZZSC9sWFpM/s554/Encryption_state.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;81&quot; data-original-width=&quot;554&quot; height=&quot;94&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRAa87HJCkB6mOH6tFv2MoY_Mo4Cijo30GMYEM549on6CdoiiHM4eMyHgPQ9tWq3vlc536ul12avFLmeyQV58LxQJVtuXofnanGCMkFOzxNOtPoF5xEaY-YZZVGePD99ARoZZSC9sWFpM/w640-h94/Encryption_state.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Because of the above reason I could see the below messages being recorded inside the Error logs.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;2020-12-16 16:32:57.950 Backup&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BACKUP failed to complete the command BACKUP DATABASE TEST. Check the backup application log for detailed messages.&lt;/p&gt;&lt;p&gt;2020-12-20 11:19:45.950 Backup&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BACKUP failed to complete the command BACKUP DATABASE TEST. Check the backup application log for detailed messages.&lt;/p&gt;&lt;p&gt;2020-12-20 14:17:25.880 Backup&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BACKUP failed to complete the command BACKUP DATABASE TEST. Check the backup application log for detailed messages.&lt;/p&gt;&lt;p&gt;How to overcome this? I really don&#39;t know the answer for this and I tried the below commands&amp;nbsp;&lt;/p&gt;&lt;p&gt;alter database test set encryption resume&lt;/p&gt;&lt;p&gt;alter database test set encryption suspend&lt;/p&gt;&lt;p&gt;Later I ran the backup but still the error persisted and finally I ran Checkdb for that database thinking by any chance if there were any errors but no errors were reported and to my surprise the backup worked.&lt;/p&gt;&lt;p&gt;2020-12-20 14:12:50.360 spid84&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DBCC CHECKDB for database id 5 found 0 errors and repaired 0 errors.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Even now I am not clear&amp;nbsp; the reason behind&amp;nbsp;this. However if you carefully observe the messages I ran checkdb at 14:12 and the last backup failure message was on 14:17 so I guess there is some co-relation.&lt;/p&gt;&lt;p&gt;I would like to add few more points of what I observed&lt;/p&gt;&lt;p&gt;1) we can&#39;t track the history of the automated backups using Msdb backupset&lt;/p&gt;&lt;p&gt;2) By Default compression is not enabled for Managed instance however if you turn on it will helps only for Manual copy only backups . Again I am not sure if Automated backups will have them in place.&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/4418001187249987499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/4418001187249987499?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/4418001187249987499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/4418001187249987499'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/12/change-of-tde-from-service-managed-key.html' title='Change of TDE from Service Managed Key to Customer Managed Key in Azure Managed Instance'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRTUu0QyimrGoJZRNDRC8UPA_VWai73T2McxEw4q6mPz71J0ahcvmCno7MrxISIhD6dlS5IoHCQp5R56FOjfZIziaFHdVo4jHzrtrvgdwpxLeoWmjF93fdfeX6gdxElW-iCqzF6gRySI8/s72-w640-h232-c/TDE_SMK.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-1504687911008324490</id><published>2020-12-15T23:26:00.005+05:30</published><updated>2020-12-15T23:26:53.738+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALWAYS ON"/><title type='text'>Automatic seeding of availability database  in availability group failed with a transient error. The operation will be retried.</title><content type='html'>&lt;p&gt;Hi Mates,&lt;/p&gt;&lt;p&gt;This post helps you to solve the Error message that has been mentioned in the Title of the post.&amp;nbsp;&lt;/p&gt;&lt;p&gt;We have 3 servers in One Data Center and other 3 in Second Data center. Most of the servers which are running on 2012/2014 are in Multi Subnet. However from SQL 2016 we started making use of Distributed Availability Groups.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Coming back to the issue my colleague told me that few of the Databases were not appearing in Forwarded Server (means primary replica of secondary Availability Group). When I checked the Error logs on the primary Replica I could find the below message&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Automatic seeding of availability database &#39;TDEtesting&#39; in availability group &#39;TEST_DAG&#39; failed with a transient error. The operation will be retried.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;My initial impression was there might be something wrong related to Seeding settings but in both of the Availability Groups they are in Automatic mode. To my surprise the database is synchronized state in secondary replica on the primary Availability Group.&amp;nbsp;&lt;/p&gt;&lt;p&gt;what went wrong on primary(Forwarder) and secondary replicas of Secondary Availability Groups?&lt;/p&gt;&lt;p&gt;This time I checked the logs on the Forwarder server and below are the messages&lt;/p&gt;&lt;p&gt;2020-12-15 14:27:04.830 spid52s&amp;nbsp; &amp;nbsp; &amp;nbsp; Error: 911, Severity: 16, State: 1.&lt;/p&gt;&lt;p&gt;2020-12-15 14:27:04.830 spid52s&amp;nbsp; &amp;nbsp; &amp;nbsp; Database &#39;TDEtesting&#39; does not exist. Make sure that the name is entered correctly.&lt;/p&gt;&lt;p&gt;2020-12-15 14:27:05.090 spid52s&amp;nbsp; &amp;nbsp; &amp;nbsp; Error: 33111, Severity: 16, State: 3.&lt;/p&gt;&lt;p&gt;2020-12-15 14:27:05.090 spid52s&amp;nbsp; &amp;nbsp; &amp;nbsp; Cannot find server certificate with thumbprint &#39;0x3428858AF24F0D37387E7F5613AC5069E319D1F1&#39;.&lt;/p&gt;&lt;p&gt;2020-12-15 14:27:05.090 spid52s&amp;nbsp; &amp;nbsp; &amp;nbsp; Error: 3013, Severity: 16, State: 1.&lt;/p&gt;&lt;p&gt;2020-12-15 14:27:05.090 spid52s&amp;nbsp; &amp;nbsp; &amp;nbsp; RESTORE DATABASE is terminating abnormally.&lt;/p&gt;&lt;p&gt;2020-12-15 14:27:05.090 spid52s&amp;nbsp; &amp;nbsp; &amp;nbsp; Automatic seeding of availability database &#39;TDEtesting&#39; in availability group &#39;TEST_DAG&#39; failed with a transient error. The operation will be retried.&lt;/p&gt;&lt;p&gt;By looking at the logs I clearly understood the issue. The reason is that the problematic databases were part of Transparent Data Encryption.&lt;/p&gt;&lt;p&gt;My colleague added the database only on to Secondary replicas of the primary availability group by copying the certificate and private keys. By the way we can&#39;t add a database that is part of TDE through GUI. It has to be done manually using join option.&lt;/p&gt;&lt;p&gt;Also keep in mind at the time of creating the Distributed Availability Groups we need to ensure that there are no user databases in the availability group on the forwarded server.&lt;/p&gt;&lt;p&gt;One more Tip till today I was under impression that we can enable TDE on a database only by using server certificate but we can do this using asymmetric key too.&lt;/p&gt;&lt;p&gt;I tried doing this but this requires EKM and it has been very well described in the below link&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Msg 33120, Level 16, State 1, Line 5&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;In order to encrypt the database encryption key with an asymmetric key, please use an asymmetric key that resides on an extensible key management provider.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;a href=&quot;https://www.sqlshack.com/configure-tde-database-alwayson-using-azure-key-vault-sql-server-2016/&quot; target=&quot;_blank&quot;&gt;https://www.sqlshack.com/configure-tde-database-alwayson-using-azure-key-vault-sql-server-2016/&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/1504687911008324490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/1504687911008324490?isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/1504687911008324490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/1504687911008324490'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/12/automatic-seeding-of-availability.html' title='Automatic seeding of availability database  in availability group failed with a transient error. The operation will be retried.'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-5381744388115081990</id><published>2020-12-02T17:24:00.003+05:30</published><updated>2020-12-02T17:24:26.192+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Performance"/><title type='text'>Query Timeouts from Website</title><content type='html'>&lt;p&gt;&amp;nbsp;Hi Friends,&lt;/p&gt;&lt;p&gt;In this post I would like to share my experience with respect to time out Error from a website with SQL Server Database as Backend.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFTL-KduxkMA1H7oDIev1eXUPEQW0TgV6U-zcTwVp5Meob8VG6WWU5UiN9uopG_BNUQw36jtwrmXWIhvbkBCNqib1xx5ukUcrNurJWbEQFjeqJXLzhq8NyLIIxdQfTdmcuEyTDBHFTMPo/s1737/timeoutweb.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;439&quot; data-original-width=&quot;1737&quot; height=&quot;162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFTL-KduxkMA1H7oDIev1eXUPEQW0TgV6U-zcTwVp5Meob8VG6WWU5UiN9uopG_BNUQw36jtwrmXWIhvbkBCNqib1xx5ukUcrNurJWbEQFjeqJXLzhq8NyLIIxdQfTdmcuEyTDBHFTMPo/w640-h162/timeoutweb.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As you can see from the above picture the website is not able to come up with results and it popped up with Message Query timeout.&lt;/p&gt;&lt;p&gt;From the Message it is very clear that ExecuteReader(.NET method) is not able to fetch the results within the default connection timeout.&amp;nbsp;&lt;/p&gt;&lt;p&gt;In general for any .NET Application the default time out is 30 seconds however in my case it has been setup with 15 seconds.&lt;/p&gt;&lt;p&gt;When I asked the developer he said they have 5 webpages related to Logging (Audit, Error, Trace, Event&amp;nbsp; and Episode). They were able to obtain the results for all the web pages with in 2 seconds however for Trace log it took 17 seconds for its completion. As the timeout has been set for 15 seconds the page is getting timed out.&lt;/p&gt;&lt;p&gt;As a DBA what will be our next steps?&lt;/p&gt;&lt;p&gt;I started with initial checks on the tables(statistics and Fragmentation) and they all are performing good.&lt;/p&gt;&lt;p&gt;Next I started checking the code and the indexes for the Logging tables and from index standpoint they look one at the same.&lt;/p&gt;&lt;p&gt;when verified the code I identified the problem&amp;nbsp; and it is happening because of type conversion from &lt;b&gt;DATETIME2 to varchar.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;The Datecreated column inside the table(TransactionTraceLOG) is having DATETIME2 where as in the code they are changing that to varchar(106)&lt;/p&gt;&lt;p&gt;SELECT&lt;/p&gt;&lt;p&gt;@PageCount = (COUNT([TransactionTraceLogId]) / @PageSize),&lt;/p&gt;&lt;p&gt;@PageMod = (COUNT([TransactionTraceLogId]) % @PageSize)&lt;/p&gt;&lt;p&gt;FROM [dbo].[TransactionTraceLog] WITH (NOLOCK)&lt;/p&gt;&lt;p&gt;WHERE&lt;/p&gt;&lt;p&gt;(&lt;/p&gt;&lt;p&gt;[Source] = @Source&amp;nbsp; or&lt;/p&gt;&lt;p&gt;@Source = &#39;%%&#39;&lt;/p&gt;&lt;p&gt;)&lt;/p&gt;&lt;p&gt;AND&lt;/p&gt;&lt;p&gt;(&lt;/p&gt;&lt;p&gt;@Date IS NULL OR&lt;/p&gt;&lt;p&gt;&lt;b&gt;--CONVERT(VARCHAR, @Date, 106) LIKE CONVERT(VARCHAR, [DateCreated], 106)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I told them to avoid conversion in where clause and asked them to pre-populate but the developer told me they are using multi search functionality and they have 3 parameters to search for like below.&lt;/p&gt;&lt;p&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;exec&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; [dbo]&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;.&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;[Transactions.TransactionTraceLog.RetrievePageBySource_test]&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;@Source &lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;=&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&#39;%%&#39;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;,&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; @Page &lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;=&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; 100&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background: yellow; color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;,&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background: yellow; font-family: Consolas; font-size: 9.5pt;&quot;&gt; @Date &lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background: yellow; color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;=&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background: yellow; font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background: yellow; color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&#39;11/01/2020&#39;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;WITH&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;
&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;RECOMPILE&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;When it comes to Dynamic search conditions there are so many things that we need to consider and it requires lot of efforts.&amp;nbsp;&lt;a href=&quot;http://www.sommarskog.se/dyn-search-2008.html&quot; target=&quot;_blank&quot;&gt;http://www.sommarskog.se/dyn-search-2008.html&lt;/a&gt;&amp;nbsp;this will help you to understand completely.&lt;/p&gt;&lt;p&gt;Now back to the problem as said above no issues with stats/Fragmentation/Indexes and the code definition is same for all other stored procedures.&lt;/p&gt;&lt;p&gt;I always never rule out row count of the tables when it comes to performance issues. In this case the problem lies here the table size and the row count for other&amp;nbsp; tables are too small hence the results are lightening fast however when it comes to this table the size is 60 GB and as they can&#39;t change the code I told them to purge. As expected after purging the issue got resolved.&lt;/p&gt;&lt;p&gt;As said we can change the column definition from datetime to varchar but again this is an architectural decision.&amp;nbsp;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/5381744388115081990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/5381744388115081990?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5381744388115081990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5381744388115081990'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/12/query-timeouts-from-website.html' title='Query Timeouts from Website'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFTL-KduxkMA1H7oDIev1eXUPEQW0TgV6U-zcTwVp5Meob8VG6WWU5UiN9uopG_BNUQw36jtwrmXWIhvbkBCNqib1xx5ukUcrNurJWbEQFjeqJXLzhq8NyLIIxdQfTdmcuEyTDBHFTMPo/s72-w640-h162-c/timeoutweb.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-3107168527637084981</id><published>2020-11-29T05:08:00.008+05:30</published><updated>2020-11-29T05:11:26.186+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Performance"/><title type='text'>Do we need to eliminate Sort operator all the time in execution plan?</title><content type='html'>&lt;p&gt;&amp;nbsp;Hi Friends,&lt;/p&gt;&lt;p&gt;As we know Performance is one area where the scope for learning will never end. Today I am going to share an article which emphasizes on Seek/Scan and Sort operators.&amp;nbsp; There are many blogs and my article is nothing in front of them but I am just sharing the knowledge of what I could.&lt;/p&gt;&lt;p&gt;Let me start up with the demo first. We have 2 tables one containing LogID and other some random Dates. When it comes to second table as you can see it has PK/FK relationship on the column LogID and a userid column which has only 3 users (1,2,3).&lt;/p&gt;&lt;p&gt;CREATE TABLE [dbo].[LogTable]&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; (&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; [LogID] [int] NOT NULL IDENTITY(1, 1) ,&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; [DateSent] [datetime] NULL,&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; )&lt;/p&gt;&lt;p&gt;&amp;nbsp;ON [PRIMARY]&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&amp;nbsp;ALTER TABLE [dbo].[LogTable] ADD CONSTRAINT [PK_LogTable] PRIMARY KEY CLUSTERED&amp;nbsp; ([LogID]) ON [PRIMARY]&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&amp;nbsp;CREATE NONCLUSTERED INDEX [IX_LogTable_DateSent] ON [dbo].[LogTable] ([DateSent] DESC) ON [PRIMARY]&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;CREATE TABLE [dbo].[LogTable_Cross]&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; (&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; [LogID] [int] NOT NULL ,&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; [UserID] [int] NOT NULL&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; )&lt;/p&gt;&lt;p&gt;&amp;nbsp;ON [PRIMARY]&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&amp;nbsp;ALTER TABLE [dbo].[LogTable_Cross] WITH NOCHECK ADD CONSTRAINT [FK_LogTable_Cross_LogTable] FOREIGN KEY ([LogID]) REFERENCES [dbo].[LogTable] ([LogID])&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&amp;nbsp;CREATE NONCLUSTERED INDEX [IX_LogTable_Cross_UserID_LogID]&lt;/p&gt;&lt;p&gt;&amp;nbsp;ON [dbo].[LogTable_Cross] ([UserID])&lt;/p&gt;&lt;p&gt;&amp;nbsp;INCLUDE ([LogID])&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;INSERT INTO [LogTable]&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT TOP 100000&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DATEADD(day, ( ABS(CHECKSUM(NEWID())) % 65530 ), 0)&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FROM&amp;nbsp; &amp;nbsp; sys.sysobjects&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CROSS JOIN sys.all_columns&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;INSERT INTO [LogTable_Cross] SELECT&amp;nbsp; [LogID] ,1 FROM&amp;nbsp; &amp;nbsp; [LogTable] ORDER BY NEWID()&lt;/p&gt;&lt;p&gt;&amp;nbsp;INSERT INTO [LogTable_Cross] SELECT&amp;nbsp; [LogID] ,2 FROM&amp;nbsp; &amp;nbsp; [LogTable] ORDER BY NEWID()&lt;/p&gt;&lt;p&gt;&amp;nbsp;INSERT INTO [LogTable_Cross] SELECT&amp;nbsp; [LogID] ,3 FROM&amp;nbsp; &amp;nbsp; [LogTable] ORDER BY NEWID()&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;I will show you top 5 rows (in descending order) in each of the tables&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_ZDlBt2oILc6uphNGdpl9GQ_DUMRJmHIrfqPmZ20NgJ5MC5CbPYJpeeX_IsvlaIOOV0ONUBUMiVCT7OqR5CPQUHbVzCuyVKLLBrv6uBajHVbIK46daMV5hF7aPa6ZFrDurZVAf2PBHEI/s674/performance.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;421&quot; data-original-width=&quot;674&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_ZDlBt2oILc6uphNGdpl9GQ_DUMRJmHIrfqPmZ20NgJ5MC5CbPYJpeeX_IsvlaIOOV0ONUBUMiVCT7OqR5CPQUHbVzCuyVKLLBrv6uBajHVbIK46daMV5hF7aPa6ZFrDurZVAf2PBHEI/w640-h400/performance.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As you can see from the script above we have clustered index&amp;nbsp; on logID column and non clustered index on Datesent column for the Logtable. when it comes to other table we have non clustered index on LogID with included column as userid.&lt;/p&gt;&lt;p&gt;Now I want to select all those logs (from LogTable) which has given userid (user id will be checked from cross table LogTable_Cross) with datesent desc.&lt;/p&gt;&lt;p&gt;SELECT&amp;nbsp; DI.LogID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;FROM&amp;nbsp; &amp;nbsp; LogTable DI&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INNER JOIN LogTable_Cross DP ON DP.LogID = DI.LogID&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHERE&amp;nbsp; DP.UserID = 1&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;ORDER BY DateSent DESC&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEe_X7LSdbFZlJ6DUNQZNFVs3Imp1H80Bp0zRoOexeEju0LdEfnZxRug9pv-UJMMeaVN6DvWYq7wLD2cEdiq0SGh_eTHoC-0vOiS74u1IaOfaMNVXa5_pFIhBH5yTW7F3tKTNbZBCX5CY/s1714/perf1.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;321&quot; data-original-width=&quot;1714&quot; height=&quot;120&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEe_X7LSdbFZlJ6DUNQZNFVs3Imp1H80Bp0zRoOexeEju0LdEfnZxRug9pv-UJMMeaVN6DvWYq7wLD2cEdiq0SGh_eTHoC-0vOiS74u1IaOfaMNVXa5_pFIhBH5yTW7F3tKTNbZBCX5CY/w640-h120/perf1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you see from the execution plan it went for Clustered Index Scan on LogTable and seek on LogTable_cross. It went for parallel execution plan and when it comes to Cost it is Sort operation which is consuming 45 %.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Let&#39;s execute the same query but this time with MAXDOP 1 and see if there is any change with respect to sort operation.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1Evi83BYRsQaEsD0wISV1H7QPJKumBCzdcTvoVUiMNqF8wifTy-fDXN8qjx9XYnn6jGKvQ2PKFkPooRNHWmRVVCjgglplLIKF1ZNa01U8l-kl2eYoLepNUEQpxvFJmwCoNw62ZbywQMU/s1799/perf2.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;304&quot; data-original-width=&quot;1799&quot; height=&quot;108&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1Evi83BYRsQaEsD0wISV1H7QPJKumBCzdcTvoVUiMNqF8wifTy-fDXN8qjx9XYnn6jGKvQ2PKFkPooRNHWmRVVCjgglplLIKF1ZNa01U8l-kl2eYoLepNUEQpxvFJmwCoNw62ZbywQMU/w640-h108/perf2.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Now if you see above the execution plan we do have sort operation in place. But Now why it went with Hash Join? Why not with Merge join? Because the ordered property is false for the clustered index scan operator&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWbVnADc8GPcwXq1UrjcMX-pavR9iKQJ9Vz1D3Tyq1uRORGu1ZqlvOaZrDIAXTMF9WhchF65RplSBbctylWYmqN2zVMang-P0jSYiHerOU-RhMtdRCiJpzJ1IHTl0QzPabYcVgT32bmsc/s1162/perf3.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;679&quot; data-original-width=&quot;1162&quot; height=&quot;374&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWbVnADc8GPcwXq1UrjcMX-pavR9iKQJ9Vz1D3Tyq1uRORGu1ZqlvOaZrDIAXTMF9WhchF65RplSBbctylWYmqN2zVMang-P0jSYiHerOU-RhMtdRCiJpzJ1IHTl0QzPabYcVgT32bmsc/w640-h374/perf3.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;When it comes to scans the database engine has 2 options.&amp;nbsp;&lt;/p&gt;&lt;p&gt;1)Allocation Ordered Scans&lt;/p&gt;&lt;p&gt;2)Index Order Scan&lt;/p&gt;&lt;p&gt;When the plan shows a Table Scan operator, the storage engine has only one option: to use an allocation order scan. When the plan shows an Index Scan operator (clustered or nonclustered) with the property Ordered: True, the storage engine can use only an index order scan.&lt;/p&gt;&lt;p&gt;When the plan shows an Index Scan operator with Ordered: False, the relational engine doesn’t care in what order the rows are returned. In this case, there are two options to scan the data: allocation order scan and index order scan. It is up to the storage engine to determine which to employ.&lt;/p&gt;&lt;p&gt;In the above execution plan it opted for False which means it went for allocation ordered scan. As the order is false it has to go with Hash join. If it would have been true then definitely we will have Merge join operator.&lt;/p&gt;&lt;p&gt;Okay now in both plans (parallel and Serial) it is suggesting an missing index so let&#39;s create one and see if that eliminates sort operator.&lt;/p&gt;&lt;p&gt;We have an index with userid as the leading column and the missing index is suggesting to create leading column as LogID and then userID.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;After creating the index I tried running the same query and I got the below execution plans for parallel and serial(maxdop 1)&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZU3HO-vaBh3pSBN3fxGGhrQ-35tK_0vjtbpvsiyN2Ol4xbuGfoh9ZIW4PL3-7IokWVKkX-N6uB87VcjU-zkoErSk3hTbqsm6vxg2ShWa6FJMk5ySP2x9dIFndws__da7yQNcWzA4F-5E/s1811/perf4.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;594&quot; data-original-width=&quot;1811&quot; height=&quot;210&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZU3HO-vaBh3pSBN3fxGGhrQ-35tK_0vjtbpvsiyN2Ol4xbuGfoh9ZIW4PL3-7IokWVKkX-N6uB87VcjU-zkoErSk3hTbqsm6vxg2ShWa6FJMk5ySP2x9dIFndws__da7yQNcWzA4F-5E/w640-h210/perf4.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So the top execution plan is for serial execution and the bottom for parallel. If you notice there is no change in the plan when it comes to parallel execution and for serial as explained above this time we got Merge join operator instead of Hash as now ordered property is true. Also it made use of the index what missing index has requested and it went with Index scan instead of seek.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEvCSaPanerRI4cM18Kx9hYP6X-WhrUEiHFCo8OEo5HhEjXoelMvoGYZmrHugvJqF3mCVfiemotVn4DCryNRdKntpp3zbvgZgikAUWzXRSgSxD7Iy2itSgP0ecO3LvgBJriw-WqL6YTXA/s1297/perf5.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;772&quot; data-original-width=&quot;1297&quot; height=&quot;380&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEvCSaPanerRI4cM18Kx9hYP6X-WhrUEiHFCo8OEo5HhEjXoelMvoGYZmrHugvJqF3mCVfiemotVn4DCryNRdKntpp3zbvgZgikAUWzXRSgSxD7Iy2itSgP0ecO3LvgBJriw-WqL6YTXA/w640-h380/perf5.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Okay if you compare the costs the one with parallel outcomes the serial as it is just 19%.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now back to my question the sort operator is there even now and it is the one which is contributing to the cost so how to get rid of this?&lt;/p&gt;&lt;p&gt;Well when I forced the optimizer to make use of nested joins then the sort operator got disappeared.&lt;/p&gt;&lt;p&gt;SELECT&amp;nbsp; DI.LogID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;FROM LogTable DI&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INNER JOIN LogTable_Cross DP ON DP.LogID = DI.LogID&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHERE&amp;nbsp; DP.UserID = 1&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;ORDER BY DateSent DESC&lt;/p&gt;&lt;p&gt;OPTION (MAXDOP 1, LOOP JOIN);&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8pOhNKQF_2dm9muEPj_ObdKXCMdLhSMrVAHVwIFuyr9VSnTsee8R-pBPklCLUyZKQlGAZwXlLLzUY_hhvt9W4eAnXluDWraMIy2GeBbhJV0IwBikzyGJxXHdN1czKFQdaBUroEoN-h7U/s899/perf6.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;577&quot; data-original-width=&quot;899&quot; height=&quot;410&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8pOhNKQF_2dm9muEPj_ObdKXCMdLhSMrVAHVwIFuyr9VSnTsee8R-pBPklCLUyZKQlGAZwXlLLzUY_hhvt9W4eAnXluDWraMIy2GeBbhJV0IwBikzyGJxXHdN1czKFQdaBUroEoN-h7U/w640-h410/perf6.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As you can see the parallel and the select both have no sort operators. Wow finally great to see the execution plan with out sort operator but wait let us compare the cost with the ones where we forced Nested loop join to the default one&#39;s of what Engine thinks as better plan.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigLWFQNm4j37tubwH4YVxOe-kB0pUHsfZ0Y37h5mgGNs7UY-u8Svr4ypnAmolUM9JzQyYnWnMiGdJl9FrOG30cTYowYd12MsbiOrGcPjic9AYKeK_DIc0aOqvibDt-zX9PdmpWHmS3ZD0/s1380/perf7.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;582&quot; data-original-width=&quot;1380&quot; height=&quot;270&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigLWFQNm4j37tubwH4YVxOe-kB0pUHsfZ0Y37h5mgGNs7UY-u8Svr4ypnAmolUM9JzQyYnWnMiGdJl9FrOG30cTYowYd12MsbiOrGcPjic9AYKeK_DIc0aOqvibDt-zX9PdmpWHmS3ZD0/w640-h270/perf7.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The top execution plan is what Engine has opted and the bottom is where I forced as you can see Engine&#39;s selection outperformed mine. Let&#39;s do the same with Serial plan.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh78gUHIcfBqMFIoy-Z5XDfDKo-Sm8MYzwwm7p2yeGILdfa1dAuWSHzp5OQJvX-sKUc9PEXi-6bfTlP9Z4vzvtGjJARXWFy7kVQPuOnoQtinpjp69ql-yGM-0u4ipicLFtQGhcfi4zpHQI/s882/perf8.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;616&quot; data-original-width=&quot;882&quot; height=&quot;446&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh78gUHIcfBqMFIoy-Z5XDfDKo-Sm8MYzwwm7p2yeGILdfa1dAuWSHzp5OQJvX-sKUc9PEXi-6bfTlP9Z4vzvtGjJARXWFy7kVQPuOnoQtinpjp69ql-yGM-0u4ipicLFtQGhcfi4zpHQI/w640-h446/perf8.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Just like parallel plan even the serial plan of Engine thinks that Nested loop join is not the better plan.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now as my question points do we need to eliminate sort all the time? Well, it depends but certainly not in this case.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In fact we can eliminate sort here by creating Materialized view but I am not going to discuss this here.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I know this is bit lengthy and even few might feel it as clumsy but I am ready to help in case if you have any queries on the same.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/3107168527637084981/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/3107168527637084981?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/3107168527637084981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/3107168527637084981'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/11/do-we-need-to-eliminate-sort-operation.html' title='Do we need to eliminate Sort operator all the time in execution plan?'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_ZDlBt2oILc6uphNGdpl9GQ_DUMRJmHIrfqPmZ20NgJ5MC5CbPYJpeeX_IsvlaIOOV0ONUBUMiVCT7OqR5CPQUHbVzCuyVKLLBrv6uBajHVbIK46daMV5hF7aPa6ZFrDurZVAf2PBHEI/s72-w640-h400-c/performance.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-5969137078677486160</id><published>2020-11-27T02:49:00.004+05:30</published><updated>2020-11-30T17:35:05.754+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALWAYS ON"/><title type='text'>Why my Differential backups are not running on Primary Replica</title><content type='html'>&lt;p&gt;Hi Mates,&lt;/p&gt;&lt;p&gt;One of my friends contacted me saying that she was not able to perform Differential backups on Primary Replica.&amp;nbsp;&lt;/p&gt;&lt;p&gt;I was little surprised to hear this however I quickly asked her to check if they were part of Distributed Availability Groups.&lt;/p&gt;&lt;p&gt;So why you were not able to achieve this? If you understand DAG properly it is nothing but Group of Availability Groups . We can configure this across different domains and clusters.&amp;nbsp;&lt;/p&gt;&lt;p&gt;The Fundamental difference between Always ON AG and DAG is in&amp;nbsp; traditional AG(Single or Multi) there will be only one replica sending log records across all the replicas where as in DAG the primary will send the records to all the replicas in one Data center and to primary replica in another Data Center. In short we call this as forwarder replica and this replica will send the log records to other replicas in the cluster.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8wHBi8igTCP1IHEfc5cZskol-wSfNemOqztSm9TEtSydhXkYLVp2rv4kZQnxjLPyACd8NjxC010km_sFT58j3E2vWexRkQYNKjwrW2FC4JPxMdN86bf3Ztdzp-AImdtTu7C0CekbG2h0/s1000/diffbkp.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;543&quot; data-original-width=&quot;1000&quot; height=&quot;348&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8wHBi8igTCP1IHEfc5cZskol-wSfNemOqztSm9TEtSydhXkYLVp2rv4kZQnxjLPyACd8NjxC010km_sFT58j3E2vWexRkQYNKjwrW2FC4JPxMdN86bf3Ztdzp-AImdtTu7C0CekbG2h0/w640-h348/diffbkp.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;Above is the image what I got&amp;nbsp; from her even though it is primary replica in her case as this replica is being part of DAG it is technically secondary replica.&amp;nbsp;&lt;/p&gt;&lt;p&gt;when it comes to Log Backups I wrote an article which helps you in configuring them.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.chiranjeevivamsydba.com/2020/06/ola-hallengren-script-for-distributed.html&quot; target=&quot;_blank&quot;&gt;https://www.chiranjeevivamsydba.com/2020/06/ola-hallengren-script-for-distributed.html&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In case of full backups if you make use of Ola Hallengren scripts and left with default settings of Backup preference (prefer Secondary) then you will see databases being backed up on both Data centers.&lt;/p&gt;&lt;p&gt;Now the question is Do you want the Full backups to happen on Both Datacenters? If yes then you can live with your defaults. Otherwise you need to add a logic to your jobs so that the full backups only on one Data center.&amp;nbsp;&lt;/p&gt;&lt;p&gt;I am using the same logic of what I made use for Log Backups. First check if DAG is primary or not and if it is then check whether the replica is secondary inside the primary DAG. If so then run the Full backup.&amp;nbsp;&lt;/p&gt;&lt;p&gt;DECLARE&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; @DAG VARCHAR(MAX),&amp;nbsp; @AG varchar(50), @primary varchar(50)&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;DECLARE cursor_product CURSOR&lt;/p&gt;&lt;p&gt;FOR&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;select&amp;nbsp; s.primary_replica&lt;/p&gt;&lt;p&gt;from sys.dm_hadr_availability_group_states s&lt;/p&gt;&lt;p&gt;inner join sys.availability_groups g&lt;/p&gt;&lt;p&gt;on s.group_id=g.group_id&lt;/p&gt;&lt;p&gt;where g.name like &#39;%-DAG%&#39;&amp;nbsp;&lt;/p&gt;&lt;p&gt;and s.primary_replica&amp;nbsp; in (select g.name&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;from sys.dm_hadr_availability_group_states s&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;inner join sys.availability_groups g&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;on s.group_id=g.group_id&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;inner join sys.availability_replicas r&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;on s.group_id =r.group_id&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;where r.replica_server_name in (&#39;NODE1&#39;,&#39;NODE2&#39;,&#39;NODE3&#39;))&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;OPEN cursor_product;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;FETCH NEXT FROM cursor_product INTO @DAG&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;WHILE @@FETCH_STATUS = 0&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; BEGIN&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;BEGIN&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;					&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;select @primary =&amp;nbsp; s.primary_replica&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;from sys.dm_hadr_availability_group_states s&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;inner join sys.availability_groups g&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;on s.group_id =g.group_id&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;where g.name=@DAG&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;BEGIN&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;					&lt;/span&gt;IF @primary != @@SERVERNAME&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;					&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;						&lt;/span&gt;EXECUTE [dbo].[DatabaseBackup]&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;							&lt;/span&gt;@AvailabilityGroups = @DAG,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;							&lt;/span&gt;@Directory = N&#39;\\XXXXXXXXX&#39;,&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @BackupType = &#39;FULL&#39;,&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Verify = &#39;Y&#39;,&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @CleanupTime = 72,&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @CopyOnly=&#39;Y&#39;,&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @CheckSum = &#39;Y&#39;,&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @LogToTable = &#39;Y&#39;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;END&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;END&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;&amp;nbsp;FETCH NEXT FROM cursor_product INTO&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @DAG&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; END&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;CLOSE cursor_product;&lt;/p&gt;&lt;p&gt;DEALLOCATE cursor_product;&lt;/p&gt;&lt;p&gt;If you see the above script I am searching for string DAG&amp;nbsp; which means in your environment it can be different. As always you need to follow proper naming conventions to be hassle free.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/5969137078677486160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/5969137078677486160?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5969137078677486160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5969137078677486160'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/11/why-my-differential-backups-are-not.html' title='Why my Differential backups are not running on Primary Replica'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8wHBi8igTCP1IHEfc5cZskol-wSfNemOqztSm9TEtSydhXkYLVp2rv4kZQnxjLPyACd8NjxC010km_sFT58j3E2vWexRkQYNKjwrW2FC4JPxMdN86bf3Ztdzp-AImdtTu7C0CekbG2h0/s72-w640-h348-c/diffbkp.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-8223860517167362258</id><published>2020-11-26T05:15:00.000+05:30</published><updated>2020-11-26T05:15:35.551+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Performance"/><title type='text'>How  SQL Server 2019 helped me in solving Performance issue</title><content type='html'>&lt;p&gt;Hi Friends,&lt;/p&gt;&lt;p&gt;I would like to share an interesting scenario with you all. The issue started on Azure Managed instance where my lower Environment is residing (DEV/QA/UAT) and the production is hosted on on-premises.&lt;/p&gt;&lt;p&gt;Application Team&amp;nbsp; raised a ticket stating the performance is way too bad on Azure MI. When cross checked the query was taking 25 minutes and on production it was just taking 1 minute.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now the ball has come to my court and below are the things what I verified.&lt;/p&gt;&lt;p&gt;Resource comparison in Azure MI(RAM:20.4 GB CPU&#39;s:4) and On-premises (RAM: 32 GB CPU&#39;s :8)&amp;nbsp;&lt;/p&gt;&lt;p&gt;In Azure MI&amp;nbsp; for every 1 core we will have 5.1 GB of RAM&lt;/p&gt;&lt;pre class=&quot;warningMsg&quot; style=&quot;background: rgb(242, 242, 242); border: 1px solid rgb(136, 136, 136); box-sizing: border-box !important; color: #3d3d3d; font-family: Consolas, Monaco, &amp;quot;Courier New&amp;quot;, monospace !important; font-size: 12.375px !important; line-height: 18px; margin: -6px 20px 20px 10px; max-width: 90%; outline: none; overflow: auto hidden; padding: 9px 9px 9px 11px; text-rendering: optimizelegibility; vertical-align: bottom;&quot;&gt;  4 vCores  =   20.4 GB
  8 vCores  =   40.8 GB
 16 vCores  =   81.6 GB
 24 vCores  =  122.4 GB
 32 vCores  =  163.2 GB
 40 vCores  =  204.0 GB
 64 vCores  =  326.4 GB
 80 vCores  =  408.0 GB&lt;/pre&gt;&lt;p&gt;Then I went with Index definition ,compatibility level and statistics and they all look one at the same.&amp;nbsp;&lt;/p&gt;&lt;p&gt;By the way Azure MI is hosted in General purpose tier so obviously the storage will not be faster.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Forgot to mention I verified whether the application server is&amp;nbsp; hosted in Azure or not and it is.&lt;/p&gt;&lt;p&gt;My initial suspect was Resources shortage(Ram &amp;amp; CPU) on MI. However anything in Azure is cost based. Now when I asked the developer to run the query most of times it is in suspended state with waitstats as &quot;PAGEIOLATACH&quot;. This again made me to think from Storage perspective again we can&#39;t change that from General to Business critical.&lt;/p&gt;&lt;p&gt;After a day developer told me that it was working fine on one of the databases. However the no of rows are almost Zero for many of the tables related to problematic query.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMJX3fMea8Ts_Aja4jnXVJcTKH6TgV4byDQFg9zY9Ets3t2opqyY5nYE2tGKjBbko149d3IttMN4QpYp7_KQWldBUVoiFcrsgNLIIC4zvE-nr9bzq3398xCYYG87qW-tJ_9Cu-N0Aipuw/s968/timeamps.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;551&quot; data-original-width=&quot;968&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMJX3fMea8Ts_Aja4jnXVJcTKH6TgV4byDQFg9zY9Ets3t2opqyY5nYE2tGKjBbko149d3IttMN4QpYp7_KQWldBUVoiFcrsgNLIIC4zvE-nr9bzq3398xCYYG87qW-tJ_9Cu-N0Aipuw/w400-h228/timeamps.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As you can see from above image hence we can expect that to be faster.&lt;/p&gt;&lt;p&gt;Now I am back to square one but this time I thought of changing the CL from 110 to 150 and it did worked.&lt;/p&gt;&lt;p&gt;Before providing the explanation I made use of&amp;nbsp;&lt;a href=&quot;https://statisticsparser.com/&quot; target=&quot;_blank&quot;&gt;https://statisticsparser.com/&lt;/a&gt;&amp;nbsp;to see the number of reads before and after the CL change.&lt;/p&gt;&lt;p&gt;Before Change:&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcy0fSRPNIgXNG3ZqeloaHeDF0TDU4v7UxNMFoIHsUMaHPBtnWiR278kgpQbMEv1KJZBrmraf-5g3jQ_kenlpg6OOYmLrH784uj70iVQUyVgLlWq_VqhpVlLP5_V4vvxae47pW4OT4nvY/s1368/beforechange.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;580&quot; data-original-width=&quot;1368&quot; height=&quot;272&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcy0fSRPNIgXNG3ZqeloaHeDF0TDU4v7UxNMFoIHsUMaHPBtnWiR278kgpQbMEv1KJZBrmraf-5g3jQ_kenlpg6OOYmLrH784uj70iVQUyVgLlWq_VqhpVlLP5_V4vvxae47pW4OT4nvY/w640-h272/beforechange.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;After change:&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikBdAF5wWCv_RMz2sgfqxiVFT6Oj5__5jsAWSJF9TCTUH9F1zx5zEGZfv54va-ybMygd3h5Lv6i4JDqq7ap68MHkyW3r-dK99q4hPknOvFPpZC0AMNZgF0U1Dt2kG9VE-5dvGLGf0BaLw/s1436/afterchnage.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;527&quot; data-original-width=&quot;1436&quot; height=&quot;234&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikBdAF5wWCv_RMz2sgfqxiVFT6Oj5__5jsAWSJF9TCTUH9F1zx5zEGZfv54va-ybMygd3h5Lv6i4JDqq7ap68MHkyW3r-dK99q4hPknOvFPpZC0AMNZgF0U1Dt2kG9VE-5dvGLGf0BaLw/w640-h234/afterchnage.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As you can see the logical reads has come down a lot and also the query which was running for 25 min got reduced to 5 min.&lt;/p&gt;&lt;p&gt;The query was not able make use of parallelism as it has inhibitors when you right click and open the execution plan as XML you will very well find the reason. In my case it was below&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;lt;QueryPlan DegreeOfParallelism=&quot;0&quot; NonParallelPlanReason=&quot;TSQLUserDefinedFunctionsNotParallelizable&quot;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;of course I could have changed&amp;nbsp; that but this being vendor application I can&#39;t change the code. Now finally how did SQL Server 2019 helped me because it was making use of new feature&amp;nbsp;&lt;b&gt;batch-mode-on-rowstore.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;In my query they were making use of Windows partitions like below&amp;nbsp;&lt;/p&gt;&lt;p&gt;SELECT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ROW_NUMBER() OVER (PARTITION BY IDMASTransaction ORDER BY txfe.ID DESC) As RowNum&lt;/p&gt;&lt;p&gt;Usually batch mode are super good with Colum Store Indexes which were introduced in SQL Server 2012. However from 2019 there is no need for the table to have Column Store Indexes and it can work very well with Analytical Queries.&amp;nbsp;&lt;/p&gt;&lt;p&gt;This is Database Scoped configuration&lt;/p&gt;&lt;table class=&quot;crayon-table&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: white; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; color: #757575; font-family: &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 2; margin-bottom: 0px !important; margin-left: -18px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; table-layout: auto !important; vertical-align: baseline; width: auto !important;&quot;&gt;&lt;tbody style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;tr class=&quot;urvanov-syntax-highlighter-row&quot; style=&quot;background: 0px center; border: none !important; margin: 0px !important; padding: 0px !important; vertical-align: top !important;&quot;&gt;&lt;td class=&quot;crayon-nums &quot; data-settings=&quot;hide&quot; style=&quot;background: rgb(223, 239, 255) !important; border: none !important; color: rgb(84, 153, 222) !important; margin: 0px !important; padding: 0px !important; vertical-align: top !important;&quot;&gt;&lt;div class=&quot;urvanov-syntax-highlighter-nums-content&quot; style=&quot;background: 0px center; border: 0px; line-height: 15px !important; margin: 0px; padding: 0px; vertical-align: baseline; white-space: nowrap;&quot;&gt;&lt;div class=&quot;crayon-num&quot; data-line=&quot;urvanov-syntax-highlighter-5fbe78feaa140624980046-1&quot; style=&quot;background: 0px center; border: 0px; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: 15px; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;urvanov-syntax-highlighter-code&quot; style=&quot;background: 0px center; border: none !important; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 668.667px;&quot;&gt;&lt;div class=&quot;crayon-pre&quot; style=&quot;background: none !important; border: none !important; color: black; line-height: 15px !important; margin: 0px; overflow: visible; padding: 0px; tab-size: 4; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div class=&quot;crayon-line&quot; id=&quot;urvanov-syntax-highlighter-5fbe78feaa140624980046-1&quot; style=&quot;background: 0px center; border: 0px; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline; white-space: pre-wrap !important; word-break: break-all;&quot;&gt;&lt;span class=&quot;crayon-k&quot; style=&quot;border: 0px; color: rgb(0, 0, 255) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ALTER&lt;/span&gt;&lt;span class=&quot;crayon-h&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;crayon-k&quot; style=&quot;border: 0px; color: rgb(0, 0, 255) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;DATABASE&lt;/span&gt;&lt;span class=&quot;crayon-h&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;crayon-i&quot; style=&quot;border: 0px; color: rgb(0, 128, 128) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SCOPED&lt;/span&gt;&lt;span class=&quot;crayon-h&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;crayon-i&quot; style=&quot;border: 0px; color: rgb(0, 128, 128) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;CONFIGURATION&lt;/span&gt;&lt;span class=&quot;crayon-h&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;crayon-k&quot; style=&quot;border: 0px; color: rgb(0, 0, 255) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;crayon-h&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;crayon-i&quot; style=&quot;border: 0px; color: rgb(0, 128, 128) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;BATCH_MODE_ON_ROWSTORE&lt;/span&gt;&lt;span class=&quot;crayon-h&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;crayon-o&quot; style=&quot;border: 0px; color: rgb(128, 128, 128) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;crayon-h&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;crayon-k&quot; style=&quot;border: 0px; color: rgb(0, 0, 255) !important; font-family: inherit; font-size: inherit !important; font-weight: inherit !important; height: inherit; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ON&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;That being said kindly don&#39;t turn it on until proper testing has been done. In my case it was fruitful&amp;nbsp;&lt;/p&gt;&lt;p&gt;Below link will further help you to understand this concept&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://techcommunity.microsoft.com/t5/azure-sql/introducing-batch-mode-on-rowstore/ba-p/386256&quot; target=&quot;_blank&quot;&gt;https://techcommunity.microsoft.com/t5/azure-sql/introducing-batch-mode-on-rowstore/ba-p/386256&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I hope you will explore this in your Environment as well. Thanks for Reading.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/8223860517167362258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/8223860517167362258?isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/8223860517167362258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/8223860517167362258'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/11/how-sql-server-2019-helped-me-in.html' title='How  SQL Server 2019 helped me in solving Performance issue'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMJX3fMea8Ts_Aja4jnXVJcTKH6TgV4byDQFg9zY9Ets3t2opqyY5nYE2tGKjBbko149d3IttMN4QpYp7_KQWldBUVoiFcrsgNLIIC4zvE-nr9bzq3398xCYYG87qW-tJ_9Cu-N0Aipuw/s72-w400-h228-c/timeamps.PNG" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-3891068954480037509</id><published>2020-11-13T21:26:00.000+05:30</published><updated>2020-11-13T21:26:23.002+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALWAYS ON"/><title type='text'>Database not in Synchronized state in Distributed Availability Group</title><content type='html'>&lt;p&gt;Hi All,&lt;/p&gt;&lt;p&gt;This Again is a simple post which explains about the below Error&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Local availability replica for availability group &#39;XXX-DAG&#39; has not been granted permission to create databases, but has a SEEDING_MODE of AUTOMATIC.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;How to avoid this error all together? When we have the above error we just need to run the below command&amp;nbsp;&lt;/p&gt;&lt;p&gt;--Allow the Availability Group to create databases on behalf of the primary replica&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: #04ff00;&quot;&gt;ALTER AVAILABILITY GROUP [XXXX] GRANT CREATE ANY DATABASE&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: #04ff00;&quot;&gt;GO&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Also Make sure there are no databases when creating Distributed availability Group. My approach would be to restore on all replicas with no recovery and then bring online on primary replica of primary Availability group and then perform join so that the database would be part of DAG automatically.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/3891068954480037509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/3891068954480037509?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/3891068954480037509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/3891068954480037509'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/11/database-not-in-synchronized-state-in.html' title='Database not in Synchronized state in Distributed Availability Group'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-2522252386551817634</id><published>2020-11-12T05:07:00.002+05:30</published><updated>2020-11-12T05:07:33.134+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALWAYS ON"/><title type='text'>How to remove database from Always On in Distributed Availability Group</title><content type='html'>&lt;p&gt;Hi Mates,&lt;/p&gt;&lt;p&gt;This is very simple post and it helps you in removing Database from Distributed AG.&lt;/p&gt;&lt;p&gt;We have 3 replicas in one Data center and the other 3 in Different DC. As you know in Multi-subnet there will be one windows cluster that will be spanned across different networks. But in DAG we can have 2 different windows clusters and each of them will have it&#39;s own AG&#39;s .&lt;/p&gt;&lt;p&gt;I added a database to DAG and now my requirement is to remove it and then restore Database with fresh copy there after adding it back again to DAG.&lt;/p&gt;&lt;p&gt;Steps will differ here as we have the concept of forwarder replica in DAG.&lt;/p&gt;&lt;p&gt;1) On the forwarder replica we need to run the below command&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; ALTER DATABASE [DBNAME] SET HADR OFF&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; This will leave the database in restoring state on 3 replicas (forwarder and the secondary replicas)&lt;/p&gt;&lt;p&gt;2) Now connect to primary Replica of primary Availability Group and run the command&lt;/p&gt;&lt;p&gt;&amp;nbsp; ALTER AVAILABILITY GROUP [XXX] REMOVE DATABASE [XXX]&amp;nbsp;&lt;/p&gt;&lt;p&gt;This will work in similar norms to that of traditional AG which means online state on Primary and restoring on Secondary replicas&lt;/p&gt;&lt;p&gt;Finally we will have database in online state on primary replica of (primary AG) and remaining all(5 in my case) of them will be in restoring state&lt;/p&gt;&lt;p&gt;When I was adding the database to DAG I got the below error&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Msg 1408, Level 16, State 211, Line 3&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;The remote copy of database &quot;XXXXXXX&quot; is not recovered far enough to enable database mirroring or to join it to the availability group.&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;You need to apply missing log records to the remote database by restoring the current log backups from the principal/primary database.&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;This is a straight forward error and many people would like to go with log backups however just to let you know we can bridge the gap even with Differential as well.&lt;/p&gt;&lt;p&gt;In case if you want to know how the log backups works on DAG below is the link for the same.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.chiranjeevivamsydba.com/2020/06/ola-hallengren-script-for-distributed.html&quot; target=&quot;_blank&quot;&gt;https://www.chiranjeevivamsydba.com/2020/06/ola-hallengren-script-for-distributed.html&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thanks for Reading.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/2522252386551817634/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/2522252386551817634?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/2522252386551817634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/2522252386551817634'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/11/how-to-remove-database-from-always-on.html' title='How to remove database from Always On in Distributed Availability Group'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-864408725028094796</id><published>2020-11-05T19:24:00.000+05:30</published><updated>2020-11-05T19:24:06.039+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Administration"/><title type='text'>Linked Server Collation Issue</title><content type='html'>&lt;p&gt;Hi Mates,&lt;/p&gt;&lt;p&gt;Today I would like to share an issue that has been posted in of the groups. It&#39;s actually is a simple issue however I was not able to answer it properly.&amp;nbsp; Below is the message that has been shared&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: red;&quot;&gt;Msg 468, Level 16, State 9, Line 5&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: red;&quot;&gt;Cannot resolve the collation conflict between &quot;Latin1_General_CI_AS&quot; and &quot;Latin1_General_CI_AS_KS_WS&quot; in the equal to operation.&lt;/span&gt;&lt;/p&gt;&lt;div&gt;I thought of reproducing the issue and here are the details&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Instance 1 : Collation is&amp;nbsp;Latin1_General_CI_AS&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Instance 2: Collation is&amp;nbsp;Latin1_General_CI_AS_KS_WS&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I created Linked server on Instance1 that connects to Instance2.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Below is the query what I ran to reproduce the issue on Instance1&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;select * from [instance2].[msdb].[dbo].[backupset]&lt;/div&gt;&lt;div&gt;where collation_name in (select collation_name from msdb..backupset )&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My initial solution was it is not possible unless we use the keyword collate. But later I realized there lies an option in Linked server properties&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg55n6C7HfRu3lvpUgzlH_SNuTLExOW2KNubxtg-XcLosdCHK7osibVd0vA832LdsmFzVjabrcFdZFGYrqKvNz2G0pnyHzdt4LDDnKh3IuiKQ2eykDG8DFtHjuf-ThbS-ubgy56zrSY1bI/s307/collation1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;229&quot; data-original-width=&quot;307&quot; height=&quot;477&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg55n6C7HfRu3lvpUgzlH_SNuTLExOW2KNubxtg-XcLosdCHK7osibVd0vA832LdsmFzVjabrcFdZFGYrqKvNz2G0pnyHzdt4LDDnKh3IuiKQ2eykDG8DFtHjuf-ThbS-ubgy56zrSY1bI/w640-h477/collation1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;By default the remote collation property is&amp;nbsp; set to true once we change that to false we will no more have the issue&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKP2fMuqFKwKxj60v8bCOo9wMdE6T17qzYeJlfXrO75gOC4BvThMJsYzgJYm4DhosZ8fRcG5TqoQrcw3fV5xvF63uC6FY5JnT9Gb1CxL6WYLO2XWn0sr_7_57Z07Vr4x-ogYWIwOJMqJk/s1343/collation2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;229&quot; data-original-width=&quot;1343&quot; height=&quot;110&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKP2fMuqFKwKxj60v8bCOo9wMdE6T17qzYeJlfXrO75gOC4BvThMJsYzgJYm4DhosZ8fRcG5TqoQrcw3fV5xvF63uC6FY5JnT9Gb1CxL6WYLO2XWn0sr_7_57Z07Vr4x-ogYWIwOJMqJk/w640-h110/collation2.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/864408725028094796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/864408725028094796?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/864408725028094796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/864408725028094796'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/11/linked-server-collation-issue.html' title='Linked Server Collation Issue'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg55n6C7HfRu3lvpUgzlH_SNuTLExOW2KNubxtg-XcLosdCHK7osibVd0vA832LdsmFzVjabrcFdZFGYrqKvNz2G0pnyHzdt4LDDnKh3IuiKQ2eykDG8DFtHjuf-ThbS-ubgy56zrSY1bI/s72-w640-h477-c/collation1.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-7097976109076856122</id><published>2020-10-31T16:09:00.003+05:30</published><updated>2020-10-31T16:12:56.508+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Administration"/><title type='text'>How to troubleshoot connectivity issues due to firewall </title><content type='html'>&lt;p&gt;Hi Friends,&lt;/p&gt;&lt;p&gt;Today I will share an issue which ideally started at higher level however after troubleshooting it landed on Basics.&lt;/p&gt;&lt;p&gt;Let me start of the issue we configured Distributed Availability Groups and as part of it we requested the application team to make use of ApplicationIntent=Readonly in their reporting services Data Source.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjasOV4tUHyoDhuLa2W8swOvQ3fUdW4j2HPbgedn0bWrsysgEnIh00HnIWFNVZPl8Z4jcS-P2zOd54nWPx1XAX3pBlyZCifSah8gYAn40b2JsD5dWa0KBQxpbuT5zpv5WmAlbdjnjiNbuY/s1150/appintent1.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;707&quot; data-original-width=&quot;1150&quot; height=&quot;394&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjasOV4tUHyoDhuLa2W8swOvQ3fUdW4j2HPbgedn0bWrsysgEnIh00HnIWFNVZPl8Z4jcS-P2zOd54nWPx1XAX3pBlyZCifSah8gYAn40b2JsD5dWa0KBQxpbuT5zpv5WmAlbdjnjiNbuY/w640-h394/appintent1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;When they checked they said it is not working and below is the error message&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;Segoe, Arial, Helvetica, sans-serif&quot; style=&quot;background-color: white; color: red; font-size: x-small;&quot;&gt;A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;Segoe, Arial, Helvetica, sans-serif&quot; style=&quot;background-color: white; color: red; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The message is not popping up when we removed the Application Intent from the connection String.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGNZGgeoep5Xq7z35mDRrQGIpyZwP8J_uZ4KFkEhT0_24qT-_FGqja39yePYXLBjyesvCEARp5h3XHluQDRQnHbOIdLH1chTh5-oYueyUwJULNIRKqRZPiUSoq3JF74KWsqbfzzVeaal8/s631/udl3.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;542&quot; data-original-width=&quot;631&quot; height=&quot;550&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGNZGgeoep5Xq7z35mDRrQGIpyZwP8J_uZ4KFkEhT0_24qT-_FGqja39yePYXLBjyesvCEARp5h3XHluQDRQnHbOIdLH1chTh5-oYueyUwJULNIRKqRZPiUSoq3JF74KWsqbfzzVeaal8/w640-h550/udl3.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;At first Glance it was little surprising and I thought there lies some issue with Read only Routing.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;I wrote an article on how to configure Routing from GUI below is the link&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.chiranjeevivamsydba.com/2019/03/always-on-read-only-routing-from-sql.html&quot; target=&quot;_blank&quot;&gt;https://www.chiranjeevivamsydba.com/2019/03/always-on-read-only-routing-from-sql.html&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;when checked the routing was working perfectly fine. Now where lies the problem is it something with reporting services? Not at all whenever I have such issues I always make use of UDL file to test the connectivity.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXtwu5IY67v3u_Y60QwdNazpPScV2WQmT1_jsgK3eEsoZoecLX_m2T7ByYiJ17vESTNbWcHzDYTYzIdmSzNzO2z689084jQOtp3I40D8Hz-2mPcX9H1_lzOC9DzIYQYRi1CdLa81wpA7M/s711/UDL.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;366&quot; data-original-width=&quot;711&quot; height=&quot;330&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXtwu5IY67v3u_Y60QwdNazpPScV2WQmT1_jsgK3eEsoZoecLX_m2T7ByYiJ17vESTNbWcHzDYTYzIdmSzNzO2z689084jQOtp3I40D8Hz-2mPcX9H1_lzOC9DzIYQYRi1CdLa81wpA7M/w640-h330/UDL.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;By Default UDL file will have it&#39;s Application Intent as READWRITE but I changed that to READONLY as the issue is happening only with that. I created this UDL file from&amp;nbsp; my jump server and it is working fine.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Again I got struck and this time I created the same file on the server where Reporting services are deployed(Installed) but this time the UDL file has thrown the below error&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZpPXrZOkH45KzqZqNpJAj0N-ThAxnnFwSvYWQ9_-JpxD_Ur000nddehaSevNu_6Jm6rcysZlMyZkEanL-Nq3YpGcALO72Fh5PGBiDQBTF4VainvoGV8ZjTqMsq1hk3jok0Cc3aIiZMTU/s1203/UDL_2.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;806&quot; data-original-width=&quot;1203&quot; height=&quot;428&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZpPXrZOkH45KzqZqNpJAj0N-ThAxnnFwSvYWQ9_-JpxD_Ur000nddehaSevNu_6Jm6rcysZlMyZkEanL-Nq3YpGcALO72Fh5PGBiDQBTF4VainvoGV8ZjTqMsq1hk3jok0Cc3aIiZMTU/w640-h428/UDL_2.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now I can say it is not anything with reporting services. So why it is working with Readwrite why not with Readonly? Because at the time of requesting my colleague has requested with Listener Name and port no but he has not provided the server names hence we have this issue&lt;/p&gt;&lt;p&gt;When I just passed the primary Replica name instead of Listener name it too is getting failed with the same error message.&lt;/p&gt;&lt;p&gt;My Servers have sensitive information hence they are placed behind the firewall so to overcome this we raised change requested this time by passing the server names as well with port no&#39;s.&lt;/p&gt;&lt;p&gt;The same can be done with SQLCMD too but on reporting servers we don&#39;t have that. Hence I made use of UDL to test the connectivity.&lt;/p&gt;&lt;p&gt;I always feel that most of the solutions can be obtained easily if we have our basics in place.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/7097976109076856122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/7097976109076856122?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/7097976109076856122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/7097976109076856122'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/10/how-to-troubleshoot-connectivity-issues.html' title='How to troubleshoot connectivity issues due to firewall '/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjasOV4tUHyoDhuLa2W8swOvQ3fUdW4j2HPbgedn0bWrsysgEnIh00HnIWFNVZPl8Z4jcS-P2zOd54nWPx1XAX3pBlyZCifSah8gYAn40b2JsD5dWa0KBQxpbuT5zpv5WmAlbdjnjiNbuY/s72-w640-h394-c/appintent1.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-5113066502660638816</id><published>2020-10-27T06:33:00.011+05:30</published><updated>2020-11-01T14:13:20.117+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server Multi Subnet on Linux"/><title type='text'>Configure-Multiple-subnet-Always on-Availability-Group in Linux(CENTOS)</title><content type='html'>&lt;p&gt;Hi Friends,&lt;/p&gt;&lt;p&gt;This post helps you in creating Multi Subnet Always ON in Linux Environment. Frankly speaking I had so many hurdles however I achieved this.&lt;/p&gt;&lt;p&gt;The problem is I don&#39;t have much knowledge on Linux unlike Windows where I do know how thinks workout.&amp;nbsp;&lt;/p&gt;&lt;p&gt;As this being multi subnet the problem is all about how to accomplish connectivity between nodes .&lt;/p&gt;&lt;p&gt;The ideas that popped in my mind are&amp;nbsp;&lt;/p&gt;&lt;p&gt;1) Achieving Routing between the 2 nodes using Router (another VM with Linux )--&amp;gt;It didn&#39;t work&lt;/p&gt;&lt;p&gt;2) using Azure VM&#39;s by configuring VNET to VNET (This will work but I don&#39;t have subscription)&lt;/p&gt;&lt;p&gt;3) Adding Linux machines to Windows Active Directory and then configuring Routing (It did work)&lt;/p&gt;&lt;p&gt;In the past I wrote a post on how to perform multi subnet in Windows and below is the link&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.chiranjeevivamsydba.com/2018/11/multi-subnet-always-on-scenarios.html&quot; target=&quot;_blank&quot;&gt;https://www.chiranjeevivamsydba.com/2018/11/multi-subnet-always-on-scenarios.html&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;My post is truly inspired from&amp;nbsp;&lt;a href=&quot;https://www.mssqltips.com/sqlserverauthor/18/edwin-sarmiento/&quot; rel=&quot;author&quot; style=&quot;background-color: white; box-sizing: inherit; color: red; cursor: pointer; font-family: &amp;quot;helvetica neue&amp;quot;, Helvetica, Roboto, Arial, sans-serif; font-size: 16px; line-height: inherit; text-decoration-line: none;&quot; title=&quot;author profile for Edwin Sarmiento&quot;&gt;Edwin Sarmiento&lt;/a&gt;&lt;span face=&quot;&amp;quot;helvetica neue&amp;quot;, Helvetica, Roboto, Arial, sans-serif&quot; style=&quot;background-color: white; color: #222222; font-size: 16px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://www.mssqltips.com/sqlservertip/5161/install-and-configure-sql-server-2017-availability-groups-on-linux--part-1/&quot; target=&quot;_blank&quot;&gt;5 part series&lt;/a&gt;&amp;nbsp;&amp;nbsp;(MSSQLTIPS.COM). This is however single subnet Always ON.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The Master (Edwin) has given almost all the details hence I don&#39;t want to go through all the details. I will share just the extra steps that are required to perform Multi Subnet.&lt;/p&gt;&lt;p&gt;As said I am not an Linux Expert hence I installed 3 VM&#39;s on my laptop&lt;/p&gt;&lt;p&gt;First VM: Windows Domain server with 2 network cards (192.168.81.1) and (192.168.82.1)&lt;/p&gt;&lt;p&gt;Second VM: Linux CENTOS 7 with GUI support&lt;/p&gt;&lt;p&gt;Third VM: Linux CENTOS 7 with GUI support&lt;/p&gt;&lt;p&gt;One problem is we need to configure Manual IP Address to get this work. But before doing this we need to download&amp;nbsp; below features.&amp;nbsp;&lt;/p&gt;&lt;p&gt;1) SQL Server 2019&lt;/p&gt;&lt;p&gt;2) SQL Server HA&amp;nbsp;&lt;/p&gt;&lt;p&gt;3) pacemaker&amp;nbsp; software&lt;/p&gt;&lt;p&gt;4) install Active directory related software&#39;s (As we need&amp;nbsp; to add our Linux Machines to Windows Domain server&lt;/p&gt;&lt;p&gt;5) Oracle Virtual Box Guest Additions (As we need to copy the commands between our Host and virtual machines)&lt;/p&gt;&lt;p&gt;Also I would like to warn you on one more thing at the time of creation of virtual machines (Linux) please make sure you create bigger partitions as I ran out space on root folder.&lt;/p&gt;&lt;p&gt;As the master(Edwin) explained everything in detail I will not reinvent the wheel .&lt;/p&gt;&lt;p&gt;&amp;nbsp;I will just share&amp;nbsp; my Environment details and the extra steps for Multi Subnet&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinVIpCyuuEf8sgdpG75ZXfTcip8Xbowb7I616hQ1rD89r82rzwovV0r3_DdeVYPouiZ-fv5vq5fmKhyxOSnGByzQn5TAkXgErknE_tLqmvRxI9BYjZ021bfS90yu2PCEbmtkLZ96gFTTw/s655/osversion.GIF&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;95&quot; data-original-width=&quot;655&quot; height=&quot;92&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinVIpCyuuEf8sgdpG75ZXfTcip8Xbowb7I616hQ1rD89r82rzwovV0r3_DdeVYPouiZ-fv5vq5fmKhyxOSnGByzQn5TAkXgErknE_tLqmvRxI9BYjZ021bfS90yu2PCEbmtkLZ96gFTTw/w640-h92/osversion.GIF&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinaTrXxg17fzxRINgYZCy3VnJxx-y0zRlkDZs947ZPsxHZQUJLvdoXJPX8QIP4qVuKFzMIsH1qEIBBQ510k3PqFVSeNuDxuNzM5RScb-WrEnm5BLnU3MOCq_Ar2L93S9Cyu03yEDPIgxU/s1025/sqlversion.GIF&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;332&quot; data-original-width=&quot;1025&quot; height=&quot;208&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinaTrXxg17fzxRINgYZCy3VnJxx-y0zRlkDZs947ZPsxHZQUJLvdoXJPX8QIP4qVuKFzMIsH1qEIBBQ510k3PqFVSeNuDxuNzM5RScb-WrEnm5BLnU3MOCq_Ar2L93S9Cyu03yEDPIgxU/w640-h208/sqlversion.GIF&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As you can see I am on SQL server 2019 and when it comes to my IP configuration I have&amp;nbsp;&lt;/p&gt;&lt;p&gt;LINNODE1 with (192.168.81.10) and LINNODE2 with (192.168.82.10)&lt;/p&gt;&lt;p&gt;After you have configured all the steps mentioned by Edwin in his 5 part series we need to export Cluster Information Base in to a text file using the below command and&amp;nbsp;&lt;/p&gt;&lt;p&gt;sudo pcs cluster cib cib.txt&lt;/p&gt;&lt;p&gt;Then you need to make the changes highlighted(in red) and push it back by running&amp;nbsp;&lt;/p&gt;&lt;p&gt;sudo pcs cluster cib-push cib.txt&lt;/p&gt;&lt;p&gt;&amp;lt;primitive class=&quot;ocf&quot; id=&quot;vip1&quot; provider=&quot;heartbeat&quot; type=&quot;IPaddr2&quot;&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b style=&quot;background-color: red;&quot;&gt; &amp;nbsp; &amp;lt;instance_attributes id=&quot;vip1-instance_attributes1&quot;&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;rule id=&quot;Subnet1-IP&quot; score=&quot;INFINITY&quot;&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;expression id=&quot;Subnet1-Node1&quot; attribute=&quot;#uname&quot; operation=&quot;eq&quot; value=&quot;linnode1&quot;/&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/rule&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;nvpair id=&quot;vip1-instance_attributes-ip&quot; name=&quot;ip&quot; value=&quot;192.168.81.20&quot;/&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/instance_attributes&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b style=&quot;background-color: red;&quot;&gt;&amp;lt;instance_attributes id=&quot;vip1-instance_attributes2&quot;&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;rule id=&quot;Subnet2-IP&quot; score=&quot;INFINITY&quot;&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;expression id=&quot;Subnet2-Node1&quot; attribute=&quot;#uname&quot; operation=&quot;eq&quot; value=&quot;linnode2&quot;/&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/rule&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;nvpair id=&quot;vip1-instance_attributes-ip2&quot; name=&quot;ip&quot; value=&quot;192.168.82.20&quot;/&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;background-color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/instance_attributes&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;lt;operations&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;op id=&quot;vip1-monitor-interval-10s&quot; interval=&quot;10s&quot; name=&quot;monitor&quot; timeout=&quot;20s&quot;/&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;op id=&quot;vip1-start-interval-0s&quot; interval=&quot;0s&quot; name=&quot;start&quot; timeout=&quot;20s&quot;/&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;op id=&quot;vip1-stop-interval-0s&quot; interval=&quot;0s&quot; name=&quot;stop&quot; timeout=&quot;20s&quot;/&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/operations&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/primitive&amp;gt;&lt;/p&gt;&lt;p&gt;I will show you where my resources are running before the failover&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_PgFjWb4CwnxBLcynUkatWJ9ilBVoIo3Yly52-vgsBS2Vs6isP9oW2FDlMwe3b6rIcl0yI-oMFNYNILGzrVyz5CU3aFdfB7B7SHTjhkgR07cmoIN4u7juTkjHfZnlFTZ7tqQbkG4DOb8/s1443/beforefailover.GIF&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;485&quot; data-original-width=&quot;1443&quot; height=&quot;216&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_PgFjWb4CwnxBLcynUkatWJ9ilBVoIo3Yly52-vgsBS2Vs6isP9oW2FDlMwe3b6rIcl0yI-oMFNYNILGzrVyz5CU3aFdfB7B7SHTjhkgR07cmoIN4u7juTkjHfZnlFTZ7tqQbkG4DOb8/w640-h216/beforefailover.GIF&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now perform a manual failover using the below command&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5tYZwnPaauQF5tTBkJZacq0Xkrh4J9dK3UoNvigTWh3NlkQaVvyAwuOKC4oVRNeZMBSWkzAjSGBpzDRd1XgdOiWpzUzIIcdkMeOzUiQQJ4wJxaQbsgirLnqLTwAZdEb3DF6sXm68AZq4/s926/failovercmd.GIF&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;71&quot; data-original-width=&quot;926&quot; height=&quot;50&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5tYZwnPaauQF5tTBkJZacq0Xkrh4J9dK3UoNvigTWh3NlkQaVvyAwuOKC4oVRNeZMBSWkzAjSGBpzDRd1XgdOiWpzUzIIcdkMeOzUiQQJ4wJxaQbsgirLnqLTwAZdEb3DF6sXm68AZq4/w640-h50/failovercmd.GIF&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbR3Qx-YGS1MGMJxVReHhFkdot9GAtdbql2bndhyphenhyphen4d23HgijI0NQxCaAgl7jnqigejRSAkBhuqo5Z83b9q4ocXiG09CyvFOhp77j_JfDUBQsDu7_LtieXpDWxBoHzfitURFxn3KuZ4ssw/s786/afterfailover.GIF&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;120&quot; data-original-width=&quot;786&quot; height=&quot;98&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbR3Qx-YGS1MGMJxVReHhFkdot9GAtdbql2bndhyphenhyphen4d23HgijI0NQxCaAgl7jnqigejRSAkBhuqo5Z83b9q4ocXiG09CyvFOhp77j_JfDUBQsDu7_LtieXpDWxBoHzfitURFxn3KuZ4ssw/w640-h98/afterfailover.GIF&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;As you can see now I got my resources from NODE2 to NODE1&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Any time we can connect to only 1 IP Address just like windows.&amp;nbsp; Below are the IP Addresses for my Listener&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;192.168.81.20 (on LINNODE1)&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;192.168.82.20 (on LINNODE2&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh8rwZlSf3kE5EV3rM-Ih_YSFcoZXr-Tw_N8dn52Bf1cji_rS4Mn9Cn009NdXOX30aAyHNR2misODu-ivNAx0xipJxvb5AjGC7tNfgScqzqbPxt5UCkFhvEI-A7spJrwRR2RlJb5ZJh-Y/s858/linnode1.GIF&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;283&quot; data-original-width=&quot;858&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh8rwZlSf3kE5EV3rM-Ih_YSFcoZXr-Tw_N8dn52Bf1cji_rS4Mn9Cn009NdXOX30aAyHNR2misODu-ivNAx0xipJxvb5AjGC7tNfgScqzqbPxt5UCkFhvEI-A7spJrwRR2RlJb5ZJh-Y/w640-h212/linnode1.GIF&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjABj6ADISCGpTaEQJP5Uki-mesNYa05CDOgkZDS1GQQNmCZPNG5KTAA33LYdt0hAZoBbDHtZetsj10RcxUj6iC9i2MjnhaU3RX-PgyynzyKrqoz3f2TsVE3Pgh8qehEUsYgB12CenqpA8/s1329/linnode2.GIF&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;420&quot; data-original-width=&quot;1329&quot; height=&quot;202&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjABj6ADISCGpTaEQJP5Uki-mesNYa05CDOgkZDS1GQQNmCZPNG5KTAA33LYdt0hAZoBbDHtZetsj10RcxUj6iC9i2MjnhaU3RX-PgyynzyKrqoz3f2TsVE3Pgh8qehEUsYgB12CenqpA8/w640-h202/linnode2.GIF&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;I felt really happy with this as it is perhaps first of it&#39;s kind( I have not seen any blog related to this apart from the official MS Documentation).&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;If any one is interested in getting this done I will help you for sure. Do reach me on my mobile +353894316824 or WhatsApp (+919739093905)&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/5113066502660638816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/5113066502660638816?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5113066502660638816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5113066502660638816'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/10/configure-multi-subnet-always-on-in.html' title='Configure-Multiple-subnet-Always on-Availability-Group in Linux(CENTOS)'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinVIpCyuuEf8sgdpG75ZXfTcip8Xbowb7I616hQ1rD89r82rzwovV0r3_DdeVYPouiZ-fv5vq5fmKhyxOSnGByzQn5TAkXgErknE_tLqmvRxI9BYjZ021bfS90yu2PCEbmtkLZ96gFTTw/s72-w640-h92-c/osversion.GIF" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-2533923348579609504</id><published>2020-10-25T04:01:00.002+05:30</published><updated>2020-10-25T14:01:26.709+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALWAYS ON"/><title type='text'>Always ON Connection Time-out Errors</title><content type='html'>&lt;p&gt;Hi Mates,&lt;/p&gt;&lt;p&gt;Today I want to share my Analysis with respect to connection Time out Errors in ALWAYS ON.&amp;nbsp;&lt;/p&gt;&lt;p&gt;In my previous post I mentioned about how to go through Windows Cluster Logs&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.chiranjeevivamsydba.com/2020/10/my-availability-groups-got-affected-by.html&quot; target=&quot;_blank&quot;&gt;https://www.chiranjeevivamsydba.com/2020/10/my-availability-groups-got-affected-by.html&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Always ON is such a topic where we need to examine different logs and need to analyze them properly before coming to any conclusions.&lt;/p&gt;&lt;p&gt;Okay, Let me go through the issue. I got an incident from Application Team indicating they experienced some issues yesterday. When I enquired about the time they said it is at early Morning 3 AM.&lt;/p&gt;&lt;p&gt;At first, I checked if there were any Maintenance jobs running at that time as usually these are times when they run. However there were nothing running at that time.&lt;/p&gt;&lt;p&gt;My replicas are in a Multi-Subnet with 3 nodes in Each Data Center&lt;/p&gt;&lt;p&gt;When checked the Error Logs I could see below messages inside them and all of them were with 3 replicas in another DC.&lt;/p&gt;&lt;p&gt;2020-10-23 03:02:56.780 spid207s&amp;nbsp; &amp;nbsp; &amp;nbsp;A connection timeout has occurred on a previously established connection to availability replica &#39;XXXXXXX&#39;&amp;nbsp;&lt;/p&gt;&lt;p&gt;2020-10-23 03:02:56.870 spid295s&amp;nbsp; &amp;nbsp; &amp;nbsp;A connection timeout has occurred on a previously established connection to availability replica &#39;XXXXXXX&#39;&amp;nbsp;&lt;/p&gt;&lt;p&gt;2020-10-23 03:02:56.910 spid295s&amp;nbsp; &amp;nbsp; &amp;nbsp;A connection timeout has occurred on a previously established connection to availability replica &#39;XXXXXX&#39;&amp;nbsp;&lt;/p&gt;&lt;p&gt;2020-10-23 03:02:56.780 spid207s Always On Availability Groups connection with secondary database terminated for primary database &#39;ReportServerTempDB&#39; on the availability replica &#39;XXXXXX&#39; with Replica ID: {12769114-d890-4e2d-b4fa-7c346244be1e}.&amp;nbsp;&lt;/p&gt;&lt;p&gt;2020-10-23 03:02:56.780 spid299s&amp;nbsp; &amp;nbsp; &amp;nbsp;Always On Availability Groups connection with secondary database terminated for primary database &#39;ReportServer144&#39; on the availability replica &#39;XXXX&#39; with Replica ID: {12769114-d890-4e2d-b4fa-7c346244be1e}.&amp;nbsp;&lt;/p&gt;&lt;p&gt;So Now how will we troubleshoot this.&amp;nbsp;&lt;/p&gt;&lt;p&gt;1) Error Logs: Those are the Messages what I can see&lt;/p&gt;&lt;p&gt;2) Always ON Health Sessions(Extended Events): They too have the same messages of what I could see inside Error Logs.&amp;nbsp;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjJEb6EYhYfwBRRU9nG1ZwS4-flhWdId_Sdvlrso9jzdS9E96ehu1S8uvH2uWs2ylaLFjx42eiaA0LszsqWOJZrztS3vGT3PNatAuVw05olGYwTW0qUY8jjooqhXGjqfvFH5hihLqh6rA/s1839/Error_reporting.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;80&quot; data-original-width=&quot;1839&quot; height=&quot;28&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjJEb6EYhYfwBRRU9nG1ZwS4-flhWdId_Sdvlrso9jzdS9E96ehu1S8uvH2uWs2ylaLFjx42eiaA0LszsqWOJZrztS3vGT3PNatAuVw05olGYwTW0qUY8jjooqhXGjqfvFH5hihLqh6rA/w640-h28/Error_reporting.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;3) SQL Diagnostic Extended Event files: These are available only on Primary Replica and I use them a lot for Investigation Purposes.&amp;nbsp;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0ULYPxAM9rvmWoR34fGGh06x235tXD5sXjkJq04qYMPRsbuz_xku_t4pgp49-JC1jfI0ChJr0f3_QP2xL8ulFR_ptIbr4dBArgCfMM7LkG1D7EiNfOJJ89A91tuD7dOy9TskMbbiyuJk/s1811/sqldiag.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;308&quot; data-original-width=&quot;1811&quot; height=&quot;108&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0ULYPxAM9rvmWoR34fGGh06x235tXD5sXjkJq04qYMPRsbuz_xku_t4pgp49-JC1jfI0ChJr0f3_QP2xL8ulFR_ptIbr4dBArgCfMM7LkG1D7EiNfOJJ89A91tuD7dOy9TskMbbiyuJk/w640-h108/sqldiag.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;There are 2 things I would like to discuss here firstly at the highlighted part under component state we see it as Warning. Also it says we have something related to Blocking. I got an impression that Blocking was the culprit however the database is not on ReportServer or ReportServerTEMPDB which are the ones that got affected.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;4) System Health Session (Extended Events):&amp;nbsp; This is kind of redundant to that of SQL Diagnostic in this case even it says the same information to that of above.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;5) Windows Cluster Logs: We didn&#39;t have any Failover hence there is not much here apart from the below message.&amp;nbsp; (I understood a lot what are the messages that gets logged for Connection time out Errors but I can&#39;t post here as it deviates from the topic)&lt;/p&gt;&lt;p&gt;00001d1c.00002af8::2020/10/23-03:02:56.370 INFO&amp;nbsp; [RES] SQL Server Availability Group: [hadrag] SQL Server component &#39;query_processing&#39; health state has been changed from &#39;clean&#39; to &#39;warning&#39; at 2020-10-23 03:02:56.360&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Frankly Speaking none of the logs helped me to understand what is the real contributor for these Connection time outs. Also there were no snapshots(VSS) or Antivirus related stuff running at that time so we can rule out them too.&lt;/p&gt;&lt;p&gt;I then thought of reproducing the Errors on my Test machine and I did that using Networking Tools.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeRrwGRXurIaXwuqIrc2ogyQMZzMsueVbdRyuyxeTvIYHXVew4Q6KTHHUR61kvcxAmI-bDqpMgQ9a9JPFaX3z2K0RhhntzCxgZsXb1x8IOeHQxVOXP1Z09KbZOMelZri4YRb-dbWNh0N4/s1477/time+outs.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;441&quot; data-original-width=&quot;1477&quot; height=&quot;192&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeRrwGRXurIaXwuqIrc2ogyQMZzMsueVbdRyuyxeTvIYHXVew4Q6KTHHUR61kvcxAmI-bDqpMgQ9a9JPFaX3z2K0RhhntzCxgZsXb1x8IOeHQxVOXP1Z09KbZOMelZri4YRb-dbWNh0N4/w640-h192/time+outs.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As you can see I simulated the stuff and at the same time I could see the message&lt;/p&gt;&lt;p&gt;A connection timeout has occurred while attempting to establish a connection to availability replica &#39;XXXXXX&#39; with id [B4DF270A-D29D-451A-B2BD-4727323D7234]. Either a networking or firewall issue exists, or the endpoint address provided for the replica is not the database mirroring endpoint of the host server instance.&lt;/p&gt;&lt;p&gt;So How will I troubleshoot this? My Answer is try to run a light weight ping test from the source (primary replica) to Secondary servers and see if you are seeing any time outs&lt;/p&gt;&lt;p&gt;Below is the command what I made use of&amp;nbsp;&lt;/p&gt;&lt;p&gt;ping.exe -t 192.168.58.68|Foreach{&quot;{0} - {1}&quot; -f (Get-Date),$_} &amp;gt; D:\backups\192.168.58.68.txt&lt;/p&gt;&lt;p&gt;As you can see from the above image I got the output in to Notepad file. I would only recommend this if you are seeing connection time out messages quite frequently.&lt;/p&gt;&lt;p&gt;Hope you have Learned Something with this.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/2533923348579609504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/2533923348579609504?isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/2533923348579609504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/2533923348579609504'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/10/always-on-connection-time-out-errors.html' title='Always ON Connection Time-out Errors'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjJEb6EYhYfwBRRU9nG1ZwS4-flhWdId_Sdvlrso9jzdS9E96ehu1S8uvH2uWs2ylaLFjx42eiaA0LszsqWOJZrztS3vGT3PNatAuVw05olGYwTW0qUY8jjooqhXGjqfvFH5hihLqh6rA/s72-w640-h28-c/Error_reporting.PNG" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-4889395279042280070</id><published>2020-10-04T04:20:00.004+05:30</published><updated>2020-10-04T04:20:33.085+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALWAYS ON"/><title type='text'>My Availability Groups got Affected by Covid-19</title><content type='html'>&lt;p&gt;Hi Friends,&lt;/p&gt;&lt;p&gt;By looking at the title one might feel bit funny however eventually down the line you will feel it apt. This will be a lengthy post as I will show you how I performed detailed Investigation hence be little patient but I promise you will learn something new for sure.&lt;/p&gt;&lt;p&gt;Let me start the issue on Sunday early Morning I got a call at 6:30 stating that availability groups got affected but after 2 minutes I didn&#39;t receive any other call. Being Sunday I was little relaxed soon after 30 minutes I started getting calls on the same server this time I didn&#39;t took that easily and connected to the servers to see what&#39;s the issue.&amp;nbsp;&lt;/p&gt;&lt;p&gt;When I opened Cluster administrator I could see below state for one of the nodes&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihsFF-tKZoJVgnNMrxcMbuN1PSpasR66fqF4JGiaCM8elsC9p8A97POg7a97sTkRjL1FeGX-e5PUZ_6X517G5Lj6jwWm3znO2V_Ndz-swEEwvv57SlXpMNRbcTBLj_y5AlpiDNYEAbIS8/s502/Quaran1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;162&quot; data-original-width=&quot;502&quot; height=&quot;206&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihsFF-tKZoJVgnNMrxcMbuN1PSpasR66fqF4JGiaCM8elsC9p8A97POg7a97sTkRjL1FeGX-e5PUZ_6X517G5Lj6jwWm3znO2V_Ndz-swEEwvv57SlXpMNRbcTBLj_y5AlpiDNYEAbIS8/w640-h206/Quaran1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;By looking at this I was surprised to see one of my nodes (Primary Replica) went in to Quarantine state. My first impression was that My AG got affected (of course not by Covid-19). I read the concept of Windows nodes getting quarantined and it has been introduced from windows 2016. I ran the command&amp;nbsp;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: #ffa400;&quot;&gt;Start-ClusterNode –ClearQuarantine&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;and after few seconds everything went normal.&lt;/p&gt;&lt;p&gt;So what is Quarantine?&amp;nbsp;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;It is not desirable to have a node constantly falling in and
out of cluster membership, which is likely caused by some underlying
configuration or hardware issues. This “flapping” of membership can cause
resources to move constantly between nodes, resulting in service interruption.
Thus Windows Server 2016 introduces the Quarantine logic to stop this from
happening.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #04ff00;&quot;&gt;Quarantine is triggered for a node if the node ungracefully
leaves the cluster three times within an hour. By default, that node will stay
in Quarantine state for 2 hours, during which time it is not allowed to rejoin
the cluster nor host cluster resources&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Not only Humans even the nodes are supposed to go in to Quarantine state.&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Now let me share the Environment details, we have 3 nodes in one Data Center and 3 in other Data Center and File share witness as we have even number of nodes.&lt;/p&gt;&lt;p&gt;Below is the Log information for SQL Server:&lt;/p&gt;&lt;p&gt;2020-09-27 09:23:29.410 spid29s&amp;nbsp; &amp;nbsp; &amp;nbsp; Failed to update Replica status within the local Windows Server Failover Clustering (WSFC) due to exception 41034.&lt;/p&gt;&lt;p&gt;2020-09-27 09:23:29.410 spid29s&amp;nbsp; &amp;nbsp; &amp;nbsp; Failed to update Replica status within the local Windows Server Failover Clustering (WSFC) due to exception 41005.&lt;/p&gt;&lt;p&gt;2020-09-27 09:23:29.900 Server&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Always On Availability Groups: Local Windows Server Failover Clustering node is no longer online. This is an informational message only. No user action is required.&lt;/p&gt;&lt;p&gt;2020-09-27 09:23:29.910 spid19s&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt; Always On: The availability replica manager is going offline because the local Windows Server Failover Clustering (WSFC) node has lost quorum.&lt;/b&gt; This is an informational message only. No user action is required.&lt;/p&gt;&lt;p&gt;2020-09-27 09:23:29.910 Server&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;The availability group &#39;XXXX&#39; is being asked to stop the lease renewal because the availability group is going offline. This is an informational message only. No user action is required.&lt;/p&gt;&lt;p&gt;2020-09-27 09:23:29.910 spid19s&amp;nbsp; &amp;nbsp; &amp;nbsp; Always On: The local replica of availability group &#39;XXXX&#39; is stopping. This is an informational message only. No user action is required.&lt;/p&gt;&lt;p&gt;2020-09-27 09:23:29.910 spid19s&amp;nbsp; &amp;nbsp; &amp;nbsp; The state of the local availability replica in availability group &#39;UAE-AG&#39; has changed from &#39;PRIMARY_NORMAL&#39; to &#39;RESOLVING_NORMAL&#39;.&amp;nbsp; The state changed because the local instance of SQL Server is shutting down.&lt;/p&gt;&lt;p&gt;After some time( perhaps few seconds) the replica came back online without my intervention. Post that I could see below information inside my logs.&lt;/p&gt;&lt;p&gt;2020-09-27 09:24:45.060 spid19s&amp;nbsp; &amp;nbsp;&lt;b&gt; &amp;nbsp; Always On Availability Groups: Local Windows Server Failover Clustering node is online.&lt;/b&gt; This is an informational message only. No user action is required.&lt;/p&gt;&lt;p&gt;2020-09-27 09:24:45.970 Logon&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Error: 983, Severity: 14, State: 1.&lt;/p&gt;&lt;p&gt;2020-09-27 09:24:45.970 Logon&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Unable to access availability database &#39;XXXXXX&#39; because the database replica is not in the PRIMARY or SECONDARY role. Connections to an availability database is permitted only when the database replica is in the PRIMARY or SECONDARY role. Try the&lt;/p&gt;&lt;p&gt;2020-09-27 09:24:47.050 spid52&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;The state of the local availability replica in availability group &#39;UAE-AG&#39; has changed from &#39;RESOLVING_NORMAL&#39; to &#39;PRIMARY_PENDING&#39;.&amp;nbsp; The state changed because the availability group is coming online.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;2020-09-27 09:24:47.080 Server&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;The state of the local availability replica in availability group &#39;XXXXX&#39; has changed from &#39;PRIMARY_PENDING&#39; to &#39;PRIMARY_NORMAL&#39;.&lt;/p&gt;&lt;p&gt;As you can see the Availability Group went offline due to issues at Windows clustering level but it didn&#39;t failover to any other replica. you can find the Always ON Failover History using the below link&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.chiranjeevivamsydba.com/2020/01/always-on-failover-history.html&quot;&gt;https://www.chiranjeevivamsydba.com/2020/01/always-on-failover-history.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Let me show you the Windows Cluster logs at the same time. Interpreting the Cluster logs is not that simple as it is not our comfort Zone.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivHfA6g9iDlcwApUdzINXjoPSTh-hBUFXuO09lcBJiervt5Lr3YC7g1VqChiYDgtiPfZL4o_mWdvzkTd0HBU8434ptPFerE7lXL_CnknkF8cGWi3-LUTxTGBgRMkdB1O48Ez49TLYaEfI/s1073/Quaran2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;197&quot; data-original-width=&quot;1073&quot; height=&quot;118&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivHfA6g9iDlcwApUdzINXjoPSTh-hBUFXuO09lcBJiervt5Lr3YC7g1VqChiYDgtiPfZL4o_mWdvzkTd0HBU8434ptPFerE7lXL_CnknkF8cGWi3-LUTxTGBgRMkdB1O48Ez49TLYaEfI/w640-h118/Quaran2.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;By looking at this we can say this is not the right Voting Mechanism as this being multi subnet the best recommendation is not to set votes for other site of the cluster as if there are any interruptions this will cause impact to the Availability Groups on the primary site.&lt;/p&gt;&lt;p&gt;This being Even number of nodes(6) we do have file share witness as a tie breaker.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK8_AgT07y5ClJTe6gMKh-Jw_R3c9jMLIAPXvhkm0p1w-yc4D3TMOLdYC5fKYCfpBs_iyhB4OQvcWxCM3f0bUaRaPI6Z10MiXDScUAY3ex0h9TkMy9VVyTP8KVIPkBCjIz6vJctf7usVo/s927/Quaran3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;112&quot; data-original-width=&quot;927&quot; height=&quot;78&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK8_AgT07y5ClJTe6gMKh-Jw_R3c9jMLIAPXvhkm0p1w-yc4D3TMOLdYC5fKYCfpBs_iyhB4OQvcWxCM3f0bUaRaPI6Z10MiXDScUAY3ex0h9TkMy9VVyTP8KVIPkBCjIz6vJctf7usVo/w640-h78/Quaran3.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As you can see from above in total we have 7 Votes so to have quorum intact we should have 4 votes.&lt;/p&gt;&lt;p&gt;When you are interpreting&amp;nbsp; cluster logs it has it&#39;s own language my first task is get the node names in the order what it thinks&lt;/p&gt;&lt;p&gt;&amp;lt;NODE id=&#39;1&#39; name=&#39;XXXXXXX2&#39;/&amp;gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;lt;NODE id=&#39;2&#39; name=&#39;XXXXXXX1&#39;/&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;NODE id=&#39;3&#39; name=&#39;XXXXXXX2&#39;/&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;NODE id=&#39;4&#39; name=&#39;XXXXXX01&#39;/&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;NODE id=&#39;5&#39; name=&#39;XXXXXXX3&#39;/&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;NODE id=&#39;7&#39; name=&#39;XXXXXXX3&#39;/&amp;gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;As you can see it thinks primary replica as NODE id=1 and then it skipped number 6 and other names lasted up to NODE id=7. With this in place we can easily break down the logs&lt;/p&gt;&lt;p&gt;Also if possible get the IPV6 address of each node as the cluster communicates with them&lt;/p&gt;&lt;p&gt;NODE4-&amp;gt;fe80::9471:eaf1:16b8:6f66(10.8.52.4)&lt;/p&gt;&lt;p&gt;NODE3-&amp;gt;fe80::8c93:1035:3a4f:89b0(10.8.52.5)&lt;/p&gt;&lt;p&gt;NODE7-&amp;gt;fe80::a12c:fd7f:95b3:ec7b(10.8.52.14)&lt;/p&gt;&lt;p&gt;NODE5&amp;gt;fe80::c83f:5276:425d:626f(10.7.52.14)&lt;/p&gt;&lt;p&gt;NODE2-&amp;gt;fe80::a1bd:2adc:3102:5cf4(10.7.52.4)&lt;/p&gt;&lt;p&gt;NODE1-&amp;gt;fe80::f9ff:6084:a429:4df8(10.7.52.5)&lt;/p&gt;&lt;p&gt;000026c4.00000068::2020/09/27-09:23:00.742 INFO&amp;nbsp; [IM] got event: LocalEndpoint 10.7.52.5:~3343~ has missed two-fifth consecutive heartbeats from 10.8.52.4:~3343~&lt;/p&gt;&lt;p&gt;000026c4.00000068::2020/09/27-09:23:00.757 INFO&amp;nbsp; [IM] got event: LocalEndpoint 10.7.52.5:~3343~ has missed two-fifth consecutive heartbeats from 10.8.52.5:~3343~&lt;/p&gt;&lt;p&gt;000026c4.00000068::2020/09/27-09:23:00.773 INFO&amp;nbsp; [IM] got event: LocalEndpoint 10.7.52.5:~3343~ has missed two-fifth consecutive heartbeats from 10.8.52.14:~3343~&lt;/p&gt;&lt;p&gt;The Cluster would communicate on port 3343 with the other nodes. In my case the primary replica (10.7.52.5) is not able to communicate with other side of the cluster nodes(10.8.52.4,10.8.52.5 and 10.8.52.14)&lt;/p&gt;&lt;p&gt;000026c4.000023f4::2020/09/27-09:23:02.008 &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;ERR&amp;nbsp; &amp;nbsp;[NODE] Node 1: Connection to Node 4 is broken.&lt;/span&gt;&lt;/b&gt; Reason (10060)&#39; because of &#39;channel to remote endpoint fe80::9471:eaf1:16b8:6f66%4:~3343~ has failed with status 10060&#39;&lt;/p&gt;&lt;p&gt;000026c4.000030b8::2020/09/27-09:23:02.009 &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;ERR&amp;nbsp; &amp;nbsp;[NODE] Node 1: Connection to Node 3 is broken&lt;/span&gt;&lt;/b&gt;. Reason (10060)&#39; because of &#39;channel to remote endpoint fe80::8c93:1035:3a4f:89b0%4:~3343~ has failed with status 10060&#39;&lt;/p&gt;&lt;p&gt;000026c4.00003094::2020/09/27-09:23:02.040 &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;ERR&amp;nbsp; &amp;nbsp;[NODE] Node 1: Connection to Node 7 is broken&lt;/span&gt;&lt;/b&gt;. Reason (10060)&#39; because of &#39;channel to remote endpoint fe80::a12c:fd7f:95b3:ec7b%4:~3343~ has failed with status 10060&#39;&lt;/p&gt;&lt;p&gt;so it says the connection is broken due to missing heartbeats. Then it tries to establish the connection with other dynamic ports but it was not able to make it.&lt;/p&gt;&lt;p&gt;000026c4.00001774::2020/09/27-09:23:09.847 INFO&amp;nbsp; [SV] New real route: local (10.7.52.5:~3343~) to &lt;b&gt;remote&amp;nbsp; (10.8.52.4:~57315~).&lt;/b&gt;&lt;/p&gt;&lt;p&gt;000026c4.00001774::2020/09/27-09:23:09.847 INFO&amp;nbsp; [SV] Got a new incoming stream from 10.8.52.4:~57315~&lt;/p&gt;&lt;p&gt;000026c4.00001774::2020/09/27-09:23:09.597 INFO&amp;nbsp; [SV] New real route: local (10.7.52.5:~3343~) to &lt;b&gt;remote&amp;nbsp; (10.8.52.5:~53800~).&lt;/b&gt;&lt;/p&gt;&lt;p&gt;000026c4.00001774::2020/09/27-09:23:09.597 INFO&amp;nbsp; [SV] Got a new incoming stream from 10.8.52.5:~53800~&lt;/p&gt;&lt;p&gt;000026c4.00001874::2020/09/27-09:23:09.566 INFO&amp;nbsp; [SV] New real route: local (10.7.52.5:~3343~) to &lt;b&gt;remote&amp;nbsp; (10.8.52.14:~63184~).&lt;/b&gt;&lt;/p&gt;&lt;p&gt;000026c4.00001874::2020/09/27-09:23:09.566 INFO&amp;nbsp; [SV] Got a new incoming stream from 10.8.52.14:~63184~&lt;/p&gt;&lt;p&gt;So you can see that it tried to establish the communication but eventually it failed and came up with below messages&lt;/p&gt;&lt;p&gt;000026c4.00000068::2020/09/27-09:23:12.732 WARN&amp;nbsp; [NDP&lt;span style=&quot;color: #800180;&quot;&gt;] &lt;b&gt;All routes for route (virtual) local fe80::f9ff:6084:a429:4df8:~0~ to remote fe80::9471:eaf1:16b8:6f66:~0~ are down&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;000026c4.00000068::2020/09/27-09:23:12.748 WARN&amp;nbsp; [NDP] &lt;span style=&quot;color: #800180;&quot;&gt;&lt;b&gt;All routes for route (virtual) local fe80::f9ff:6084:a429:4df8:~0~ to remote fe80::8c93:1035:3a4f:89b0:~0~ are down&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;000026c4.00000068::2020/09/27-09:23:12.764 WARN&amp;nbsp; [NDP]&lt;b&gt;&lt;span style=&quot;color: #800180;&quot;&gt; All routes for route (virtual) local fe80::f9ff:6084:a429:4df8:~0~ to remote fe80::a12c:fd7f:95b3:ec7b:~0~ are down&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;So it tried her best to establish but after trying all the routes it finally says there is no route as all the routes got exhausted which means one side of the cluster is not able to communicate with other side.&lt;/p&gt;&lt;p&gt;000026c4.000011dc::2020/09/27-09:23:18.019 INFO&amp;nbsp; [CORE] Node 1: Proposed View is &amp;lt;ViewChanged joiners=() downers=(3 4 7) inExtendedGrace=() newView=22505(1 2 5) oldView=22302(1 2 3 4 5 7) joiner=false form=false/&amp;gt;&lt;/p&gt;&lt;p&gt;After that it re-arranges her self with downers and joiners information as you can see in my case the other side of the cluster(3,4,7) are down and only left were (1,2,5). Now as I told you earlier we do have file share witness in place which should help us in these kind of scenarios. Remember this being ungraceful we will not have the concept of last man standing.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now this is the most critical part&amp;nbsp;&lt;/p&gt;&lt;p&gt;00001644.00001fc4::2020/09/27-09:23:28.331 INFO&amp;nbsp; [RES] File Share Witness &amp;lt;File Share Witness&amp;gt;: Releasing temporary lock on witness file share.&lt;/p&gt;&lt;p&gt;00000c20.00002518::2020/09/27-09:23:28.332 INFO&amp;nbsp; [QUORUM] Node 5 CompareAndSetWitnessTag:&amp;nbsp;&lt;/p&gt;&lt;p&gt;Attempting to update witness tag (2020/04/03-08`23`05.525_146:2020/04/03-08`23`05.525_146:34575) to 2020/04/03-08`23`05.525_145:2020/04/03-08`23`05.525_145:34576.&lt;/p&gt;&lt;p&gt;00000c20.00002518::2020/09/27-09:23:28.332 WARN&amp;nbsp; [QUORUM] Node 5 CompareAndSetWitnessTag:&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;witness tag (2020/04/03-08`23`05.525_146:2020/04/03-08`23`05.525_146:34575) is better than proposed tag (2020/04/03-08`23`05.525_145:2020/04/03-08`23`05.525_145:34576).&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;00000c20.00002518::2020/09/27-09:23:28.332 INFO&amp;nbsp; [QUORUM] Node 5 CompareAndSetWitnessTag: releasing witness share lock&lt;/p&gt;&lt;p&gt;00001644.00001fc4::2020/09/27-09:23:28.332 INFO&amp;nbsp; [RES] File Share Witness &amp;lt;File Share Witness&amp;gt;: Ignoring request to release witness share because it is not currently locked.&lt;/p&gt;&lt;p&gt;My Quorum is there on primary site however as per above logs it failed to obtain the lock as other node was successful in getting the lock which resulted in loss of Quorum.&amp;nbsp;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD0BlrmCPMYsljavg58__Nk8C00Nh3ZZ3ARknUXj6Qt5IHNFKNgCag2sYJ-u0mqqsVj5a94oMHths0G5cW5eGNFxG8OV3zB9RTI-E_wqvopoDU39oU9m7bgDycuThrVNCRMpxo3jxaIgk/s830/Quaran4.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;436&quot; data-original-width=&quot;830&quot; height=&quot;336&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD0BlrmCPMYsljavg58__Nk8C00Nh3ZZ3ARknUXj6Qt5IHNFKNgCag2sYJ-u0mqqsVj5a94oMHths0G5cW5eGNFxG8OV3zB9RTI-E_wqvopoDU39oU9m7bgDycuThrVNCRMpxo3jxaIgk/w640-h336/Quaran4.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;As you can see from the above screen shot my file share witness doesn&#39;t have the latest copy if this would have been disk witness we could have definitely avoided the issue.&amp;nbsp;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;00000c20.000014f4::2020/09/27-09:23:28.332 INFO&amp;nbsp; [QUORUM] Node 5: death timer is already running, 79 seconds left.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;00000c20.00002518::2020/09/27-09:23:28.332 &lt;b&gt;WARN&amp;nbsp; Arbitration failed with error code 995, not emitting QuorumArbitratred message&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;00000c20.00002518::2020/09/27-09:23:28.332 &lt;b&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;ERR&amp;nbsp; &amp;nbsp;Shutting down because arbitration failed (status = 5925)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;000007d8.00002f28::2020/09/27-09:23:28.332 &lt;b&gt;WARN&amp;nbsp; [RHS] Cluster service has terminated. Cluster.Service.Running.Event got signaled.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;000026c4.00000718::2020/09/27-09:23:28.366 ERR&amp;nbsp; &amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;[NODE] Node 1: Connection to Node 5 is broken. &lt;/span&gt;&lt;/b&gt;Reason (10054)&#39; because of &#39;channel to remote endpoint fe80::c83f:5276:425d:626f%4:~3343~ has failed with status 10054&#39;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;000026c4.000011dc::2020/09/27-09:23:29.391 &lt;b&gt;ERR&amp;nbsp; &amp;nbsp;[QUORUM] Node 1: Lost quorum (1 2)&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;000026c4.000011dc::2020/09/27-09:23:29.391 &lt;b&gt;ERR&amp;nbsp; &amp;nbsp;[QUORUM] Node 1: goingAway: 0, core.IsServiceShutdown: 0&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Now when it comes to voting we already lost 3 votes due to missing heart beats on other site followed by file share witness and one of the nodes in same site means we are left with just 2 votes&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;We can see from the above messages that file share witness was obtained by another site as a result we lost our quorum&amp;nbsp; and there after to avoid split brain one of the nodes terminated the cluster service.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;soon After it got recovered on it&#39;s own. After 30 minutes again I got the below messages inside SQL logs&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;2020-09-27 09:55:44.940 spid26s&amp;nbsp; &amp;nbsp; &amp;nbsp; Failed to update Replica status within the local Windows Server Failover Clustering (WSFC) due to exception 41034.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2020-09-27 10:01:22.340 spid208s&amp;nbsp; &amp;nbsp; &amp;nbsp;Failed to update Replica status within the local Windows Server Failover Clustering (WSFC) due to exception 41034.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As I mentioned above if a node ungracefully leaves 3 times in an hour which in my case (9:23, 9:55 and 10:01) the node will go in to Quarantine state.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now I hope you will agree with the Title. Also the solution what I ran i.e.&lt;b&gt;&lt;span style=&quot;color: #ffa400;&quot;&gt;Start-ClusterNode –ClearQuarantine&amp;nbsp;&lt;/span&gt;&lt;/b&gt;might not work in all cases. Hence I would suggest you to try to this as a last resort.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In case if you have any queries or comments do reach me on +353894316824/+919739093905(WhatsApp)&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/4889395279042280070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/4889395279042280070?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/4889395279042280070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/4889395279042280070'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/10/my-availability-groups-got-affected-by.html' title='My Availability Groups got Affected by Covid-19'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihsFF-tKZoJVgnNMrxcMbuN1PSpasR66fqF4JGiaCM8elsC9p8A97POg7a97sTkRjL1FeGX-e5PUZ_6X517G5Lj6jwWm3znO2V_Ndz-swEEwvv57SlXpMNRbcTBLj_y5AlpiDNYEAbIS8/s72-w640-h206-c/Quaran1.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-6967897667208061256</id><published>2020-09-14T20:20:00.007+05:30</published><updated>2020-10-09T15:15:41.418+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALWAYS ON"/><title type='text'>Are Our Secondary Replicas Really Synchronous?</title><content type='html'>&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&amp;nbsp;Hi Friends,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;This is very simple post and explores the new setting of what we have on
SQL Server 2017. I would like to thank David Fowler as it is inspiration from
his blog&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;Okay, let us begin by understanding what Synchronous really means?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&amp;nbsp;Hi Friends,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;This is very simple post and explore the new setting of what we have on
SQL Server 2017.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;Okay, let us begin by understanding what Synchronous really means?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;Normally, if we have got a secondary replica in synchronous commit mode,
our primary cannot commit any transactions until that transaction has been
hardened to disk on all the synchronous secondaries.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;When you commit a transaction on the primary, SQL Server will send all
changes over to its secondary nodes. It will then wait for confirmation from
the synchronous nodes that the changes have been hardened before it can commit
locally.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;This ensures that those synchronous secondaries are always up to date
and will mean that in the event of a fail over, there is no risk of data loss.
Any delay in the secondary writing down those changes will mean a delay on
committing on the primary (you will see this in the form of HADR_SYNC_COMMIT
waits on the primary).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;The primary replica is constantly monitoring the state of its
secondaries. With the use of continuous ping, the primary node always knows if
the secondaries are up or down.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;It is when SQL detects that one of its synchronous replicas goes offline
is when interesting things can happen.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;So, here is the discussion that came up, if a synchronous replica goes
offline for whatever reason, SQL won’t be able to commit any transactions and
that means we can be confident that the secondary is up to date, right?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;Well, not quite. Let us try running the following code to simply update
a table with a timestamp every second.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;We have 3 replicas running on Microsoft SQL Server 2017 (RTM-CU18) and
all of them are in synchronous Mode.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;I started testing&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;synctest&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;sname&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;TRUNCATE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;SyncTest&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;WHILE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;BEGIN&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;INTO&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;synctest&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;VALUES&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;WAITFOR&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;DELAY&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;&#39;00:00:01&#39;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;synctest&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;After a short while I Stopped SQL Services on one of the secondary
replicas and here are the results&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXqyFN6Rt3cS3NERe8O6urhY4tgf6X2q1V3OWUcGQcZxVo8t_7bOc_vnbdWAjpAc_PyLaAjfF7nEbTEkq26saI7xGz4i2RylVJarYUytEVQkW4IFplBhGmO29n3RaApQqcHOqCi7e55ns/s237/time1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;237&quot; data-original-width=&quot;132&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXqyFN6Rt3cS3NERe8O6urhY4tgf6X2q1V3OWUcGQcZxVo8t_7bOc_vnbdWAjpAc_PyLaAjfF7nEbTEkq26saI7xGz4i2RylVJarYUytEVQkW4IFplBhGmO29n3RaApQqcHOqCi7e55ns/s0/time1.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;
&lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;
&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 10.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;There were no records
for 10 seconds&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 10.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;Interesting, we can see that there was a delay when the synchronous
secondary went offline as we would expect. But then after a short while, it
looks like SQL Server decided to continue committing transactions. Is that
right?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;Session-Timeout&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;And here is where the
misinterpretation came in. Availability groups have a
setting,&amp;nbsp;session-timeout.&amp;nbsp;&amp;nbsp;This timeout controls how long a
primary replica will wait to receive a ping from a secondary (by default, this
is 10 seconds). Once that timeout period is exceeded, the primary will no
longer wait for that replica when committing a transaction, effectively
switching it to asynchronous commit.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;This is the reason why, after 10 seconds of the secondary going down, we
start to see transactions being committed again.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;So, My Question is how will we ensure that we can avoid this
situation?&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;SQL Server 2017 introduced&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background: #F2F2F2; color: #171717; font-family: Consolas; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&amp;nbsp;cluster
resource setting.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;This setting guarantees the specified number of secondary replicas write
the transaction data to log before the primary replica commits each transaction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD5wYXDcX9GxyJjgcciARWE-6Chmo0YeRBzYkKO9_vRvQI1LZ9ei05MGgcAWRJjTRrJQvWCg-c7y3YPZNSXj7SR9bMn0NwbkI2iu6Q85rav7egqAUz1qw7ST8jqfQr-DtAB-pXiTljv7o/s327/required.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;26&quot; data-original-width=&quot;327&quot; height=&quot;50&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD5wYXDcX9GxyJjgcciARWE-6Chmo0YeRBzYkKO9_vRvQI1LZ9ei05MGgcAWRJjTRrJQvWCg-c7y3YPZNSXj7SR9bMn0NwbkI2iu6Q85rav7egqAUz1qw7ST8jqfQr-DtAB-pXiTljv7o/w640-h50/required.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;
&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 10.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;The default setting is Zero and I changed to one and carried out the
same exercise as above and still the results are same where we got 10 seconds
lag and the transactions continued post that.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;Finally, after changing this setting to 2 as expected the transactions
didn&#39;t run as the primary can&#39;t continue because the transactions can&#39;t get
hardened on to secondary. Below is the error message&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;(1 row affected)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;Remote harden of transaction &#39;INSERT&#39; (ID 0x0000000001677d4d
0000:0000081c) started at Sep 14 2020 2:03PM in database &#39;india&#39; at LSN
(36:2213:3) failed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 10.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;(1
row affected)&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 10.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;Msg
596, Level 21, State 1, Line 3&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 10.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;Cannot
continue the execution because the session is in the kill state.&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 10.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;Msg
0, Level 20, State 0, Line 3&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 10.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;&quot;&gt;A
severe error occurred on the current command.&amp;nbsp; The results, if any, should
be discarded.&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;So Now think about this setting and implement it as per your needs.
Below is the link which explains about the setting&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 24.3pt; margin-bottom: 13.2pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 10pt;&quot;&gt;&lt;a href=&quot;https://draft.blogger.com/blog/post/edit/7571776149258983219/6967897667208061256&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;





























































































&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 107%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/6967897667208061256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/6967897667208061256?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/6967897667208061256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/6967897667208061256'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/09/is-our-secondary-replicas-are-really.html' title='Are Our Secondary Replicas Really Synchronous?'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXqyFN6Rt3cS3NERe8O6urhY4tgf6X2q1V3OWUcGQcZxVo8t_7bOc_vnbdWAjpAc_PyLaAjfF7nEbTEkq26saI7xGz4i2RylVJarYUytEVQkW4IFplBhGmO29n3RaApQqcHOqCi7e55ns/s72-c/time1.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-1416314185540032504</id><published>2020-09-11T18:48:00.000+05:30</published><updated>2020-09-11T18:48:48.140+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALWAYS ON"/><title type='text'>Adding Distribution Database to Always ON</title><content type='html'>&lt;p&gt;Hi Friends,&lt;/p&gt;&lt;p&gt;Today I thought of checking how to add Distribution Database to Availability Group. Although we have Microsoft Document where we can get all the steps I tried this just to get my hands Dirty&lt;/p&gt;&lt;p&gt;By the way to configure this we need to have&amp;nbsp;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;SQL Server 2017 CU6 or&lt;/span&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;&amp;nbsp;SQL Server 2016 SP2-CU3.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;In my case we have 4 servers 2 of them are Distributor Servers one publisher and one Subscriber.&lt;/p&gt;&lt;p&gt;As I am majorly interested in testing I took the advantage of having same SQL Server Service Account and provided sysadmin permissions (which is not all required).&lt;/p&gt;&lt;p&gt;I have configured replication with minimal permissions and below is the link for the same.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://www.chiranjeevivamsydba.com/2019/01/configuring-transactional-replication.html&quot;&gt;https://www.chiranjeevivamsydba.com/2019/01/configuring-transactional-replication.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Some Important points to keep in Mind:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;1)&amp;nbsp;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;Publisher and distributor need to be on separate SQL Server instances&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;2)&lt;/span&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;If the listener for the availability group hosting the distribution database is configured to use a non-default port, then its required to setup an alias for the listener and the non-default port.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;3)&lt;/span&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;SSMS does not show Distribution Database as synchronizing/synchronized, when distribution database is added to an availability group.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span face=&quot;Segoe UI, SegoeUI, Helvetica Neue, Helvetica, Arial, sans-serif&quot; style=&quot;color: #171717;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;4)&lt;/span&gt;&lt;/span&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;Configuring distributor on the publisher needs to be done with scripts&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;5)&lt;/span&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;Configuring the AG for distribution databases can only be done through scripts.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;6)&lt;/span&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, SegoeUI, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #171717; font-size: 16px;&quot;&gt;Switching an existing distribution database to an AG is not supported&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;There are many more but I just highlighted few of them. Okay enough of Theory let&#39;s chip in to Action.&lt;/p&gt;&lt;p&gt;Here are the Steps: (you need to run by enabling SQLCMD MODE in SSMS)&lt;/p&gt;&lt;p&gt;:Connect NODE1&lt;/p&gt;&lt;p&gt;sp_adddistributor @distributor = @@ServerName, @password = &#39;XXXXXXXX&#39;&lt;/p&gt;&lt;p&gt;Go&amp;nbsp;&lt;/p&gt;&lt;p&gt;:Connect NODE2&lt;/p&gt;&lt;p&gt;sp_adddistributor @distributor = @@ServerName, @password = &#39;XXXXXXX&#39;&lt;/p&gt;&lt;p&gt;Go&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;-- Step2 - Configure the Distribution Database&lt;/p&gt;&lt;p&gt;:Connect NODE1&lt;/p&gt;&lt;p&gt;USE master&lt;/p&gt;&lt;p&gt;EXEC sp_adddistributiondb @database = &#39;DistributionDB&#39;, @security_mode = 1;&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;Alter Database [DistributionDB] Set Recovery Full&lt;/p&gt;&lt;p&gt;Go&lt;/p&gt;&lt;p&gt;Backup Database [DistributionDB] to Disk = &#39;Nul&#39;&lt;/p&gt;&lt;p&gt;Go&lt;/p&gt;&lt;p&gt;-- Step 3 - Create AG for the Distribution DB.&lt;/p&gt;&lt;p&gt;:Connect NODE1&lt;/p&gt;&lt;p&gt;USE [master]&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;CREATE ENDPOINT [Hadr_endpoint]&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;STATE=STARTED&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;FOR DATA_MIRRORING (ROLE = ALL, AUTHENTICATION = WINDOWS NEGOTIATE&lt;/p&gt;&lt;p&gt;, ENCRYPTION = REQUIRED ALGORITHM AES)&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;:Connect NODE2&lt;/p&gt;&lt;p&gt;USE [master]&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;CREATE ENDPOINT [Hadr_endpoint]&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;STATE=STARTED&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;FOR DATA_MIRRORING (ROLE = ALL, AUTHENTICATION = WINDOWS NEGOTIATE&lt;/p&gt;&lt;p&gt;, ENCRYPTION = REQUIRED ALGORITHM AES)&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;:Connect NODE1&lt;/p&gt;&lt;p&gt;-- Create the Availability Group&lt;/p&gt;&lt;p&gt;CREATE AVAILABILITY GROUP [DistributionDB_AG]&lt;/p&gt;&lt;p&gt;FOR DATABASE [DistributionDB]&lt;/p&gt;&lt;p&gt;REPLICA ON &#39;INODE1&#39;&lt;/p&gt;&lt;p&gt;WITH (ENDPOINT_URL = N&#39;TCP://NODE1.contoso.com:5022&#39;,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt; FAILOVER_MODE = AUTOMATIC,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt; AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt; BACKUP_PRIORITY = 50,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt; SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL),&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt; SEEDING_MODE = AUTOMATIC),&lt;/p&gt;&lt;p&gt;N&#39;NODE2&#39; WITH (ENDPOINT_URL = N&#39;TCP://NODE2.contoso.com:5022&#39;,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt; FAILOVER_MODE = AUTOMATIC,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt; AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt; BACKUP_PRIORITY = 50,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt; SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL),&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt; SEEDING_MODE = AUTOMATIC);&lt;/p&gt;&lt;p&gt;&amp;nbsp;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;:Connect NODE2&lt;/p&gt;&lt;p&gt;ALTER AVAILABILITY GROUP [DistributionDB_AG] JOIN&lt;/p&gt;&lt;p&gt;GO&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;ALTER AVAILABILITY GROUP [DistributionDB_AG] GRANT CREATE ANY DATABASE&lt;/p&gt;&lt;p&gt;Go&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;--STEP4 - Create the Listener for the Availability Group. This is very important.&lt;/p&gt;&lt;p&gt;:Connect NODE1&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;USE [master]&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;ALTER AVAILABILITY GROUP [DistributionDB_AG]&lt;/p&gt;&lt;p&gt;ADD LISTENER N&#39;LSNRTTU-DBA&#39; (&lt;/p&gt;&lt;p&gt;WITH IP&lt;/p&gt;&lt;p&gt;((N&#39;192.168.58.16&#39;, N&#39;255.255.255.0&#39;)) , PORT=1433);&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;-- STEP 5 - Enable SQLNode2 also as a Distributor&lt;/p&gt;&lt;p&gt;:CONNECT NODE2&lt;/p&gt;&lt;p&gt;EXEC sp_adddistributiondb @database = &#39;DistributionDB&#39;, @security_mode = 1;&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;--STEP 6 - On all Distributor Nodes Configure the Publisher Details&amp;nbsp;&lt;/p&gt;&lt;p&gt;:CONNECT NODE1&lt;/p&gt;&lt;p&gt;EXEC sp_addDistPublisher @publisher = &#39;NODE3&#39;, @distribution_db = &#39;DistributionDB&#39;,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;@working_directory = &#39;\\NODE1\repldata\&#39;&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;:CONNECT NODE2&lt;/p&gt;&lt;p&gt;EXEC sp_addDistPublisher @publisher = &#39;NODE3&#39;, @distribution_db = &#39;DistributionDB&#39;,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;@working_directory =&#39;\\NODE1\repldata\&#39;&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;-- SECTION 2 ---- CONFIGURE THE PUBLISHER SERVER&lt;/p&gt;&lt;p&gt;:CONNECT NODE3&lt;/p&gt;&lt;p&gt;EXEC sp_addDistributor @distributor = &#39;LSNRTTU-DBA&#39;, -- Listener for the Distribution DB.&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;@password = &#39;XXXXX&#39;&lt;/p&gt;&lt;p&gt;Go&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;-- SECTION 3 ---- CONFIGURE THE SUBSCRIBERS&amp;nbsp;&lt;/p&gt;&lt;p&gt;-- On Publisher, create the publication as one would normally do.&lt;/p&gt;&lt;p&gt;-- On the Secondary replicas of the Distribution DB, add the Subscriber as a linked server.&lt;/p&gt;&lt;p&gt;:CONNECT NODE2&lt;/p&gt;&lt;p&gt;EXEC master.dbo.sp_addlinkedserver @server = N&#39;NODE4&#39;, @srvproduct=N&#39;SQL Server&#39;&lt;/p&gt;&lt;p&gt;&amp;nbsp;/* For security reasons the linked server remote logins password is changed with ######## */&lt;/p&gt;&lt;p&gt;EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N&#39;NODE4&#39;,@useself=N&#39;True&#39;,@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL&lt;/p&gt;&lt;p&gt;As you can see from the above steps we configured Always ON for Distribution database using scripts.&lt;/p&gt;&lt;p&gt;We added publisher server using Listener Name instead of Server Name.&lt;/p&gt;&lt;p&gt;once you are done you can go ahead with traditional way of creating publication and subscription there is no change in this process.&lt;/p&gt;&lt;p&gt;After doing this I added rows to my article in publication and the rows got transmitted to subscriber .&lt;/p&gt;&lt;p&gt;Here are few things what I noted before fail over below are the jobs that got created&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhruruzdddQxt5HNIQ8I9l1nNn664e2tN-INguNWSc2rz_Vlja8WsLHKwmWP-TdajYQQrEu6hah0xEkyMuAZicgLA8hqZXt31BjccmJw__vOn9Lr5nrym1pArCWpkokOtOESyhAZu1d2tY/s1410/replicat1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;310&quot; data-original-width=&quot;1410&quot; height=&quot;140&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhruruzdddQxt5HNIQ8I9l1nNn664e2tN-INguNWSc2rz_Vlja8WsLHKwmWP-TdajYQQrEu6hah0xEkyMuAZicgLA8hqZXt31BjccmJw__vOn9Lr5nrym1pArCWpkokOtOESyhAZu1d2tY/w640-h140/replicat1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As per Microsoft Article the jobs should get created with Listener Name but in my case I could see them with server Names (I am not sure if I went Wrong some where)&lt;/p&gt;&lt;p&gt;After I initiated the fail-over the jobs got created on the secondary replica of the distribution Database&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVdoDVWowCzBSL76-stNo-RxiQEjF1WOi72U_vTpAK3eVUflog7UFttihXcs3AuUCO-NqvHEfCbeKq31CnAslYt93LKP8PsBu5pXmMML2yJb5BaoMhqk5o57Oj5-IYdo1aA_YR4o9i9Sk/s1414/replicat2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;280&quot; data-original-width=&quot;1414&quot; height=&quot;126&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVdoDVWowCzBSL76-stNo-RxiQEjF1WOi72U_vTpAK3eVUflog7UFttihXcs3AuUCO-NqvHEfCbeKq31CnAslYt93LKP8PsBu5pXmMML2yJb5BaoMhqk5o57Oj5-IYdo1aA_YR4o9i9Sk/w640-h126/replicat2.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you see the above image all the replication jobs got created at 13:16 instead of 12:25 on Primary replica. There is a new job by name &quot;Monitor and sync replication agent jobs&quot;&amp;nbsp; that helps us in failing over the jobs accordingly.&lt;/p&gt;&lt;p&gt;when we fail-over I got the below error however it ran on it&#39;s own after few seconds&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAyknouTwPRWiJPYYhjHLWvjf_KOIlg2lA13DZnwjMPMYZoyvGERXAeefIri8SidO9Kext5ZW5gaLGtmWCleWg_EZHyMs95uamu-cm7YWb-BegviRMconVfdN4O0ieZ3T1IGs8KC-ufTU/s1010/replicat3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;511&quot; data-original-width=&quot;1010&quot; height=&quot;324&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAyknouTwPRWiJPYYhjHLWvjf_KOIlg2lA13DZnwjMPMYZoyvGERXAeefIri8SidO9Kext5ZW5gaLGtmWCleWg_EZHyMs95uamu-cm7YWb-BegviRMconVfdN4O0ieZ3T1IGs8KC-ufTU/w640-h324/replicat3.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In my next post I will try to come up with configuring HA for Distribution, Publisher and Subscriber Databases. You can reach me on +91-9739093905 or +353894316824 for any help.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/1416314185540032504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/1416314185540032504?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/1416314185540032504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/1416314185540032504'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/09/adding-distribution-database-to-always.html' title='Adding Distribution Database to Always ON'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhruruzdddQxt5HNIQ8I9l1nNn664e2tN-INguNWSc2rz_Vlja8WsLHKwmWP-TdajYQQrEu6hah0xEkyMuAZicgLA8hqZXt31BjccmJw__vOn9Lr5nrym1pArCWpkokOtOESyhAZu1d2tY/s72-w640-h140-c/replicat1.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-5382620931248069301</id><published>2020-08-25T20:31:00.000+05:30</published><updated>2020-08-25T20:31:41.193+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Administration"/><title type='text'>Mysterious SQL Backups causing Blocking</title><content type='html'>&lt;p&gt;&amp;nbsp;Hi Friends,&lt;/p&gt;&lt;p&gt;I am sharing this post as it come across my Environment. From yesterday Morning we found our Backups are getting blocked. We always have Ola scripts in place and the backups are being done to File share.&lt;/p&gt;&lt;p&gt;At the same time we have Veeam File system backups too.&amp;nbsp; I was serving the on-call from Yesterday night and I got calls multiple times and all of them are related to backups getting blocked.&lt;/p&gt;&lt;p&gt;As you can see this is how it looks the user name being NT Authority.&amp;nbsp; By the way we don&#39;t have any SQL Servers running with Local system as Service Accounts.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj27SSE4hyQcbT_DcO38lq1iodFiReDLmddaxQyDf5AM1PAl8ngZshydlUXPDroUAYAktVAQ3RKFNbLopMl3tedU9YoXRqjmChfXMqozUC2iDe4PyTgnws6ddgaf1Cbq2g9wjC_j52-vj0/s1028/backup14.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;106&quot; data-original-width=&quot;1028&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj27SSE4hyQcbT_DcO38lq1iodFiReDLmddaxQyDf5AM1PAl8ngZshydlUXPDroUAYAktVAQ3RKFNbLopMl3tedU9YoXRqjmChfXMqozUC2iDe4PyTgnws6ddgaf1Cbq2g9wjC_j52-vj0/s640/backup14.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Then from where these are getting triggered and after&amp;nbsp; checking the logs I found something suspicious at the same time&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy20oMwZ32f1nxQqUBc6njOKmEsbJkrV5g28IkHruTtoydftjlRB3hy0M5eOpVdBohuPG6vmypVsdi7jb-jOawhUPXu7Md25JjDU0wf4G3n3kaEgooMs7Bz8lYRgHg-GpeKokeRPruksA/s943/backup20.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;153&quot; data-original-width=&quot;943&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy20oMwZ32f1nxQqUBc6njOKmEsbJkrV5g28IkHruTtoydftjlRB3hy0M5eOpVdBohuPG6vmypVsdi7jb-jOawhUPXu7Md25JjDU0wf4G3n3kaEgooMs7Bz8lYRgHg-GpeKokeRPruksA/s640/backup20.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNYeDXUBNb4fHi2FhSslETm0fK0tnNWxmHWGD48Yof9B1dG5a_QVqFuCXuJOGrU0Vtild-UVzij3dNb0gJM282wyTI-1xkzkzRNgo1V0nPg3fgUep51PTDRCquQ60G4dD8snNFt57D9ZI/s956/bckup21.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;436&quot; data-original-width=&quot;956&quot; height=&quot;292&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNYeDXUBNb4fHi2FhSslETm0fK0tnNWxmHWGD48Yof9B1dG5a_QVqFuCXuJOGrU0Vtild-UVzij3dNb0gJM282wyTI-1xkzkzRNgo1V0nPg3fgUep51PTDRCquQ60G4dD8snNFt57D9ZI/w640-h292/bckup21.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;As you can see from the above images it is indicating that something related to Shadow copy and VSSAudit(Volume Shadow Services) and later after checking with Windows Team I came to know that the antivirus software(SentinelOne) is causing this as it is trying to create VSS Snapshot for Databases.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;I always wonder why Windows team will not update DBA&#39;s team for this kind of activities. Anyways it is good learning lesson for me.&lt;/div&gt;&lt;p&gt;&lt;br style=&quot;text-align: left;&quot; /&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/5382620931248069301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/5382620931248069301?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5382620931248069301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/5382620931248069301'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/08/mysterious-sql-backups-causing-blocking.html' title='Mysterious SQL Backups causing Blocking'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj27SSE4hyQcbT_DcO38lq1iodFiReDLmddaxQyDf5AM1PAl8ngZshydlUXPDroUAYAktVAQ3RKFNbLopMl3tedU9YoXRqjmChfXMqozUC2iDe4PyTgnws6ddgaf1Cbq2g9wjC_j52-vj0/s72-c/backup14.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-4863464797916338406</id><published>2020-08-21T19:26:00.001+05:30</published><updated>2020-08-21T19:32:02.401+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure Managed Instance"/><title type='text'>Things to Remember on SQL Server Azure Managed Instance </title><content type='html'>&lt;div class=&quot;separator&quot;&gt;&amp;nbsp;Hi Mates,&lt;/div&gt;&lt;p&gt;This is my first article on Azure Managed Instance. Till now I didn&#39;t get the opportunity to work on Cloud however by God&#39;s grace finally I started working on it.&lt;/p&gt;&lt;p&gt;In this blog I would like to share my&amp;nbsp; few of my Observations&lt;/p&gt;&lt;p&gt;Just like in on-premises if we don&#39;t configure properly we&amp;nbsp; will have some negative impacts.&lt;/p&gt;&lt;p&gt;1) Backup compression is not enabled by default&lt;/p&gt;&lt;p&gt;2) Cost threshold for parallelism is 5&lt;/p&gt;&lt;p&gt;3)optimize for Adhoc Workloads is not enabled&lt;/p&gt;&lt;p&gt;4)MaxDop is Zero.&lt;/p&gt;&lt;p&gt;As many of you know we &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;can&#39;t stop/start/restart/Pause SQL Server instance&lt;/span&gt;&lt;/b&gt; and also we can&#39;t &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;set max/min Memory settings.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;One thing that surprised me a lot is&lt;b&gt; Instant file initialization is not enabled in MI&lt;/b&gt;. As I could see the below messages inside my error logs. If you have configured IFI then we will see Zeroing messages only for Log files but not for Data files.&lt;/p&gt;&lt;p&gt;Zeroing C:\WFRoot\DB24C.3\Fabric\work\Applications\Worker.CL_App15\work\data\7fb2af3e-4a45-4eed-9e7a-fcea65576681.mdf from page 33716224 to 33718272 (0x404f000000 to 0x4050000000)&lt;/p&gt;&lt;p&gt;Zeroing completed on C:\WFRoot\DB24C.3\Fabric\work\Applications\Worker.CL_App15\work\data\7fb2af3e-4a45-4eed-9e7a-fcea65576681.mdf (elapsed = 4 ms)&lt;/p&gt;&lt;p&gt;We can check if IFI is enabled or not by running the DMV or searching for the string in error logs like below&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgof3jr2fD29_LaY041CxJTDbH_If7kNWUL7VA-mxqs4xkQrsMzBmuGxgnhe2b9D8WMnjoX5_n4t0G2Y-NpVhfzeysybL4rbG-nJLWb9nnRdpeKMvvzs3SHzDo8wPhzc7g9APmUAUor_kA/s1560/ifi.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;228&quot; data-original-width=&quot;1560&quot; height=&quot;94&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgof3jr2fD29_LaY041CxJTDbH_If7kNWUL7VA-mxqs4xkQrsMzBmuGxgnhe2b9D8WMnjoX5_n4t0G2Y-NpVhfzeysybL4rbG-nJLWb9nnRdpeKMvvzs3SHzDo8wPhzc7g9APmUAUor_kA/w640-h94/ifi.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;When we run sys.dm_server_services on MI it will not give you any output which is Expected. I will try to figure out if there are any DMV&#39;S which runs only in on-premises but not on MI.&lt;/p&gt;&lt;p&gt;Until then Happy Reading.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/4863464797916338406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/4863464797916338406?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/4863464797916338406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/4863464797916338406'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/08/things-to-remember-on-sql-server-azure.html' title='Things to Remember on SQL Server Azure Managed Instance '/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgof3jr2fD29_LaY041CxJTDbH_If7kNWUL7VA-mxqs4xkQrsMzBmuGxgnhe2b9D8WMnjoX5_n4t0G2Y-NpVhfzeysybL4rbG-nJLWb9nnRdpeKMvvzs3SHzDo8wPhzc7g9APmUAUor_kA/s72-w640-h94-c/ifi.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-3553579038926573983</id><published>2020-08-21T03:46:00.001+05:30</published><updated>2020-08-21T03:46:12.081+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Partitioning"/><title type='text'>The Error that we should be cautious of while doing  partitioning switch in</title><content type='html'>&lt;p&gt;&amp;nbsp;Hi Friends,&lt;/p&gt;&lt;p&gt;This post is important if at all if you worked on Partitioning especially while performing Switch in.&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have a scenario where I need to partition an existing table which has data from 2007.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Below are the high level steps what I did&lt;/p&gt;&lt;p&gt;1) Adding filegroups&lt;/p&gt;&lt;p&gt;2) Adding files to each of the filegroups&lt;/p&gt;&lt;p&gt;3) create temporary&amp;nbsp; staging tables on the respective filegroups&lt;/p&gt;&lt;p&gt;4)Load the data from main table in to staging tables&lt;/p&gt;&lt;p&gt;5) truncate main table&lt;/p&gt;&lt;p&gt;6) create partition function and partition scheme&lt;/p&gt;&lt;p&gt;7) create check constraints on temporary staging tables&lt;/p&gt;&lt;p&gt;8) Disable NON Clustered index and Foreign keys if there are any on the source table&lt;/p&gt;&lt;p&gt;9) Switch in Data from Staging tables to main table&amp;nbsp;&lt;/p&gt;&lt;p&gt;while performing the final step I missed to create check constraint on one of the temporary staging tables and I didn&#39;t expect that will cause havoc&lt;/p&gt;&lt;p&gt;If you want you can play with the below demo (Thanks to Kendra Little)&lt;/p&gt;&lt;p&gt;CREATE DATABASE [PartitionThis]&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;ALTER DATABASE [PartitionThis]&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;MODIFY FILE ( NAME = N&#39;PartitionThis&#39;, SIZE = 256MB , MAXSIZE = 10GB , FILEGROWTH = 512MB );&lt;/p&gt;&lt;p&gt;ALTER DATABASE [PartitionThis]&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;MODIFY FILE ( NAME = N&#39;PartitionThis_log&#39;, SIZE = 128MB , FILEGROWTH = 128MB );&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;USE PartitionThis;&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;;WITH&amp;nbsp; &amp;nbsp; Pass0 AS ( SELECT&amp;nbsp; &amp;nbsp;1 AS C UNION ALL SELECT&amp;nbsp; &amp;nbsp;1),&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Pass1 AS ( SELECT&amp;nbsp; &amp;nbsp;1 AS C FROM&amp;nbsp; &amp;nbsp; &amp;nbsp;Pass0 AS A , Pass0 AS B),&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Pass2 AS ( SELECT&amp;nbsp; &amp;nbsp;1 AS C FROM&amp;nbsp; &amp;nbsp; &amp;nbsp;Pass1 AS A , Pass1 AS B),&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Pass3 AS ( SELECT&amp;nbsp; &amp;nbsp;1 AS C FROM&amp;nbsp; &amp;nbsp; &amp;nbsp;Pass2 AS A , Pass2 AS B),&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Pass4 AS ( SELECT&amp;nbsp; &amp;nbsp;1 AS C FROM&amp;nbsp; &amp;nbsp; &amp;nbsp;Pass3 AS A , Pass3 AS B),&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Pass5 AS ( SELECT&amp;nbsp; &amp;nbsp;1 AS C FROM&amp;nbsp; &amp;nbsp; &amp;nbsp;Pass4 AS A , Pass4 AS B),&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;tally AS ( SELECT&amp;nbsp; &amp;nbsp;row_number() OVER ( Order BY C ) AS N FROM Pass5 )&lt;/p&gt;&lt;p&gt;SELECT&amp;nbsp; N&lt;/p&gt;&lt;p&gt;INTO&amp;nbsp; &amp;nbsp; ph.tally&lt;/p&gt;&lt;p&gt;FROM&amp;nbsp; &amp;nbsp; tally&lt;/p&gt;&lt;p&gt;WHERE&amp;nbsp; &amp;nbsp;N &amp;lt;= 100000;&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;--Create the partition function: dailyPF&lt;/p&gt;&lt;p&gt;DECLARE @StartDay DATE=DATEADD(dd,-3,CAST(SYSDATETIME() AS DATE));&lt;/p&gt;&lt;p&gt;CREATE PARTITION FUNCTION DailyPF (DATETIME2(0))&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; AS RANGE RIGHT FOR VALUES&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; (@StartDay, DATEADD(dd,1,@StartDay), DATEADD(dd,2,@StartDay),&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;DATEADD(dd,3,@StartDay), DATEADD(dd,4,@StartDay) );&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;--Add filegroups.&lt;/p&gt;&lt;p&gt;--Number of filegroups = 1 + Number of boundary points&amp;nbsp;&lt;/p&gt;&lt;p&gt;--defined in partition function&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;ALTER DATABASE PartitionThis ADD FILEGROUP DailyFG1&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;ALTER DATABASE PartitionThis ADD FILEGROUP DailyFG2&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;ALTER DATABASE PartitionThis ADD FILEGROUP DailyFG3&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;ALTER DATABASE PartitionThis ADD FILEGROUP DailyFG4&lt;/p&gt;&lt;p&gt;GO&amp;nbsp;&lt;/p&gt;&lt;p&gt;ALTER DATABASE PartitionThis ADD FILEGROUP DailyFG5&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;ALTER DATABASE PartitionThis ADD FILEGROUP DailyFG6&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;--Add files to the filegroups&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;DECLARE @path NVARCHAR(256), @i TINYINT=1, @sql NVARCHAR(4000);&lt;/p&gt;&lt;p&gt;SELECT TOP 1 @path=LEFT(physical_name,LEN(physical_name)-4)&amp;nbsp;&lt;/p&gt;&lt;p&gt;FROM sys.database_files WHERE name=&#39;PartitionThis&#39;;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;WHILE @i &amp;lt;= 6&lt;/p&gt;&lt;p&gt;BEGIN&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;SET @sql=N&#39;ALTER DATABASE PartitionThis ADD FILE (name=DailyF&#39; + CAST(@i AS NCHAR(1))+&#39;,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt; filename=&#39;&#39;&#39; +&amp;nbsp; @path + N&#39;F&#39;+ CAST(@i AS NCHAR(1))+&#39;.ndf&#39; + &#39;&#39;&#39;,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt; size=128MB, filegrowth=256MB) TO FILEGROUP DailyFG&#39;+CAST(@i AS NCHAR(1))&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;--show the command we&#39;re running&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;RAISERROR (@sql,0,0)&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;--run it&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;EXEC sp_executesql @sql;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;SET @i+=1;&lt;/p&gt;&lt;p&gt;END&lt;/p&gt;&lt;p&gt;GO&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;--Create the partition scheme: dailyPS&amp;nbsp;&lt;/p&gt;&lt;p&gt;CREATE PARTITION SCHEME DailyPS&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;AS PARTITION DailyPF&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;TO (DailyFG1, DailyFG2, DailyFG3, DailyFG4, DailyFG5, DailyFG6);&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_MTDfowfqFAJ1Ipp2FDQLlGfnl_USmcpJvHzvbQz_wxStXbpxaNRH5VO-oCK6sHzLdrCjMlPXCCjwTXej7FxZZWDXQImE1Aut085N7wO5YSxWmEfe6SZgsi7zhLwm6hAxTuYPSel25GQ/s1631/partition100.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;126&quot; data-original-width=&quot;1631&quot; height=&quot;49&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_MTDfowfqFAJ1Ipp2FDQLlGfnl_USmcpJvHzvbQz_wxStXbpxaNRH5VO-oCK6sHzLdrCjMlPXCCjwTXej7FxZZWDXQImE1Aut085N7wO5YSxWmEfe6SZgsi7zhLwm6hAxTuYPSel25GQ/w640-h49/partition100.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;This is how the Data looks after we create partitioning with above Scripts.&lt;/p&gt;&lt;p&gt;Now I created temporary tables like below so that I can dump the data from main table to below staging tables&lt;/p&gt;&lt;p&gt;CREATE TABLE OrdersDaily_2 (&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderDate DATETIME2(0) NOT NULL,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderId int IDENTITY NOT NULL,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderName nvarchar(256) NOT NULL)&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;on [DailyFG2]&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;CREATE TABLE OrdersDaily_3 (&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderDate DATETIME2(0) NOT NULL,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderId int IDENTITY NOT NULL,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderName nvarchar(256) NOT NULL)&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;on [DailyFG3]&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;CREATE TABLE OrdersDaily_4 (&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderDate DATETIME2(0) NOT NULL,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderId int IDENTITY NOT NULL,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderName nvarchar(256) NOT NULL)&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;on [DailyFG4]&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;CREATE TABLE OrdersDaily_5 (&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderDate DATETIME2(0) NOT NULL,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderId int IDENTITY NOT NULL,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;OrderName nvarchar(256) NOT NULL)&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;on [DailyFG5]&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;set identity_insert ordersdaily_2 on&lt;/div&gt;&lt;div&gt;insert into OrdersDaily_2(orderdate,orderid,ordername) select * from OrdersDaily where OrderDate&amp;gt;=&#39;2020-08-17&#39; and OrderDate&amp;lt;&#39;2020-08-18&#39;&lt;/div&gt;&lt;div&gt;set identity_insert ordersdaily_2 off&lt;/div&gt;&lt;div&gt;GO&lt;/div&gt;&lt;div&gt;set identity_insert ordersdaily_3 on&lt;/div&gt;&lt;div&gt;insert into OrdersDaily_3(orderdate,orderid,ordername) select * from OrdersDaily where OrderDate&amp;gt;=&#39;2020-08-18&#39; and OrderDate&amp;lt;&#39;2020-08-19&#39;&lt;/div&gt;&lt;div&gt;set identity_insert ordersdaily_3 off&lt;/div&gt;&lt;div&gt;GO&lt;/div&gt;&lt;div&gt;set identity_insert ordersdaily_4 on&lt;/div&gt;&lt;div&gt;insert into OrdersDaily_4(orderdate,orderid,ordername) select * from OrdersDaily where OrderDate&amp;gt;=&#39;2020-08-19&#39; and OrderDate&amp;lt;&#39;2020-08-20&#39;&lt;/div&gt;&lt;div&gt;set identity_insert ordersdaily_4 off&lt;/div&gt;&lt;div&gt;GO&lt;/div&gt;&lt;div&gt;set identity_insert ordersdaily_5 on&lt;/div&gt;&lt;div&gt;insert into OrdersDaily_5(orderdate,orderid,ordername) select * from OrdersDaily where OrderDate&amp;gt;=&#39;2020-08-20&#39; and OrderDate&amp;lt;&#39;2020-08-21&#39;&lt;/div&gt;&lt;div&gt;set identity_insert ordersdaily_5 off&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After creating the temporary tables I truncated the data in the original table and we need to populate the data from the above staging tables. As said above if you want to perform this we need to create check constraints on staging tables otherwise it won&#39;t allow you to perform switch in.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;you can create them using the below script&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;ALTER TABLE ordersdaily_2&amp;nbsp; WITH CHECK ADD CONSTRAINT CKordersdaily_2&amp;nbsp; CHECK (OrderDate&amp;gt;=&#39;2020-08-17&#39; and OrderDate&amp;lt;&#39;2020-08-18&#39;)&lt;/div&gt;&lt;div&gt;ALTER TABLE ordersdaily_3&amp;nbsp; WITH CHECK ADD CONSTRAINT CKordersdaily_3&amp;nbsp; CHECK (OrderDate&amp;gt;=&#39;2020-08-18&#39; and OrderDate&amp;lt;&#39;2020-08-19&#39;)&lt;/div&gt;&lt;div&gt;ALTER TABLE ordersdaily_4&amp;nbsp; WITH CHECK ADD CONSTRAINT CKordersdaily_4&amp;nbsp; CHECK (OrderDate&amp;gt;=&#39;2020-08-19&#39; and OrderDate&amp;lt;&#39;2020-08-20&#39;)&lt;/div&gt;&lt;div&gt;ALTER TABLE ordersdaily_5&amp;nbsp; WITH CHECK ADD CONSTRAINT CKordersdaily_5&amp;nbsp; CHECK (OrderDate&amp;gt;=&#39;2020-08-20&#39; and OrderDate&amp;lt;&#39;2020-08-21&#39;)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally you can perform switch in&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;ALTER TABLE ordersdaily_2&amp;nbsp; SWITCH TO OrdersDaily PARTITION 2&lt;/div&gt;&lt;div&gt;ALTER TABLE ordersdaily_3 SWITCH TO OrdersDaily PARTITION 3&lt;/div&gt;&lt;div&gt;ALTER TABLE ordersdaily_4&amp;nbsp; SWITCH TO OrdersDaily PARTITION 4&lt;/div&gt;&lt;div&gt;ALTER TABLE ordersdaily_5&amp;nbsp; SWITCH TO OrdersDaily PARTITION 5&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To re-produce the error I deleted the last constraint using the below statement and ran the above 4 switch in statements.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;div&gt;alter table ordersdaily_5 drop constraint CKordersdaily_5&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As we missed the last constraint it will pop up the below error&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Msg 4904, Level 16, State 1, Line 6&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;ALTER TABLE SWITCH statement failed. The specified partition 2 of target table &#39;PartitionThis.dbo.OrdersDaily&#39; must be empty.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Based on this error we will definitely think that something went wrong and we will truncate the main table thinking that&amp;nbsp; table must be empty. &lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;But if we run truncate on main table by the time you will see there will be no data even on temporary staging tables. It means we lost the data altogether.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Conclusion: When you perform switch in and if you get any errors don&#39;t take any violent decisions just check what is the data that is present in your main table and if you check that you will find the data despite of errors.&lt;/b&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/3553579038926573983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/3553579038926573983?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/3553579038926573983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/3553579038926573983'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/08/the-error-that-we-should-be-cautious-of.html' title='The Error that we should be cautious of while doing  partitioning switch in'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_MTDfowfqFAJ1Ipp2FDQLlGfnl_USmcpJvHzvbQz_wxStXbpxaNRH5VO-oCK6sHzLdrCjMlPXCCjwTXej7FxZZWDXQImE1Aut085N7wO5YSxWmEfe6SZgsi7zhLwm6hAxTuYPSel25GQ/s72-w640-h49-c/partition100.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7571776149258983219.post-8146381099700513673</id><published>2020-08-18T00:42:00.004+05:30</published><updated>2020-08-18T00:52:17.848+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server clustering on Linux"/><title type='text'>Restore backup from Linux to windows</title><content type='html'>&lt;p&gt;Hi Friends,&lt;/p&gt;&lt;p&gt;This is very simple post and I am writing this as I got this question from one of the SQL Groups.&lt;/p&gt;&lt;p&gt;We all know that we can restore the backup from Windows to SQL Linux but how about vice versa.&lt;/p&gt;&lt;p&gt;Can we restore a backup of the database from Linux to Windows?&amp;nbsp;&lt;/p&gt;&lt;p&gt;Initially I thought because of different file system formats it is not possible but my assumption is completely wrong.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;we
can very well do it. Below is the version of my Linux(source: oracle virtual
box Guest)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhtyruiO7gZJFfZQKEmJloKaUTlDHdnn5P2oEZkbDp-mIPZjvT-cqsSCiPcR4oqXhy4CwWSWnU5wZB-3UiLmh6cILiGjvRFx8CkYxDpvhz37Myq3DXYjh_YZKN7uYo0LHbMXEDuBxxPbE/s668/Linux.GIF&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;96&quot; data-original-width=&quot;668&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhtyruiO7gZJFfZQKEmJloKaUTlDHdnn5P2oEZkbDp-mIPZjvT-cqsSCiPcR4oqXhy4CwWSWnU5wZB-3UiLmh6cILiGjvRFx8CkYxDpvhz37Myq3DXYjh_YZKN7uYo0LHbMXEDuBxxPbE/s640/Linux.GIF&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 13.5pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;u&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzP86gL6WH4-H5BD_SwvnAYiK046Y2WW_jIvs8iJetjxU_USOb5aJ8BzMFHQ4slMi8QSgnFsG5HM2cK489fXQBPCfnD4pEI5zU4FjrNRznJJzQzMnT3OsSculua992CtIz2kdSzH5K50/s668/Linux.GIF&quot;&gt;I restored it on
to my local laptop that is running on Windows 10 with SQL Server 2019&lt;/a&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 13.5pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis6JSYXAEMR8LVNuQa-LewiNXYdvDc9_E_lOY-v6X3DZFY19ROs8Lk5AqlE0FbD4KGNvDw1M17XKC5AZKIaCf-XjFXsEB7XfUcFReHSkCYCKcN-L7fkDoEQKPViK1Q33CM4S_DP4yX3Y4/s910/linux10.GIF&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;126&quot; data-original-width=&quot;910&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis6JSYXAEMR8LVNuQa-LewiNXYdvDc9_E_lOY-v6X3DZFY19ROs8Lk5AqlE0FbD4KGNvDw1M17XKC5AZKIaCf-XjFXsEB7XfUcFReHSkCYCKcN-L7fkDoEQKPViK1Q33CM4S_DP4yX3Y4/s640/linux10.GIF&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 12pt;&quot;&gt;This clearly
indicates that there will not be any issues I know this is not a great post but I just wanted to share this to make people aware as I didn&#39;t find any documentation.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;It&#39;s been long time for me to post something on SQL Linux after all my blog started with SQL Clustering on Linux(ubuntu) below is the link in case if needed.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;a href=&quot;https://www.chiranjeevivamsydba.com/2018/01/sql-server-clustering-on-linuxubuntu.html&quot;&gt;https://www.chiranjeevivamsydba.com/2018/01/sql-server-clustering-on-linuxubuntu.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzP86gL6WH4-H5BD_SwvnAYiK046Y2WW_jIvs8iJetjxU_USOb5aJ8BzMFHQ4slMi8QSgnFsG5HM2cK489fXQBPCfnD4pEI5zU4FjrNRznJJzQzMnT3OsSculua992CtIz2kdSzH5K50/s668/Linux.GIF&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzP86gL6WH4-H5BD_SwvnAYiK046Y2WW_jIvs8iJetjxU_USOb5aJ8BzMFHQ4slMi8QSgnFsG5HM2cK489fXQBPCfnD4pEI5zU4FjrNRznJJzQzMnT3OsSculua992CtIz2kdSzH5K50/s668/Linux.GIF&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlserverentire.blogspot.com/feeds/8146381099700513673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7571776149258983219/8146381099700513673?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/8146381099700513673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7571776149258983219/posts/default/8146381099700513673'/><link rel='alternate' type='text/html' href='http://sqlserverentire.blogspot.com/2020/08/restore-backup-from-linux-to-windows.html' title='Restore backup from Linux to windows'/><author><name>Chiranjeevi Vamsy</name><uri>http://www.blogger.com/profile/03454042524374427415</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhtyruiO7gZJFfZQKEmJloKaUTlDHdnn5P2oEZkbDp-mIPZjvT-cqsSCiPcR4oqXhy4CwWSWnU5wZB-3UiLmh6cILiGjvRFx8CkYxDpvhz37Myq3DXYjh_YZKN7uYo0LHbMXEDuBxxPbE/s72-c/Linux.GIF" height="72" width="72"/><thr:total>0</thr:total></entry></feed>