<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Brad Chen's SQL Server Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/bradchen/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/bradchen/feed.xml</link>
    <description>MS, SQL Server Support, Guidelines, Performance, Tips, Troubleshooting</description>
    <lastBuildDate>Sun, 22 Jul 2018 17:19:43 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>workaround for SQLNexus fail to import SQL 2016 trc file(SQLNexus ReadTrace匯入sql 2016 trc失敗)</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/workaround-for-sqlnexus-fail-to-import-sql-2016-trc-file</link>
      <pubDate>Mon, 23 Jul 2018 01:17:27 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=3305</guid>
      <description><![CDATA[workaround for SQLNexus fail to import SQL 2016 trc file(SQLNexus ReadTrace匯入sql 2016...]]></description>
      <content:encoded><![CDATA[workaround for SQLNexus fail to import SQL 2016 trc file(SQLNexus ReadTrace匯入sql 2016 trc失敗)

<hr />

<span style="color: #800000"><strong>Problem:</strong></span>

Readtrace (SQL Profiler TRC Files) Import failed.

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus05_importSql2016TrcFail.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus05_importSql2016TrcFail.png" alt="" width="1683" height="996" class="alignnone size-full wp-image-3315" /></a>

<strong><span style="color: #800000">Analysis:</span></strong>

from ReadTrace.log

07/23/18 00:32:50.485 [0X00001364] The major version number (13) in the <span style="color: #ff0000">trace file header is not a supported file version</span>.
07/23/18 00:32:50.485 [0X00001364] ERROR: <span style="color: #ff0000">Read of file header</span> for file C:\Temp\20180712110000\SQLSERVER-1_SQLDIAG__sp_trace.trc failed with operating system error 0x8007000D (<span style="color: #ff0000">The data is invalid</span>)
07/23/18 00:32:50.519 [0X00001364] *** ERROR: Attempt to initialize trace file reader failed with operating system error 0x8007000D (The data is invalid)
07/23/18 00:32:50.519 [0X00001364] Reads completed - Global Error Status 0xfffffffe
07/23/18 00:32:50.520 [0X00001364] Signaling worker threads to complete final actions.

<strong><span style="color: #800000">Possible Cause原因:</span></strong>

目前的版本RML ReadTrace無法匯入SQL Server 2016 trc

<span style="color: #800000"><strong>Workaround:</strong></span>

執行以下Powershell，將F:\Temp\20180707192503目錄下的trc檔變更版本號碼，改成舊版SQL Server
<pre># 目前的版本RML ReadTrace無法匯入SQL Server 2016 trc
# Workaround: Change the version in trc file

Write-Output "Change the version in trc file"
Get-Date

# The version information we want to write: 0x0A = 10 = SQLServer 2008
[Byte[]] $versionData = 0x0A
# The offset of the version information in the file
$offset = 390

$OutputPath = "F:\Temp\20180707192503"
Get-ChildItem $OutputPath -Filter *.trc| 
Foreach-Object {
 $trc = "$OutputPath\$_"
 [System.IO.FileMode] $open = [System.IO.FileMode]::OpenOrCreate
 $stream = New-Object System.IO.FileStream -ArgumentList $trc, $open
 $stream.Seek($offset, [System.IO.SeekOrigin]::Begin);
 $stream.Write($versionData, 0, $versionData.Length);
 $stream.Close()

Write-Output "Change Done $trc"
}</pre>
&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>SQLNexus and RML Utilities (ReadTrace) - SQL Server效能分析工具</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/sqlnexus-and-rml-utilities-readtrace-sql-server</link>
      <pubDate>Sat, 21 Jul 2018 03:41:10 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=3195</guid>
      <description><![CDATA[SQLNexus and RML Utilities (ReadTrace) - SQL Server效能分析工具

軟體下載與安裝方法



1.SQL Server Database...]]></description>
      <content:encoded><![CDATA[SQLNexus and RML Utilities (ReadTrace) - SQL Server效能分析工具

軟體下載與安裝方法

<hr />

1.SQL Server Database Engine

SQLNexus and RML需要SQL Server DB來儲存分析結果(可以使用SQL Server Express)

Microsoft SQL Server 2016 Service Pack 2 Express
<a href="https://www.microsoft.com/en-us/download/details.aspx?id=56840">https://www.microsoft.com/en-us/download/details.aspx?id=56840</a>

<a href="https://www.microsoft.com/downloads/details.aspx?FamilyId=B60CDFA3-732E-4347-9C06-2D1F1F84C342&amp;displaylang=en"></a>

2.Report Viewer

不同版本SQL Nexus，需要不同版本的Report Viewer

RML Utilities requires Report Viewer to run correctly and Report Viewer also has a few updates to be considered.
<table width="800" border="1">
<tbody>
<tr>
<td width="126">Report Viewer</td>
<td width="322"></td>
<td width="64"></td>
</tr>
<tr>
<td> 2008</td>
<td>Report Viewer 2008系統需求.Net Framework 2.0

Microsoft Report Viewer 2008 SP1 Redistributable <a href="https://www.microsoft.com/download/en/details.aspx?id=3841">https://www.microsoft.com/download/en/details.aspx?id=3841</a>

Security Update MS09-062
<a href="https://support.microsoft.com/kb/971119">https://support.microsoft.com/kb/971119</a>

Report Viewer Redistributable 2008 Service Pack 1 GDIPLUS.DLL Security Update
<a href="https://www.microsoft.com/en-us/download/details.aspx?id=3203">https://www.microsoft.com/en-us/download/details.aspx?id=3203</a></td>
<td></td>
</tr>
<tr>
<td>2010</td>
<td>Microsoft Report Viewer 2010 SP1 Redistributable Package <a href="https://www.microsoft.com/download/en/details.aspx?id=6610">https://www.microsoft.com/download/en/details.aspx?id=6610</a>

Update fixes several Report Viewer issues after you install Visual Studio 2010 Service Pack 1 (主要描述的就是要安裝下面那個連結)

<a href="https://support.microsoft.com/kb/2549864"> https://support.microsoft.com/kb/2549864 </a>

Update for Microsoft Visual Studio 2010 Service Pack 1 Report Viewer (KB2549864)
<a href="https://www.microsoft.com/en-us/download/details.aspx?id=27231">https://www.microsoft.com/en-us/download/details.aspx?id=27231</a>

Note If you have Microsoft Report Viewer 2010 SP1 Redistributable Package installed, install the file that is named "ReportViewer.exe." If you use Microsoft Visual Studio 2010 Service Pack 1, install the file that is named "VS10SP1-KB2549864-x86.exe."</td>
<td>遇到以下錯誤，需安裝Report Viewer 2010 SP1 Redistributable Package

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/reporter_error.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/reporter_error.jpg" alt="" width="427" height="274" class="alignnone size-full wp-image-3215" /></a>

&nbsp;

SQL Nexus的Reports有超連結，但是無法點選開啟報表，需安裝Report Viewer 2010 SP1 update(KB2549864)

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/reporter_error2.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/reporter_error2.png" alt="" width="634" height="360" class="alignnone size-full wp-image-3225" /></a></td>
</tr>
<tr>
<td>2015

Version=12.x.x.x</td>
<td>MICROSOFT REPORT VIEWER 2015 RUNTIME (12.0.2402.15)
<a href="https://www.microsoft.com/en-us/download/details.aspx?id=45496">https://www.microsoft.com/en-us/download/details.aspx?id=45496</a></td>
<td></td>
</tr>
<tr>
<td>&nbsp;

Version=13.0.0.0</td>
<td>SQL Server 2016 Feature Pack

<a href="https://www.microsoft.com/en-us/download/details.aspx?id=52676">https://www.microsoft.com/en-us/download/details.aspx?id=52676</a>

i. Download and install enu\x86\sqlsysclrtypes.msi

ii. Download and install enu\x86\reportviewer.msi</td>
<td>若沒有安裝正確會出現以下錯誤訊息

If you run sqlnexus.exe, Error "Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=13.0.0.0,'"</td>
</tr>
</tbody>
</table>
&nbsp;

3. Install RML Utilities (ReadTrace)

Description of the Replay Markup Language (RML) Utilities for SQL Server

<a href="https://support.microsoft.com/kb/944837">https://support.microsoft.com/kb/944837</a>
<h3 class="sbody-h3">How to obtain the RML Utilities for SQL Server</h3>
<span class="">The following files are available for download from the Microsoft Download Center:
</span>
<span class="text-base">The RML Utilities for SQL Server, x86 version</span>
<span><img class="graphic" src="https://support.microsoft.com/library/images/support/kbgraphics/public/en-us/download.gif" alt="Download " title="Download " /><a target="_self" href="https://www.microsoft.com/downloads/details.aspx?familyid=7edfa95a-a32f-440f-a3a8-5160c8dbe926&amp;displaylang=en" id="kb-link-1">Download the RMLSetup_X86.msi package now.</a></span>
<span class="text-base">The RML Utilities for SQL Server, x64 version</span>
<span><img class="graphic" src="https://support.microsoft.com/library/images/support/kbgraphics/public/en-us/download.gif" alt="Download " title="Download " /><a target="_self" href="https://www.microsoft.com/downloads/details.aspx?familyid=b60cdfa3-732e-4347-9c06-2d1f1f84c342&amp;displaylang=en" id="kb-link-2">Download the RMLSetup_AMD64.msi package now.</a></span>

只能安裝x86或x64其中一種版本，如果已經安裝x86版本，再安裝x64時則會跳出已經安裝過x86，所以無法繼續安裝

以Windows 2016, SQL 2016 Express為例，我安裝RMLSetup_AMD64.exe的x64版本

&nbsp;

4.Install SQL Nexus

Microsoft SQL Nexus

<a href="https://github.com/Microsoft/SqlNexus/releases">https://github.com/Microsoft/SqlNexus/releases</a>

Installation Steps
1.Download the latest binary files from Releases
2.Unzip the file to a local directory
3.Run <strong><span style="color: #0000ff">sqlnexus.exe</span></strong> to start SQL Nexus
Note: We don't recommend this tool to point to your production SQL Server.

第一次啟動SQL Nexus，會提示要連接到哪一個SQL Server Instance，連進去後會建立一個空的sqlnexus資料庫，此時若在UI介面上不改選其他資料庫，匯入分析log時(例如PSSDiag output folder)就會匯入此資料庫。

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus01.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus01.png" alt="" width="2206" height="393" class="alignnone size-full wp-image-3265" /></a>

5.分析方法

(1)事先建立好分析用的log DB或用SQL Nexus建立log DB

(2)匯入log

A.如果用PSSDiag收集log

使用SQL Nexus，選擇log DB，匯入PSSDiag收集後的output folder

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus02.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus02.png" alt="" width="168" height="141" class="alignnone wp-image-3275" /></a>

選擇PSSDiag output folder，如果要覆蓋上次匯入到目前選擇的DB，則可以勾選Drop Current DB Before Importing

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus03.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus03.png" alt="" width="608" height="255" class="alignnone wp-image-3285" /></a>

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus04.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/SQLNexus04.png" alt="" width="1692" height="685" class="alignnone size-full wp-image-3295" /></a>

B.如果只有收集SQL Trace (trc檔)

使用SQL Nexus，選擇log DB，匯入trc檔

或

用命令列匯入
Cd C:\Program Files\Microsoft Corporation\RMLUtils
ReadTrace.exe -S"(local)" -E -d"ReadTraceDB20161020213501" -I"D:\TEMP\SQLTraceFiles\2016-10-20_21-35-01\TPECDB08_20161020212501.trc" -o"D:\TEMP\SQLTraceFiles\2016-10-20_21-35-01\output"

修改參數
-d後面的資料庫名稱
-l要匯入第一個trc檔
-o指定一個執行匯入過程的紀錄檔目錄

匯入Import完成後自動啟動Reporter.exe顯示報表

&nbsp;

<a href="https://github.com/Microsoft/SqlNexus/releases"></a><strong><span style="color: #800000">Reference:</span></strong>

Cumulative Update 1 to the RML Utilities for Microsoft SQL Server Released
<a href="https://blogs.msdn.microsoft.com/psssql/2008/11/12/cumulative-update-1-to-the-rml-utilities-for-microsoft-sql-server-released/">https://blogs.msdn.microsoft.com/psssql/2008/11/12/cumulative-update-1-to-the-rml-utilities-for-microsoft-sql-server-released/</a>

Microsoft SQL Nexus

<a href="https://github.com/Microsoft/SqlNexus/releases">https://github.com/Microsoft/SqlNexus/releases</a>

Precision Performance FOR MICROSOFT SQL SERVER...
<a href="https://blogs.technet.com/b/patricg/archive/2008/01/11/precision-performance-for-microsoft-sql-server.aspx">https://blogs.technet.com/b/patricg/archive/2008/01/11/precision-performance-for-microsoft-sql-server.aspx</a>
PRB: RML Utilities - ReadTrace processing fails with &amp;quot;Attempt to use an invalid variant type
<a href="https://blogs.msdn.com/b/psssql/archive/2009/02/11/prb-rml-utilities-readtrace-processing-fails-with-attempt-to-use-an-invalid-variant-type.aspx">https://blogs.msdn.com/b/psssql/archive/2009/02/11/prb-rml-utilities-readtrace-processing-fails-with-attempt-to-use-an-invalid-variant-type.aspx</a>
SQL Nexus and RML Utilities: A primer on the issues that I have dealt with last year
<a href="https://blogs.msdn.com/b/sqlserverfaq/archive/2011/02/07/sql-nexus-and-rml-utilities-a-primer-on-the-issues-that-i-have-dealt-with-last-year.aspx">https://blogs.msdn.com/b/sqlserverfaq/archive/2011/02/07/sql-nexus-and-rml-utilities-a-primer-on-the-issues-that-i-have-dealt-with-last-year.aspx</a>]]></content:encoded>
    </item>
    <item>
      <title>What is ECMAScript ES (什麼是ECMAScript ES3,ES5)</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/what-is-ecmascript-es-%E4%BB%80%E9%BA%BC%E6%98%AFecmascript-es3es5</link>
      <pubDate>Thu, 12 Jul 2018 11:21:44 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=3165</guid>
      <description><![CDATA[What is ECMAScript ES (什麼是ECMAScript ES3,ES5)



1995年 Netscape...]]></description>
      <content:encoded><![CDATA[What is ECMAScript ES (什麼是ECMAScript ES3,ES5)

<hr />

1995年 Netscape Navigator網景的布蘭登·艾克開發的一種腳本語言的標準化規範；最初命名為Mocha，後來改名為LiveScript，一年後改名為JavaScript (PS.Javascript跟Java完全無關)

ECMAScript 網景在1996將Javascript提交給ECMA International歐洲電腦製造商協會，進行標準化，確認出這版語言標準

ECMAScript 2

ECMAScript 3 (ES3) 1999年發布後就長達10年沒有變動，中間是個各大瀏覽器廠商進行自己的語言延伸

ECMAScript 4 由於關於語言的複雜性出現分歧，第4版本被放棄，其中的部分成為了第5版本及Harmony的基礎

ECMAScript 5 (ES5) 2009年，此時大部分開發者仍然寫的ES3風格的javascript

有一說法是2012年因為推動停止舊版IE支援，開發者才開始大量使用ES5
ES 5之前的協定稱為ES.Harmony後來又改為ECMAScript 2015（ES2015）

&nbsp;

ECMAScript

<a href="https://en.wikipedia.org/wiki/ECMAScript">https://en.wikipedia.org/wiki/ECMAScript</a>]]></content:encoded>
    </item>
    <item>
      <title>Use the Maintenance Plan Wizard (使用維護計畫精靈)</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/use-the-maintenance-plan-wizard</link>
      <pubDate>Sun, 08 Jul 2018 15:31:44 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=3055</guid>
      <description><![CDATA[Use the Maintenance Plan Wizard (使用維護計畫精靈)



1.使用SSMS連線到SQL Server，在SQL Server...]]></description>
      <content:encoded><![CDATA[Use the Maintenance Plan Wizard (使用維護計畫精靈)

<hr />

1.使用SSMS連線到SQL Server，在SQL Server Instance&gt;管理&gt;維護計畫，按下右鍵，選擇[維護計畫精靈]

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan1.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan1.png" alt="" width="280" height="292" class="alignnone size-full wp-image-3095" /></a>

2.設定排程，建議在離峰時間執行，例如01:00，最少可以每周執行一次。<a href="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan3.png"></a>

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan2.jpg" alt="" width="398" height="430" class="alignnone size-full wp-image-3105" /></a>

&nbsp;

3.選擇需要定期執行的工作

如果您選擇了[重建索引]，就不需要勾選[更新統計資料]，因為REBUILD(重建索引)會一併更新統計資料

<img src="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan3.png" alt="" width="480" height="534" class="alignnone size-full wp-image-3065" />

&nbsp;

4.針對上一個步驟所選擇的項目，勾選您的資料庫

以下是<span>[</span>重建索引工作<span>]</span>

<img src="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan4.jpg" alt="" width="466" height="481" class="alignnone size-full wp-image-3075" />

以下是[更新統計資料工作]

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan4.jpg"></a>

<span> </span> <a href="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan5.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/MaintenPlan5.jpg" alt="" width="460" height="475" class="alignnone size-full wp-image-3085" /></a>

&nbsp;

<strong><span style="color: #800000">Reference:</span></strong>

Use the Maintenance Plan Wizard (使用維護計畫精靈)
<a href="https://docs.microsoft.com/en-us/sql/relational-databases/maintenance-plans/use-the-maintenance-plan-wizard?view=sql-server-2017">https://docs.microsoft.com/en-us/sql/relational-databases/maintenance-plans/use-the-maintenance-plan-wizard?view=sql-server-2017</a>

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Frequently Asked Questions for PSSDiag Collection (PSSDiag收集常見問題)</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/frequently-asked-questions-for-pssdiag-collection-pssdiag%E6%94%B6%E9%9B%86%E5%B8%B8%E8%A6%8B%E5%95%8F%E9%A1%8C</link>
      <pubDate>Sat, 07 Jul 2018 17:27:40 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=2985</guid>
      <description><![CDATA[Frequently Asked Questions for PSSDiag Collection (PSSDiag收集常見問題)



Q1.如果你的SQL Server是在Windows...]]></description>
      <content:encoded><![CDATA[Frequently Asked Questions for PSSDiag Collection (PSSDiag收集常見問題)

<hr />

Q1.如果你的SQL Server是在Windows 2016環境，請先安裝.NET Framework 3.5 (include .NET 2.0 and 3.0)，不然會出現錯誤，無法收集

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_win2016.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_win2016.png" alt="" width="1589" height="528" class="alignnone size-full wp-image-2995" /></a>

Q2.如果出現這個錯誤 SQLDIAG There are no instances of version 13 on this computer

Possible Cause: 錯誤的pssdiag.zip檔。(version 13=SQL2016, version 12=SQL2014, version 11=SQL2012)

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_no_instance.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_no_instance.png" alt="" width="1620" height="559" class="alignnone size-full wp-image-3005" /></a>

Answer 2:下載正確SQL版本的pssdiag.zip檔

或

Answer 3 :如果你的下載的版本正確

解法1:

修改pssdiag收集設定檔 F:\pssdiag\pssdiag.xml，

找到&lt;Instance name="*" user="" windowsauth="true" ssver="13"&gt;

把ssver="13"改成ssver="*" ，並且要指定Instance

&lt;Instance name="<span style="color: #0000ff">MSSQLServer</span>" user="" windowsauth="true" ssver="<span style="color: #0000ff">*</span>"&gt;

解法2

到以下機碼找到版本號碼

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQLServer\CurrentVersion  <a href="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_no_instance_fix2.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_no_instance_fix2.png" alt="" width="1343" height="413" class="alignnone size-full wp-image-3025" /></a>

修改pssdiag收集設定檔 F:\pssdiag\pssdiag.xml，

找到&lt;Instance name="*" user="" windowsauth="true" ssver="13"&gt;

把ssver="13"改成你找到的版本號碼，例如 ssver="13.2"

或

Answer 4 :如果SQL Server是failover Cluster instance，

Machine name="." 要改成virtual server name (也就是SQL Cluster的Network Name)
Instance name="*"要改成instance name. 如果是 default instance則輸入MSSQLSERVER

&nbsp;

Q3.如果出現這個錯誤 SQLDIAG There are no instance named as SQLEXPRESS

表示pssdiag收集設定檔 F:\pssdiag\pssdiag.xml 裡面指定的Instance name不存在。

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_no_instance2.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_no_instance2.png" alt="" width="1807" height="587" class="alignnone size-full wp-image-3015" /></a>

A:修改pssdiag收集設定檔 F:\pssdiag\pssdiag.xml ，改成正確的SQL Server instance name

&nbsp;

&nbsp;

Q4.如果出現這個錯誤 Unable to find SQL Server client tools such as sqldiag.exe from this machine. Data collection will fail.

如果指定ssver

&lt;Instance name="*" user="" windowsauth="true" ssver="<span style="color: #ff0000">13.2</span>"&gt;

則會出現此錯誤，然後停止收集

<a href="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_no_client_tool.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/07/pssdiag_no_client_tool.png" alt="" width="398" height="134" class="alignnone wp-image-3035" /></a>

Answer: 指定instance name

<span style="color: #0000ff">&lt;Instance name="<strong>MSSQLServer</strong>" user="" windowsauth="true" ssver="<strong>13.2</strong>"&gt;</span>

此時一樣會跳出錯誤，但是，最後還是回開始收集。

&nbsp;

若要解決不要一直跳出錯誤，workaround是修改pssdiag.cmd，直接指定SQL版本與sqldiag.exe的目錄

將

for /F "tokens=1,2 delims==~" %%i IN ('diagutil.exe') DO set sqlver=%%i
for /F "tokens=1,2 delims==~" %%i IN ('diagutil.exe') DO set toolsbin=%%j

改成

set sqlver=13
set toolsbin=C:\Program Files\Microsoft SQL Server\130\Tools\Binn\

&nbsp;

Q5.收集的log size大約多大?

以下面條件範例

(1)收集一個非常輕量負載的SQL 2016 Express instance

(2)PSSDiag勾選所有Performance選項，勾選SQL Trace，也就會同時收集xel與trc

收集5分鐘大約200MB (trc檔約80MB, xel檔約90MB)

&nbsp;

<strong><span style="color: #800000">Reference:</span></strong>

SQLDIAG: There are no instances of version 10 on this computer

<a href="https://blogs.msdn.microsoft.com/sqlserverfaq/2011/04/05/sqldiag-there-are-no-instances-of-version-10-on-this-computer">https://blogs.msdn.microsoft.com/sqlserverfaq/2011/04/05/sqldiag-there-are-no-instances-of-version-10-on-this-computer</a>

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Windows Server Performance Tuning Guidelines</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/windows-server-performance-tuning-guidelines</link>
      <pubDate>Sun, 20 May 2018 00:58:08 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=2905</guid>
      <description><![CDATA[Windows Server Performance Tuning Guidelines



&nbsp;



OS
Documents


Windows...]]></description>
      <content:encoded><![CDATA[Windows Server Performance Tuning Guidelines

<hr />

&nbsp;
<table border="1">
<tbody>
<tr>
<td><strong>OS</strong></td>
<td><strong>Documents</strong></td>
</tr>
<tr>
<td>Windows 2016</td>
<td>Performance Tuning Guidelines for Windows Server 2016
<a href="https://docs.microsoft.com/en-us/windows-server/administration/performance-tuning/">https://docs.microsoft.com/en-us/windows-server/administration/performance-tuning/</a></td>
</tr>
<tr>
<td>Windows 2012 R2</td>
<td>Performance Tuning Guidelines for Windows Server 2012 R2
<a href="https://www.microsoft.com/en-us/download/details.aspx?id=51960">https://www.microsoft.com/en-us/download/details.aspx?id=51960</a>Performance Tuning Guidelines for Windows Server 2012 R2https://www.microsoft.com/en-us/download/details.aspx?id=51960Performance Tuning
<a href="https://msdn.microsoft.com/en-us/library/windows/hardware/dn529133">https://msdn.microsoft.com/en-us/library/windows/hardware/dn529133</a></td>
</tr>
<tr>
<td>Windows 2012</td>
<td>Performance Tuning Guidelines for Windows Server 2012
<a href="https://download.microsoft.com/download/0/0/B/00BE76AF-D340-4759-8ECD-C80BC53B6231/performance-tuning-guidelines-windows-server-2012.docx">https://download.microsoft.com/download/0/0/B/00BE76AF-D340-4759-8ECD-C80BC53B6231/performance-tuning-guidelines-windows-server-2012.docx</a></td>
</tr>
<tr>
<td>Windows 2008 R2</td>
<td>Performance Tuning Guidelines for Windows Server 2008 R2
<a href="https://download.microsoft.com/download/6/B/2/6B2EBD3A-302E-4553-AC00-9885BBF31E21/Perf-tun-srv-R2.docx">https://download.microsoft.com/download/6/B/2/6B2EBD3A-302E-4553-AC00-9885BBF31E21/Perf-tun-srv-R2.docx</a></td>
</tr>
<tr>
<td>Windows 2008</td>
<td>Performance Tuning Guidelines for Windows Server 2008
<a href="https://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/Perf-tun-srv.docx">https://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/Perf-tun-srv.docx</a></td>
</tr>
</tbody>
</table>
&nbsp;

Performance Tuning Guidelines for previous versions of Windows Server
<a href="https://msdn.microsoft.com/en-us/library/windows/hardware/dn529134">https://msdn.microsoft.com/en-us/library/windows/hardware/dn529134</a>

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>The distribution agent failed to create temporary files in xxx directory. System returned errorcode 5 散發代理程式建立暫存檔失敗</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/the-distribution-agent-failed-to-create-temporary-files-in-xxx-directory-system-returned-errorcode-5</link>
      <pubDate>Tue, 01 May 2018 01:34:54 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=2815</guid>
      <description><![CDATA[The distribution agent failed to create temporary files in ... directory. System returned errorcode...]]></description>
      <content:encoded><![CDATA[The distribution agent failed to create temporary files in ... directory. System returned errorcode 5

散發代理程式建立暫存檔失敗

<hr />

<span style="color: #800000"><strong>Error: 錯誤訊息</strong></span>

當你修改了散發代理程式的處理帳號(執行帳號)

<span>When you change the Agent process account in the Distribution Agent Security </span>

<a href="https://msdnshared.blob.core.windows.net/media/2018/05/DistAgentProcessAccount.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/DistAgentProcessAccount.jpg" alt="" width="702" height="626" class="alignnone size-full wp-image-2825" /></a>

<a href="https://msdnshared.blob.core.windows.net/media/2018/05/ReplicationError_changeAgentAccount-2.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/ReplicationError_changeAgentAccount-2.png" alt="" width="1150" height="539" class="alignnone size-full wp-image-2845" /></a>

The <span style="color: #ff0000">distribution agent failed to create temporary files</span> in 'C:\Program Files\Microsoft SQL Server\110\COM' directory. System returned errorcode 5

<span style="color: #800000"><strong>Cause: 原因</strong></span>

新的執行帳號，對C:\Program Files\Microsoft SQL Server\110\COM 目錄沒有權限

<span style="color: #800000"><strong>Resolution: 解決方法</strong></span>

設定新的執行帳號對 C:\Program Files\Microsoft SQL Server\110\COM 目錄有寫入的權限

<strong><span style="color: #800000">Reference: 參考</span></strong>

Error message when you run the Distribution Agent in SQL Server 2008 or in SQL Server 2008 R2: "The distribution agent failed to create temporary files"
<a href="https://support.microsoft.com/en-us/help/956032/error-message-when-you-run-the-distribution-agent-in-sql-server-2008-o">https://support.microsoft.com/en-us/help/956032/error-message-when-you-run-the-distribution-agent-in-sql-server-2008-o</a>]]></content:encoded>
    </item>
    <item>
      <title>Replication Log Reader Agent Error "The principal dbo does not exist" 複寫記錄讀取器代理程式出現主體dbo不存在</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/replication-log-reader-agent-error-the-principal-dbo-does-not-exist</link>
      <pubDate>Tue, 01 May 2018 01:11:00 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=2755</guid>
      <description><![CDATA[Replication Log Reader Agent Error "The principal dbo does not exist"



設定SQL Server...]]></description>
      <content:encoded><![CDATA[Replication Log Reader Agent Error "The principal dbo does not exist"

<hr />

設定SQL Server Replication複寫時，Log Reader Agent複寫記錄讀取器代理程式出現以下錯誤

<strong><span style="color: #800000">Error: 錯誤訊息</span></strong>

<strong>Error messages:</strong>
<ul>
 	<li>The process could not execute 'sp_replcmds' on 'SQLPublisher'. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011)
Get help: https://help/MSSQL_REPL20011</li>
 	<li>Cannot execute as the database principal because <strong><span style="color: #ff0000">the principal "dbo" does not exist</span></strong>, this type of principal cannot be impersonated, or you do not have permission. (Source: MSSQLServer, Error number: 15517)
Get help: https://help/15517</li>
 	<li>The process could not execute 'sp_replcmds' on 'SQLPublisher'. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037)
Get help: https://help/MSSQL_REPL22037</li>
</ul>
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/ReplLogReaderError1-1.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/ReplLogReaderError1-1.png" alt="" width="610" height="483" class="alignnone wp-image-2765" /></a>

<span style="color: #800000"><strong>Cause: 原因</strong></span>

Publication database's owner does not exist

發行資料庫沒有設定擁有者

PS.通常發生在，當發行資料庫是從備份檔還原，而資料庫的建立者無法在還原的資料庫找到對應時，還原後就會是空白

<a href="https://msdnshared.blob.core.windows.net/media/2018/05/ReplLogReaderError1_fixed-1.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/ReplLogReaderError1_fixed-1.png" alt="" width="555" height="219" class="alignnone wp-image-2785" /></a>

<strong><span style="color: #800000">Resolution: 解決方法</span></strong>

發行資料庫設定擁有者

1.right click on the database that you want to change the owner and go to “Properties” menu.
2.In the properties window, go to menu “Select a page -&gt; Files”. Search or type the new owner.

<a href="https://msdnshared.blob.core.windows.net/media/2018/05/ReplLogReaderError1_fixed2-2.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/ReplLogReaderError1_fixed2-2.png" alt="" width="699" height="243" class="alignnone size-full wp-image-2795" /></a>

Replication Log Reader Agent back to normal 恢復正常

<a href="https://msdnshared.blob.core.windows.net/media/2018/05/ReplLogReaderError1_fixed3-2.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/ReplLogReaderError1_fixed3-2.png" alt="" width="700" height="332" class="alignnone size-full wp-image-2805" /></a>]]></content:encoded>
    </item>
    <item>
      <title>Guideline for SQL Server configuration, installation and database creation</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/guideline-for-sql-server-configuration-installation-and-database-creation</link>
      <pubDate>Wed, 25 Apr 2018 00:41:03 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=2675</guid>
      <description><![CDATA[Guideline for SQL Server configuration, installation and database...]]></description>
      <content:encoded><![CDATA[Guideline for SQL Server configuration, installation and database creation

<hr />

<span style="font-weight: 400">1.考慮將Windows電源選項(Power Options)調整為高性能(High Performance)</span>

電源選項預設為平衡，系統會動態調整CPU性能，負載大的時候也會自動提高CPU性能，依照KB的描述若有遇到性能問題，首先考慮更新BIOS與Windows hotfix，另一個選擇，則是直接將電源選項改為高性能<span>(High Performance)，但此時當系統平常使用時，會增加不必要耗電量。</span>

Slow Performance on Windows Server when using the “Balanced” Power Plan

<a href="https://support.microsoft.com/en-us/help/2207548/slow-performance-on-windows-server-when-using-the-balanced-power-plan">https://support.microsoft.com/en-us/help/2207548/slow-performance-on-windows-server-when-using-the-balanced-power-plan</a>
<p class="">To change a power plan:
1. Click on<span> </span><strong>Start</strong><span> </span>and then<span> </span><strong>Control Panel</strong>.<span> </span>
2. From the list of displayed item under<span> </span><strong>Control Panel<span> </span></strong>click on<span> </span><strong>Power Options</strong>, which takes you to<span> </span><strong>Select a power plan<span> </span></strong>page. If you do not see<span> </span><strong>Power Options</strong>, type the word 'power' in the<span> </span><strong>Search Control Panel<span> </span></strong>box and then select<span> </span><strong>Choose a power plan</strong>.<span> </span>
3. By default, the option to change power plans is disabled. To enable this, click the<span> </span><strong>Change settings that are currently unavailable<span> </span></strong>link.<span> </span>
4. Choose the<strong class=""><span> </span>High Performance<span> </span></strong>option<span> </span>
5. Close the<span> </span><strong>Power Option<span> </span></strong>window.<span> </span></p>
<a href="https://msdnshared.blob.core.windows.net/media/2018/04/PowerOptionsHighPerf.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/04/PowerOptionsHighPerf.png" alt="" width="769" height="443" class="alignnone size-full wp-image-2685" /></a>

2.<span style="font-weight: 400">Disk partitions for SQL Server (SSD也一樣建議設定為64KB)</span>

<span style="font-weight: 400">格式化磁碟機時Allocation Unit Size</span><span style="font-weight: 400">選擇</span><strong><span style="color: #0000ff">64KB</span></strong>

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/DiskAllocatUnitSize.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/04/DiskAllocatUnitSize.png" alt="" width="534" height="408" class="alignnone wp-image-2695" /></a>

檢查方法

<span>D:\&gt;fsutil fsinfo ntfsinfo d:</span>

有3選項需要注意

<span>1.Bytes Per Cluster</span> :            65536

<span>Bytes Per Cluster就是Allocation Unit Size，建議format時就指定64KB</span>

2.Bytes Per Sector  :                512 (邏輯大小)
3.Bytes Per Physical Sector : 512 (實際大小)

因為磁碟的容量成長，所以有3種磁碟機

1.最原始的512-byte native

2.下項相容的Advanced Format (also known as 512E) 或稱(4K Sector Disk with 512-byte Emulation)

3.最新的<span>4K native (Windows 2012才支援)</span>
<p style="font-weight: 400"><span style="font-weight: inherit;font-style: inherit">Only Windows Server 2012 or higher<span> </span></span><span style="font-weight: inherit;font-style: inherit"><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/hh848035(v=vs.85).aspx">supports Native 4K format</a></span><span style="font-weight: inherit;font-style: inherit">. <span> </span>Previous versions of Windows<span> </span></span><span style="font-weight: inherit;font-style: inherit"><a href="https://support.microsoft.com/kb/2510009">do not support Native 4K</a></span></p>
<span>Use the values for "Bytes Per Sector" and "Bytes per Physical Sector" to determine the kind of drive that you have. To do this, use the following table: (用以下表格來確認你使用的是哪一種磁碟)</span>
<table width="100%" style="font-weight: 400">
<tbody style="font-weight: inherit;font-style: inherit">
<tr style="font-weight: inherit;font-style: inherit">
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><strong style="font-weight: 400"><span style="font-weight: inherit;font-style: inherit"> “Bytes Per Sector" value</span></strong></p>
</td>
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><strong style="font-weight: 400"><span style="font-weight: inherit;font-style: inherit">"Bytes per Physical Sector" value</span></strong></p>
</td>
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><strong style="font-weight: 400"><span style="font-weight: inherit;font-style: inherit">Drive type</span></strong></p>
</td>
</tr>
<tr style="font-weight: inherit;font-style: inherit">
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><span style="font-weight: inherit;font-style: inherit">4096</span></p>
</td>
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><span style="font-weight: inherit;font-style: inherit">4096</span></p>
</td>
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><span style="font-weight: inherit;font-style: inherit">4K native (Windows 2012 or higher)</span></p>
</td>
</tr>
<tr style="font-weight: inherit;font-style: inherit">
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><span style="font-weight: inherit;font-style: inherit">512</span></p>
</td>
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><span style="font-weight: inherit;font-style: inherit">4096</span></p>
</td>
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><span style="font-weight: inherit;font-style: inherit">Advanced Format (also known as 512E)</span></p>
</td>
</tr>
<tr style="font-weight: inherit;font-style: inherit">
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><span style="font-weight: inherit;font-style: inherit">512</span></p>
</td>
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><span style="font-weight: inherit;font-style: inherit">512</span></p>
</td>
<td style="font-weight: 400;font-style: inherit">
<p style="font-weight: inherit;font-style: inherit"><span style="font-weight: inherit;font-style: inherit">512-byte native</span></p>
</td>
</tr>
</tbody>
</table>
Bytes Per Physical Sector透過Storage管理工具可以修改

<img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/84/42/metablogapi/2022.11.4_1D01B918.jpg" width="640" height="459" class="alignnone size-full" />

<span style="font-weight: 400">Recommendations and Guidelines on configuring disk partitions for SQL Server</span>

<a href="https://support.microsoft.com/zh-tw/kb/2023571"><span style="font-weight: 400">https://support.microsoft.com/zh-tw/kb/2023571</span></a>
<table border="1">
<tbody>
<tr>
<td><span style="font-weight: 400">OS</span></td>
<td><span style="font-weight: 400">Partition alignment defaults</span></td>
</tr>
<tr>
<td><span style="font-weight: 400">Windows Server 2003 and Earlier</span></td>
<td><span style="font-weight: 400">by default are not aligned. Partition alignment must be explicitly performed.</span>

<span style="font-weight: 400">default alignment is 32,256 bytes</span></td>
</tr>
<tr>
<td><span style="font-weight: 400">Windows 2008</span></td>
<td><span style="font-weight: 400">New partitions on Windows Server 2008 are likely to be aligned.</span>

<span style="font-weight: 400">Default alignment is 1024 KB (1,048,576 bytes)</span>

<span style="font-weight: 400">This value works well with commonly used stripe unit sizes of 64 KB, 128 KB and 256 KB as well as the less frequently used values of 512 KB and 1024 KB.</span></td>
</tr>
</tbody>
</table>
<pre><span style="font-weight: 400">檢查D磁碟目前<span>Allocation Unit Size設定，Bytes Per Cluster就是Allocation Unit Size</span>
D:\&gt;fsutil fsinfo ntfsinfo d:</span></pre>
NTFS Volume Serial Number :       0xa2060a7f060a54a
Version :                                               3.1
Number Sectors :              0x00000000043c3f5f
Total Clusters :                  0x000000000008787e
Free Clusters  :                  0x000000000008746e
Total Reserved :                0x0000000000000000
Bytes Per Sector  :             512
<span style="color: #0000ff">Bytes Per Cluster</span> :            <strong><span style="color: #0000ff">65536</span></strong>
Bytes Per FileRecord Segment    : 1024
Clusters Per FileRecord Segment : 0
Mft Valid Data Length :       0x0000000000010000
Mft Start Lcn  : 0x000000000000c000
Mft2 Start Lcn :                  0x0000000000043c3f
Mft Zone Start :                  0x000000000000c000
Mft Zone End   : 0x000000000001cf20

<span style="font-weight: 400">An appropriate value for most installations should be 65,536 bytes (that is, 64 KB) for partitions on which SQL Server data or log files reside. In many cases, this is the same size for Analysis Services data or log files, but there are times where 32 KB provides better performance. To determine the right size, you will need to do performance testing with your workload comparing the two different block sizes.</span>

&nbsp;

以下是範例用命令列來format並指定allocation unit(cluster size)

<span style="font-weight: 400">Here is an example in which the F: drive is created on disk 3, aligned with an offset of 1,024 KB, and formatted with a file allocation unit (cluster) size of 64 KB.</span>
<pre><span style="font-weight: 400">C:\&gt;diskpart</span></pre>
<span style="font-weight: 400">Microsoft DiskPart version 6.0.6001</span>
<span style="font-weight: 400">Copyright (C) 1999-2007 Microsoft Corporation.</span>
<span style="font-weight: 400">On computer: ASPIRINGGEEK</span>
<span style="font-weight: 400">DISKPART&gt; <span style="color: #0000ff">list disk</span></span>
<span style="font-weight: 400">  Disk ###  Status  Size </span> <span style="font-weight: 400">Free </span> <span style="font-weight: 400">Dyn  GPT</span>
<span style="font-weight: 400">  --------  ----------  ------- -------  --- ---</span>
<span style="font-weight: 400">  Disk 0</span> <span style="font-weight: 400">Online       186 GB </span> <span style="font-weight: 400">0 B</span>
<span style="font-weight: 400">  Disk 1</span> <span style="font-weight: 400">Online       100 GB </span> <span style="font-weight: 400">0 B</span>
<span style="font-weight: 400">  Disk 2</span> <span style="font-weight: 400">Online       120 GB </span> <span style="font-weight: 400">0 B</span>
<span style="font-weight: 400">  Disk 3</span> <span style="font-weight: 400">Online       150 GB 150 GB</span>
<span style="font-weight: 400">DISKPART&gt; <span style="color: #0000ff">select disk 3</span></span>
<span style="font-weight: 400">Disk 3 is now the selected disk.</span>
<span style="font-weight: 400">DISKPART&gt; <span style="color: #0000ff">create partition primary align=1024</span></span>
<span style="font-weight: 400">DiskPart succeeded in creating the specified partition.</span>
<span style="font-weight: 400">DISKPART&gt; <span style="color: #0000ff">assign letter=F</span></span>
<span style="font-weight: 400">DiskPart successfully assigned the drive letter or mount point.</span>
<span style="font-weight: 400">DISKPART&gt; <span style="color: #0000ff">format fs=ntfs unit=64K label="MyFastDisk" nowait</span></span>

<strong><span style="color: #800000">Reference:</span></strong>

<span style="font-weight: 400">Disk Partition Alignment Best Practices for SQL Server</span>
<a href="https://technet.microsoft.com/en-us/library/dd758814(v=sql.100).aspx"><span style="font-weight: 400">https://technet.microsoft.com/en-us/library/dd758814(v=sql.100).aspx</span></a>

<span style="font-weight: 400">Disk Partition Alignment: It Still Matters–DPA for Windows Server 2012, SQL Server 2012, and SQL Server 2014</span>

<span style="font-weight: 400"><a href="https://blogs.msdn.microsoft.com/jimmymay/2014/03/14/disk-partition-alignment-it-still-matters-dpa-for-windows-server-2012-sql-server-2012-and-sql-server-2014/">https://blogs.msdn.microsoft.com/jimmymay/2014/03/14/disk-partition-alignment-it-still-matters-dpa-for-windows-server-2012-sql-server-2012-and-sql-server-2014/</a></span>

Message misaligned log IOs which required falling back to synchronous IO in SQL Server Error Log (跟SSD有關的文件)
October 1, 2014 by Cameron - MSFT SAP Program Manager

<a href="https://blogs.msdn.microsoft.com/saponsqlserver/2014/10/01/message-misaligned-log-ios-which-required-falling-back-to-synchronous-io-in-sql-server-error-log/">https://blogs.msdn.microsoft.com/saponsqlserver/2014/10/01/message-misaligned-log-ios-which-required-falling-back-to-synchronous-io-in-sql-server-error-log/</a>
<ol start="8">
 	<li style="font-weight: 400"><strong style="font-weight: 400"><span style="font-weight: inherit;font-style: inherit"> What About Windows NTFS Format Size?</span></strong></li>
</ol>
<p style="font-weight: 400"><span style="font-weight: inherit;font-style: inherit">Any disk containing SQL Server datafiles, log files or tempdb files should always be formatted 64K at the Windows NTFS layer regardless of the underlying sector size. </span></p>
<p style="font-weight: 400"><span style="font-weight: inherit;font-style: inherit">To check this run command:</span></p>
<p style="font-weight: 400"><span style="font-weight: inherit;font-style: inherit">fsutil fsinfo ntfsinfo &lt;drive letter&gt;</span></p>
<p style="font-weight: 400"><span style="font-weight: inherit;font-style: inherit">The “Bytes per cluster” should be 65536</span><span style="font-weight: inherit;font-style: inherit">. <span> </span>If this is not the case it is recommended to reformat the disk in Disk Management as per the screenshot below. </span></p>
&nbsp;

&nbsp;

3.Max Server Memory(設定SQL Server Max Server Memory)

<span style="font-weight: 400">SQL Server Database Engine專用的主機基本原則</span>

<span style="font-weight: 400">Windows 2008</span><span style="font-weight: 400">以上，最少保留</span><span style="font-weight: 400">2GB</span><span style="font-weight: 400">，其他設定為</span><span style="font-weight: 400">max server memory</span>

<span style="font-weight: 400">Windows 2003</span><span style="font-weight: 400">以上，最少保留</span><span style="font-weight: 400">1GB</span><span style="font-weight: 400">，其他設定為</span><span style="font-weight: 400">max server memory</span>

PS.若還有其他SQL Server元件(SSAS, SSRS...等)或其他服務或程式(防毒,備份...等)，則視狀況減少max server memory留給其他服務使用。

&nbsp;

Performance Tuning Guidelines for Windows Server 2012 R2

<a href="https://www.microsoft.com/en-us/download/details.aspx?id=51960">https://www.microsoft.com/en-us/download/details.aspx?id=51960</a>

<strong>Memory</strong>

The amount of memory required by the deduplication optimization job is directly related to the number of optimization jobs that are running. During the optimization process, approximately 1 to 2 GB of RAM is necessary to process 1 TB of data per volume at maximum speed.

For example, a file server running concurrent optimization jobs on 3 volumes of 1 TB, 1 TB, and 2 TB of data respectively would need the following amount of memory, assuming a normal amount of file data changes:
<table width="632">
<tbody>
<tr>
<td width="159"><strong>Volume </strong></td>
<td width="159"><strong>Volume size </strong></td>
<td width="159"><strong>Memory used </strong></td>
</tr>
<tr>
<td width="159">Volume 1</td>
<td width="159">1 TB</td>
<td width="159">1-2 GB</td>
</tr>
<tr>
<td width="159">Volume 2</td>
<td width="159">1 TB</td>
<td width="159">1-2 GB</td>
</tr>
<tr>
<td width="159">Volume 3</td>
<td width="159">2 TB</td>
<td width="159">2-4 GB</td>
</tr>
<tr>
<td width="159">Total for all volumes</td>
<td width="159">1+1+2 * 1GB up to 2GB</td>
<td width="159">4 – 8 GB RAM</td>
</tr>
</tbody>
</table>
&nbsp;

精確的計算方式:
<p class="">Use<span> </span><strong>max_server_memory</strong><span> </span>to guarantee the OS does not experience detrimental memory pressure. To set max server memory configuration, monitor overall consumption of the SQL Server process in order to determine memory requirements. To be more accurate with these calculations for a single instance:</p>

<ul>
 	<li>From the total OS memory, reserve <span style="color: #0000ff">1GB-4GB</span> to the OS itself.</li>
 	<li>Then subtract the equivalent of potential SQL Server memory allocations outside the<span> </span><strong>max server memory</strong><span> </span>control, which is comprised of<span> </span><strong><em>stack size<span> </span><sup>1</sup><span> </span>* calculated max worker threads<span> </span><sup>2</sup><span> </span>+ -g startup parameter<span> </span><sup>3</sup></em></strong><span> </span>(or 256MB by default if<span> </span><em>-g</em><span> </span>is not set). What remains should be the max_server_memory setting for a single instance setup.</li>
</ul>
<sup>1</sup><span> </span>Refer to the<span> </span><a href="https://docs.microsoft.com/en-us/sql/relational-databases/memory-management-architecture-guide?view=sql-server-2017#stacksizes">Memory Management Architecture guide</a><span> </span>for information on thread stack sizes per architecture.

<sup>2</sup><span> </span>Refer to the documentation page on how to<span> </span><a href="https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-max-worker-threads-server-configuration-option?view=sql-server-2017">Configure the max worker threads Server Configuration Option</a>, for information on the calculated default worker threads for a given number of affinitized CPUs in the current host.

<sup>3</sup><span> </span>Refer to the documentation page on<span> </span><a href="https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/database-engine-service-startup-options?view=sql-server-2017">Database Engine Service Startup Options</a><span> </span>for information on the<span> </span><em>-g</em><span> </span>startup parameter.

<strong><span style="color: #800000">Reference:</span></strong>

Server Memory Server Configuration Options
<a href="https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options?view=sql-server-2017">https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options?view=sql-server-2017</a>

&nbsp;

<span style="font-weight: 400">4.SQL Server startup account (SQL Server啟動帳戶)</span>

<span style="font-weight: 400">設定</span><span style="font-weight: 400">SQL Server Startup Account</span><span style="font-weight: 400">，例如 CONTOSO</span><span style="font-weight: 400">\sqlservice</span>

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/SSCMstartupAccount.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/04/SSCMstartupAccount.png" alt="" width="986" height="394" class="alignnone size-full wp-image-2705" /></a>

&nbsp;

5.Lock Page in Memory (鎖定記憶體分頁)

<span style="font-weight: 400">Local Security Policy&gt;Local Policy&gt;User Rights Assignment&gt; Lock pages in memory</span>
<h3 id="to-enable-lock-pages-in-memory" class="heading-with-anchor">To enable Lock Pages in Memory<a href="https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options?view=sql-server-2017#to-enable-lock-pages-in-memory" class="docon docon-link heading-anchor"></a></h3>
To enable the lock pages in memory option:
<ol>
 	<li>On the<span> </span><strong>Start</strong><span> </span>menu, click<span> </span><strong>Run</strong>. In the<span> </span><strong>Open</strong><span> </span>box, type<span> </span><strong>gpedit.msc</strong>.The<span> </span><strong>Group Policy</strong><span> </span>dialog box opens.</li>
 	<li>On the<span> </span><strong>Group Policy</strong><span> </span>console, expand<span> </span><strong>Computer Configuration</strong>, and then expand<span> </span><strong>Windows Settings</strong>.</li>
 	<li>Expand<span> </span><strong>Security Settings</strong>, and then expand<span> </span><strong>Local Policies</strong>.</li>
 	<li>Select the<span> </span><strong>User Rights Assignment</strong><span> </span>folder.The policies will be displayed in the details pane.</li>
 	<li>In the pane, double-click<span> </span><strong>Lock pages in memory</strong>.</li>
 	<li>In the<span> </span><strong>Local Security Policy Setting</strong><span> </span>dialog box, add the account with privileges to run sqlservr.exe (the SQL Server startup account).<span>加入</span><span>SQL Server Startup account，例如 CONTOSO\sqlservice</span></li>
</ol>
<h2><a href="https://msdnshared.blob.core.windows.net/media/2018/04/LockPageInMemory-2.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/04/LockPageInMemory-2.png" alt="" width="895" height="548" class="alignnone wp-image-2715" /></a></h2>
如果從本機安全性原則，此選項是灰階，表示此設定由AD上面的GPO控制，請從GPO設定
<h2 id="lock-pages-in-memory-lpim" class="heading-with-anchor">Lock Pages in Memory (LPIM)<a href="https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options?view=sql-server-2017#lock-pages-in-memory-lpim" class="docon docon-link heading-anchor"></a></h2>
This Windows policy determines which accounts can use a process to keep data in physical memory, preventing the system from paging the data to virtual memory on disk. Locking pages in memory may keep the server responsive when paging memory to disk occurs. The<span> </span><strong>Lock Pages in Memory</strong><span> </span>option is set to ON in instances of SQL Server Standard edition and higher when the account with privileges to run sqlservr.exe has been granted the Windows<span> </span><em>Lock Pages in Memory</em><span> </span>(LPIM) user right.

To disable the<span> </span><strong>Lock Pages In Memory</strong><span> </span>option for SQL Server, remove the<span> </span><em>Lock Pages in Memory</em><span> </span>user right for the account with privileges to run sqlservr.exe (the SQL Server startup account) startup account.
<p class="">Setting this option does not affect SQL Server<span> </span><a href="https://docs.microsoft.com/en-us/sql/relational-databases/memory-management-architecture-guide?view=sql-server-2017#dynamic-memory-management">dynamic memory management</a>, allowing it to expand or shrink at the request of other memory clerks. When using the<span> </span><em>Lock Pages in Memory</em><span> </span>user right it is recommended to set an upper limit for<span> </span><strong>max server memory</strong><span> </span>as<span> </span><a href="https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options?view=sql-server-2017#max_server_memory">detailed above</a>.</p>
&nbsp;

<strong><span>Reference:</span></strong>

Server Memory Server Configuration Options
<a href="https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options?view=sql-server-2017">https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options?view=sql-server-2017</a>

&nbsp;

<span style="font-weight: 400">6.Tempdb file</span>

<span style="font-weight: 400">(1)  data file</span><span style="font-weight: 400">數量</span>
<table border="1">
<tbody>
<tr>
<td><span style="font-weight: 400">SQL</span><span style="font-weight: 400">使用的</span><span style="font-weight: 400">Logical CPU</span><span style="font-weight: 400">數量</span></td>
<td><span style="font-weight: 400">設定</span><span style="font-weight: 400">tempdb data files</span><span style="font-weight: 400">數量</span></td>
</tr>
<tr>
<td><span style="font-weight: 400">若少於等於</span><span style="font-weight: 400">8</span></td>
<td><span style="font-weight: 400">設定等於邏輯</span><span style="font-weight: 400">CPU</span><span style="font-weight: 400">數量</span></td>
</tr>
<tr>
<td><span style="font-weight: 400">若大於</span><span style="font-weight: 400">8</span></td>
<td><span style="font-weight: 400">設定</span><span style="font-weight: 400">8</span><span style="font-weight: 400">個</span><span style="font-weight: 400">data file</span>

<span style="font-weight: 400">然後觀察如果持續有發現</span><span style="font-weight: 400">contention</span><span style="font-weight: 400">的話，一次加</span><span style="font-weight: 400">4</span><span style="font-weight: 400">個，來增加數量，最大等於邏輯</span><span style="font-weight: 400">CPU</span><span style="font-weight: 400">數。</span></td>
</tr>
</tbody>
</table>
<span style="font-weight: 400">觀察</span><span style="font-weight: 400">contention(</span><span style="font-weight: 400">例如</span><span style="font-weight: 400"> metadata contention (waitresource = 2:1:1 or 2:1:3))</span><span style="font-weight: 400">，再來決定是否還要增加數量</span>

<span style="font-weight: 400">(2)   Pre-size (</span><span style="font-weight: 400">資料檔大小</span><span style="font-weight: 400">)</span>

<span style="font-weight: 400">如果</span><span style="font-weight: 400">8</span><span style="font-weight: 400">個，先每一個大小先設定為</span><span style="font-weight: 400">1024MB</span><span style="font-weight: 400">，作為初始值。</span>

<span style="font-weight: 400">如果</span><span style="font-weight: 400">4</span><span style="font-weight: 400">個，先每一個大小先設定為</span><span style="font-weight: 400">1024MB</span><span style="font-weight: 400">，作為初始值。</span>

<span style="font-weight: 400">如果</span><span style="font-weight: 400">2</span><span style="font-weight: 400">個，先每一個大小先設定為</span><span style="font-weight: 400">2048MB</span><span style="font-weight: 400">，作為初始值。</span>

<span style="font-weight: 400">PS.</span><span style="font-weight: 400">監控觀察之後再來調整。</span>

<span style="font-weight: 400">(3)   Autogrow(</span><span style="font-weight: 400">自動成長設定</span><span style="font-weight: 400">)</span>

<span style="font-weight: 400">先設定為每次成長</span><span style="font-weight: 400">200MB</span><span style="font-weight: 400">開始</span>

<span style="font-weight: 400">設定適當的成長大小 </span><span style="font-weight: 400">general guidelines</span>
<table border="1">
<tbody>
<tr>
<td><b>tempdb file size</b></td>
<td><b>FILEGROWTH increment</b></td>
</tr>
<tr>
<td><span style="font-weight: 400">0 to 100 MB</span></td>
<td><span style="font-weight: 400">10 MB</span></td>
</tr>
<tr>
<td><span style="font-weight: 400">100 to 200 MB</span></td>
<td><span style="font-weight: 400">20 MB</span></td>
</tr>
<tr>
<td><span style="font-weight: 400">200 MB or more</span></td>
<td><span style="font-weight: 400">10%* (</span><span style="font-weight: 400">這個值，請參考下面的說明</span><span style="font-weight: 400">)</span></td>
</tr>
</tbody>
</table>
<span style="font-weight: 400">* You may have to adjust this percentage based on the speed of the I/O subsystem on which the tempdb files are located. To avoid potential latch time-outs, </span><span style="font-weight: 400">we recommend limiting the autogrow operation to approximately two minutes</span><span style="font-weight: 400">. For example, if the I/O subsystem can initialize a file at 50 MB per second, the FILEGROWTH increment should be set to a maximum of 6 GB, regardless of the tempdb file size. If possible, use instant database file initialization to improve the performance of autogrow operations</span>

&nbsp;

<span style="font-weight: 400">7.設定</span><span style="font-weight: 400">Instant data file initialization</span><span style="font-weight: 400">可改善自動成長時的效率</span>

<span style="font-weight: 400">Database File Initialization</span>

<a href="https://msdn.microsoft.com/en-us/library/ms175935(v=sql.105).aspx"><span style="font-weight: 400">https://msdn.microsoft.com/en-us/library/ms175935(v=sql.105).aspx</span></a>

<span style="font-weight: 400">設定</span><span style="font-weight: 400">Instant data file initialization</span><span style="font-weight: 400">，改善自動成長時的效率</span>

<span style="font-weight: 400">(</span><span style="font-weight: 400">初始化檔案或成長檔案時不填入</span><span style="font-weight: 400">0)</span>

<span style="font-weight: 400">Database Instant File Initialization</span>

<a href="https://msdn.microsoft.com/en-us/library/ms175935.aspx"><span style="font-weight: 400">https://msdn.microsoft.com/en-us/library/ms175935.aspx</span></a>

<span style="font-weight: 400">Data and log files are initialized to overwrite any existing data left on the disk from previously deleted files. Data and log files are first initialized by filling the files with zeros when you perform one of the following operations:</span>
<ul>
 	<li><span style="font-weight: 400">     </span><span style="font-weight: 400">Create a database.</span></li>
 	<li><span style="font-weight: 400">     </span><span style="font-weight: 400">Add files, log or data, to an existing database.</span></li>
 	<li><span style="font-weight: 400">     </span><span style="font-weight: 400">Increase the size of an existing file (including autogrow operations).</span></li>
 	<li><span style="font-weight: 400">     </span><span style="font-weight: 400">Restore a database or filegroup.</span></li>
</ul>
<span style="font-weight: 400">File initialization causes these operations to take longer. However, when data is written to the files for the first time, the operating system does not have to fill the files with zeros.</span>

<span style="font-weight: 400">Database File Initialization</span>

<a href="https://msdn.microsoft.com/en-us/library/ms175935(v=sql.105).aspx"><span style="font-weight: 400">https://msdn.microsoft.com/en-us/library/ms175935(v=sql.105).aspx</span></a>

<span style="font-weight: 400">To grant an account the Perform volume maintenance tasks permission:</span>

<span style="font-weight: 400">(1)   On the computer where the backup file will be created, open the </span><b>Local Security Policy</b><span style="font-weight: 400"> application (secpol.msc).</span>

<span style="font-weight: 400">(2)   In the left pane, expand </span><b>Local Policies</b><span style="font-weight: 400">, and then click </span><b>User Rights Assignment</b><span style="font-weight: 400">.</span>

<span style="font-weight: 400">(3)   In the right pane, double-click </span><b>Perform volume maintenance tasks</b><span style="font-weight: 400">.</span>

<span style="font-weight: 400">(4)   Click </span><b>Add User or Group</b><span style="font-weight: 400"> and add any user accounts that are used for backups.</span>

<span style="font-weight: 400">(5)   Click </span><b>Apply</b><span style="font-weight: 400">, and then close all </span><b>Local Security Policy</b><span style="font-weight: 400"> dialog boxes.</span>

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/PerformVolumeMaintenanceTasks.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/04/PerformVolumeMaintenanceTasks.png" alt="" width="887" height="545" class="alignnone wp-image-2725" /></a>

&nbsp;

<span style="font-weight: 400">8.User Database file (使用者資料庫檔案)</span>

<span style="font-weight: 400">(1)   </span><span style="font-weight: 400">基本設定原則</span>
<ol>
 	<li><span style="font-weight: 400">      Create DataFG1 for Data (set default)</span><span style="font-weight: 400">，不要使用</span><span style="font-weight: 400">Primary File Group</span></li>
 	<li><span style="font-weight: 400">      Create IndexFG1 for Index</span><span style="font-weight: 400">，不要使用</span><span style="font-weight: 400">Primary File Group，建立Non-Clustered Index時需指定此File Group</span></li>
</ol>
<span style="font-weight: 400">(2)   </span><span style="font-weight: 400">如果可以，將交易紀錄檔設定到獨立磁碟機</span>

<span style="font-weight: 400">(3)   </span><span style="font-weight: 400">如果<span>可以</span>，設定多個資料檔分散到多個獨立磁碟機</span>

<span style="font-weight: 400">(4)   Pre-size (預先設定</span><span style="font-weight: 400">資料檔大小</span><span style="font-weight: 400">)</span>
<ol>
 	<li><span style="font-weight: 400">     </span><span style="font-weight: 400">如果是小型資料庫，且只有一個檔案，預估成長大小並設定上去。</span>例如<span>: 20 GB</span><span>。</span></li>
 	<li><span style="font-weight: 400">     </span><span style="font-weight: 400">如果是大型資料庫，設定多個檔案，預估<span>成長</span>大小，然後除檔案數量，就是每個檔案的大小。</span>例如<span>: 4</span><span>個50</span><span>GB</span><span>的資料檔。</span></li>
</ol>
<span style="font-weight: 400">(5)   Autogrow(</span><span style="font-weight: 400">自動成長設定</span><span style="font-weight: 400">)，可先</span><span style="font-weight: 400">設定為每次成長</span><span style="font-weight: 400">200MB</span><span style="font-weight: 400">開始</span>

&nbsp;

可以考慮設定為8個data file。

https://www.sqlskills.com/blogs/paul/benchmarking-do-multiple-data-files-make-a-difference/

9.如果SQL Agent的Alert System需要發信email功能

(1)設定Database Mail

Configure Database Mail

<a href="https://docs.microsoft.com/en-us/sql/relational-databases/database-mail/configure-database-mail?view=sql-server-2017">https://docs.microsoft.com/en-us/sql/relational-databases/database-mail/configure-database-mail?view=sql-server-2017</a>

(2)設定SQL Agent

Configure SQL Server Agent Mail to Use Database Mail

<a href="https://docs.microsoft.com/en-us/sql/relational-databases/database-mail/configure-sql-server-agent-mail-to-use-database-mail?view=sql-server-2017">https://docs.microsoft.com/en-us/sql/relational-databases/database-mail/configure-sql-server-agent-mail-to-use-database-mail?view=sql-server-2017</a>

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/SQLAgentAlertSystemDBmail.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/04/SQLAgentAlertSystemDBmail.jpg" alt="" width="705" height="199" class="alignnone size-full wp-image-2875" /></a>

and restart SQL Agent Service

&nbsp;

10.SQL Server Error Logs

SCM Services - Configure SQL Server Error Logs

<a href="https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/scm-services-configure-sql-server-error-logs?view=sql-server-2017">https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/scm-services-configure-sql-server-error-logs?view=sql-server-2017</a>

<span>expand </span><strong>Management</strong><span>, right-click </span><strong>SQL Server Logs</strong><span>, and then click </span><strong>Configure</strong><span>.</span>

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/SQLErrorlogMaxinum.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/04/SQLErrorlogMaxinum.jpg" alt="" width="704" height="190" class="alignnone size-full wp-image-2885" /></a>

11.Maintenance Plan 設定維護計畫

Use the Maintenance Plan Wizard

<a href="https://docs.microsoft.com/en-us/sql/relational-databases/maintenance-plans/use-the-maintenance-plan-wizard?view=sql-server-2017">https://docs.microsoft.com/en-us/sql/relational-databases/maintenance-plans/use-the-maintenance-plan-wizard?view=sql-server-2017</a>

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>SQL Server Reporting Services failed to start (Reporting Services啟動失敗)</title>
      <link>https://docs.microsoft.com/archive/blogs/bradchen/sql-server-reporting-services-failed-to-start</link>
      <pubDate>Tue, 24 Apr 2018 23:13:28 GMT</pubDate>
      <dc:creator><![CDATA[Brad Chen]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/bradchen/?p=2655</guid>
      <description><![CDATA[SQL Server Reporting Services failed to start

Reporting Services啟動失敗



Problem 問題:

The...]]></description>
      <content:encoded><![CDATA[SQL Server Reporting Services failed to start

Reporting Services啟動失敗

<hr />

Problem 問題:

<span style="font-weight: 400">The SQL Server Reporting Services (MSSQLSERVER) service failed to start due to the following error: </span>

<span style="font-weight: 400"><span style="color: #0000ff">The service did not respond to the start or control request in a timely fashion</span>.</span>

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/SSRSstartupError.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/04/SSRSstartupError.jpg" alt="" width="836" height="337" class="alignnone size-full wp-image-2665" /></a>

&nbsp;

Resolution 解決方法:

有三種解決方法，以下是我常用的一種

<span style="font-weight: 400">To increase the default service time-out, follow these steps:</span>
<ol>
 	<li style="list-style-type: none">
<ol>
 	<li style="font-weight: 400"><span style="font-weight: 400">Click </span><b>Start</b><span style="font-weight: 400">, click </span><b>Run</b><span style="font-weight: 400">, type </span><b>regedit </b><span style="font-weight: 400">in the </span><b>Open </b><span style="font-weight: 400">box, and then click </span><b>OK</b><span style="font-weight: 400">.</span></li>
 	<li style="font-weight: 400"><span style="font-weight: 400">Locate and then select the following registry subkey:  </span></li>
 	<li style="font-weight: 400"><span style="color: #0000ff"><b>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control</b></span></li>
 	<li><span style="font-weight: 400">Right-click </span><b>Control</b><span style="font-weight: 400">, point to </span><b>New</b><span style="font-weight: 400">, and then click </span><span style="color: #0000ff"><b>DWORD</b></span><span style="font-weight: 400">.</span></li>
 	<li><span style="font-weight: 400">In the </span><b>New Value</b><span style="font-weight: 400"> box, type <span style="color: #ff0000"><strong>ServicesPipeTimeout</strong></span>, and then press Enter.</span></li>
 	<li><span style="font-weight: 400">Right-click </span><span style="color: #000000">ServicesPipeTimeout</span><span style="font-weight: 400">, and then click </span><b>Modify</b><span style="font-weight: 400">.</span></li>
 	<li><span style="font-weight: 400">Click </span><span style="color: #0000ff"><b>Decimal</b></span><span style="font-weight: 400">, type the number of milliseconds that you want to wait until the service times out, and then click </span><b>OK</b><span style="font-weight: 400">.</span></li>
 	<li><span style="font-weight: 400">For example, to wait 60 seconds before the service times out, type </span><span style="color: #ff0000"><b>60000</b></span><span style="font-weight: 400">.</span></li>
 	<li><span style="font-weight: 400">On the </span><b>File </b><span style="font-weight: 400">menu, click </span><b>Exit</b><span style="font-weight: 400">, and then </span><strong><span style="color: #ff0000">restart</span> </strong><span style="font-weight: 400">the computer.</span></li>
</ol>
</li>
</ol>
<b></b>

&nbsp;

其他解決方法請參考以下連結文件

<span style="font-weight: 400">You cannot start SQL Server Reporting Services after you apply the update that is discussed in KB 2677070</span>

<a href="https://support.microsoft.com/en-us/help/2745448/you-cannot-start-sql-server-reporting-services-after-you-apply-the-upd"><span style="font-weight: 400">https://support.microsoft.com/en-us/help/2745448/you-cannot-start-sql-server-reporting-services-after-you-apply-the-upd</span></a>

<span style="font-weight: 400">Reporting Services service doesn’t start after the installation of MS12-070 security patch</span>

<a href="https://blogs.msdn.microsoft.com/mariae/2012/11/12/reporting-services-service-doesnt-start-after-the-installation-of-ms12-070-security-patch/"><span style="font-weight: 400">https://blogs.msdn.microsoft.com/mariae/2012/11/12/reporting-services-service-doesnt-start-after-the-installation-of-ms12-070-security-patch/</span></a>

&nbsp;]]></content:encoded>
    </item>
  </channel>
</rss>