Share via


MSSQLSERVER_35267

適用於:SQL Server

詳細資料

屬性
產品名稱 SQL Server
事件識別碼 35267
事件來源 MSSQLSERVER
元件 SQLEngine
符號名稱 HADR_DISCONNECTED_DB
訊息文字 複本識別碼為 {%.8x-%.4x-%.4x-%.4x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x}的 S_MSG AlwaysOn 可用性群組 S_MSG連線。 此為參考用訊息, 使用者不必採取任何動作。

說明

當可用性群組複本失去與資料庫鏡像端點上遠端複本的連線時,就會發生此訊息。 以下是如何查看此錯誤的範例:

Always On Availability Groups connection with secondary database terminated for primary database 'ContosoDb' on the availability replica 'PRODSQL' with Replica ID: {xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx}. This is an informational message only. No user action is required.
Always On Availability Groups connection with primary database terminated for secondary database 'ContosoDb' on the availability replica 'PRODSQL' with Replica ID: {xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx}. This is an informational message only. No user action is required.

如您所見,錯誤可能會出現在主要複本上,指出它與次要複本的通訊遺失,反之亦然。

錯誤 35267 通常是間歇性的,而且可能會在根本原因自行解決的那一刻。 例如,間歇性網路問題可能會自行解決,而連線可能會重新建立本身。

在許多情況下,本機節點嘗試連線的遠端節點甚至可能不知道連線失敗。 因此,您可能只會在其中一個複本上看到這個錯誤,而不是兩者。

錯誤 35267 有時可能會與錯誤 35206 一起發生,而錯誤 35206 會在沒有成功連線的期間過後引發(例如超過 10 秒)。

A connection timeout has occurred on a previously established connection to availability replica 'PRODSQL' with id [xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx].  Either a networking or a firewall issue exists or the availability replica has transitioned to the resolving role.

Always On Availability Groups connection with primary database terminated for secondary database 'ContosoHRDb' on the availability replica 'PRODSQL' with Replica ID: {xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx}. This is an informational message only. No user action is required.
Always On Availability Groups connection with primary database terminated for secondary database 'ContosoFinDb' on the availability replica 'PRODSQL' with Replica ID: {xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx}. This is an informational message only. No user action is required.
Always On Availability Groups connection with primary database terminated for secondary database 'ContosoMktngDb' on the availability replica 'PRODSQL' with Replica ID: {xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx}. This is an informational message only. No user action is required.

與遠端複本的 AG 連線終止可能會導致本機複本發生各種問題。 例如,如果 AG 使用 SYNCHRONOUS 模式且連線遺失,本機複本最終可能會等待遠端確認。 因此,不會截斷交易記錄,而交易記錄會用盡空間(錯誤 9002 )和更新版本變成無法使用(錯誤 9001 )。 以下是發生此錯誤的群組範例。 請注意,交易記錄已滿的原因是「AVAILABILITY_REPLICA」,這表示此複本正在等候遠端複本確認已套用記錄檔記錄。

Error: 9002, Severity: 17, State: 9.
The transaction log for database 'ContosoAnalyticsDb' is full due to 'AVAILABILITY_REPLICA'.
Error: 3314, Severity: 21, State: 3.
During undoing of a logged operation in database 'ContosoAnalyticsDb' (page (1:32573799) if any), an error occurred at log record ID (7672713:36228:159). Typically, the specific failure is logged previously as an error in the operating system error log. Restore the database or file from a backup, or repair the database.
State information for database 'ContosoAnalyticsDb' - Hardened Lsn: '(7672713:38265:1)'    Commit LSN: '(7672712:1683087:46)'    Commit Time: 'JuN  10 2022  5:51AM'

Always On Availability Groups connection with secondary database terminated for primary database 'ContosoAnalyticsDb' on the availability replica 'SQL2019DB' with Replica ID: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. This is an informational message only. No user action is required.

Database ContosoAnalyticsDb was shutdown due to error 3314 in routine 'XdesRMReadWrite::RollbackToLsn'. Restart for non-snapshot databases will be attempted after all connections to the database are aborted.

Error during rollback. shutting down database (location: 1).
Error: 9001, Severity: 21, State: 5.
The log for database 'ContosoAnalyticsDb' is not available. Check the operating system error log for related error messages. Resolve any errors and restart the database.

Recovery of database 'ContosoAnalyticsDb' (6) is 0% complete (approximately 60177 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.

原因

  • 主要複本與次要複本之間可能存在網路連線問題
  • 主要或次要複本上的 SQL Server 或 OS 問題導致執行緒無法執行。 範例包括:
    • SQL OS 排程器問題 (非產生或死結排程器)
    • 機器上的記憶體不足,導致系統上所有進程的工作集修剪,包括 SQL Server
    • 導致進程停止回應的作業系統問題
  • 造成主要或次要複本上間歇性長時間等候的 I/O 問題變慢

使用者動作

下列資訊概述較常見的案例,但並非詳盡的疑難排解步驟清單。 發生此問題的特定原因可能包括一長串的可能性。

連線問題

若要檢查從 SQL Server 將錯誤引發至遠端 SQL Server 的連線問題,您可以考慮下列步驟:

步驟 1: 確定遠端 SQL Server 上的端點作用中

執行下列查詢以探索端點

SELECT
 tep.name as EndPointName,
 sp.name As CreatedBy,
 tep.type_desc,
 tep.state_desc,
 tep.port
FROM
 sys.tcp_endpoints tep
INNER JOIN sys.server_principals sp ON tep.principal_id = sp.principal_id
WHERE tep.type = 4

步驟 2: 測試遠端端點的連線能力

使用 Test-NetConnection 來驗證連線能力。 如果端點正在接聽且連線成功,請尋找 TcpTestSucceeded : True 。 將 ServerName 或 IP_Address 取代為遠端 SQL Server,並將埠號碼取代為資料庫鏡像端點的埠號碼。

Test-NetConnection -ComputerName <ServerName> -Port <port_number>
Test-NetConnection -ComputerName <IP_address> -Port <port_number>

步驟 3: 收集網路追蹤

除非您擷取網路追蹤,否則間歇性網路錯誤通常很難追蹤,這會顯示網路重設(已捨棄的封包)或類似的問題。 如需詳細資訊,請參閱 0300 間歇性或定期網路問題

SQL Server 排程器問題

如果 SQL Server 背景工作執行緒因各種原因而遇到排程器問題,則服務傳入要求的執行緒可能會在排程器問題最後一次發出時暫時停止回應。

步驟 4: 檢查 SQL Server 上的排程器問題

在非產生狀態 70 秒之後,SQL Server 錯誤記錄檔中會記錄典型的非產生排程器問題。 不過,SQL Server 會比這更頻繁地檢查排程器的狀態,並在擴充事件中報告這些中繼非產生狀態。 如果您在對應到錯誤 35267 的遠端節點上發現排程器問題,請專注于先解決那些問題。 以下說明如何檢查未達到 70 秒閾值但發生 10 或 20 秒的排程器問題短期發生次數。

使用系統健康情況 擴充事件檔

  1. 從事件發生時找出系統健康情況 擴充事件檔案。
  2. 按兩下 system_health_0_xxxxxxxxxxxxxxxxxx.xel 以在 SQL Server Management Studio (SSMS) 中開啟它。 或者,您可以使用 sys.fn_xe_file_target_read_file 來檢視或匯入檔案做為資料表,以方便篩選。
  3. 搜尋任何出現的 scheduler_monitor_non_yielding_ring_buffer_recorded 事件。 如果您發現任何事件,表示 SQL Server 偵測到非產生排程器事件,並正在錄製事件。 這些事件會早于實際的非易記排程器記憶體傾印和錯誤記錄檔專案,其發生于 60-70 秒的非產生狀態之後。 換句話說,您可以使用 scheduler_monitor_non_yielding_ring_buffer_recorded 來偵測未記錄在錯誤記錄檔中,但仍發生短期的非產生排程器問題。 這些可能是間歇性的原因,或是 AG 節點之間短暫缺乏連線能力的原因。

使用 SQLDIAG 擴充事件記錄檔

  1. 從事件的時間(適用于 Windows 叢集系統)找出 \Log 目錄中的 SQLDIAG 擴充事件記錄 檔。 檔案名格式就像這樣 SERVERNAME_MSSQLSERVER_SQLDIAG_x_xxxxxxxxxxxxxxxxxx.xel

  2. 按兩下以在 SQL Server Management Studio (SSMS) 中開啟檔案。 或者,您可以使用 sys.fn_xe_file_target_read_file 來檢視或匯入檔案做為資料表,以方便篩選。

  3. 在 SSMS 中開啟之後,找出 component_health_result 事件的實例 ,然後以滑鼠右鍵按一下下列專案,然後選擇 [在資料表 中顯示資料行]: 元件 state_desc

  4. 然後以滑鼠右鍵按一下每個資料行,然後選擇 [ 依此值 篩選],以套用下列篩選:

    • component_health_result 事件為唯一顯示的事件
    • component field='query processing'
    • <> state_desc 'clean'。
  5. 然後按兩下 資料 行以開啟 XML 資料,並在第一個資料列中查看 trackingNonYieldingScheduler 值。

  6. 如果值與 0x0 不同,表示 SQL Server 已偵測到非產生排程器的早期跡象,並在這裡回報。

    以下是 SQL Server 偵測到具有排程器位址 「0x4fedb840040」 的非產生條件的範例:

     <queryProcessing maxWorkers="9600" workersCreated="2574" workersIdle="1883" tasksCompletedWithinInterval="175591" pendingTasks="3" ... trackingNonYieldingScheduler="0x4fedb840040">
    

作業系統記憶體不足

作業系統 (OS) 層級可能會發生各種問題,以觸發這類間歇性缺乏回應。 常見的記憶體不足。 在發生可疑問題的遠端 AG 節點上,執行下列步驟:

步驟 5: 檢查導致 SQL Server 記憶體分頁至磁片的 OS 記憶體問題

  1. 檢查 Windows 系統事件記錄檔中是否有任何指出實體或虛擬記憶體不足的錯誤。

  2. 檢查 SQL Server 錯誤記錄檔或 Windows 應用程式事件記錄檔中是否有錯誤 17890,以查看機器上的記憶體不足是否導致系統上的所有進程,包括 SQL Server 的工作集修剪。 錯誤看起來像這樣:

    A significant part of SQL Server process memory has been paged out. This may result in a performance degradation. Duration: 0 seconds. Working set (KB): 3383250, committed (KB):    9112480, memory utilization: 37%.
    

    如需詳細的 t 射擊步驟,請參閱 MSSQLSERVER_17890

步驟 6。 正確設定記憶體中的最大伺服器記憶體和鎖定的頁面

  1. 將 SQL Server Max Server Memory 設定為值,讓 OS 和其他進程可以使用記憶體。 中建議的值,將 SQL Server 最大伺服器記憶體設定為系統上的 RAM 大小不超過 75%。 如需詳細資訊,請參閱 伺服器記憶體組態選項
  2. 啟用鎖定記憶體中的分頁選項 (Windows) 以防止大量分頁 SQL Server 緩衝區快取。

慢速磁片 I/O

在某些情況下,I/O 速度過慢可能會導致 SQL Server 執行緒暫時停止回應,這可能會導致其他 AG 複本中斷連線。

步驟 7。 解決任何緩慢的 I/O 問題

如果您遇到指出 I/O 緩慢的錯誤,請針對緩慢 I/O 的根本原因進行疑難排解。

SQL Server has encountered 2 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [F:\TLOG\ContosoDb.ldf] in database id 9.  The OS file handle is 0x00000000000003BC.  The offset of the latest long I/O is: 0x0000003d26f600
SQL Server has encountered 2 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [F:\DATA\t38data\ContosoDb2.mdf] in database id 7.  The OS file handle is 0x000000000000118C.  The offset of the latest long I/O is: 0x00000000012000
SQL Server has encountered 1 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [F:\DATA\t38data\ContosoDb.mdf] in database id 9.  The OS file handle is 0x000000000000134C.  The offset of the latest long I/O is: 0x00000000012000

Always On Availability Groups connection with primary database terminated for secondary database 'ContosoDb2' on the availability replica 'SQLNODE1\INSTANCE19' with Replica ID: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. This is an informational message only. No user action is required.
Always On Availability Groups connection with primary database terminated for secondary database 'ContosoDb' on the availability replica 'SQLNODE1\INSTANCE19' with Replica ID: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. This is an informational message only. No user action is required.
  • 更新所有設備磁碟機和韌體,或執行與您的 I/O 子系統相關聯的其他診斷
  • 篩選驅動程式可能會讓磁片存取變慢,例如防毒軟體程式。 若要提高存取速度,請從作用中病毒掃描排除 SQL Server 資料檔案
  • 請與您的硬體廠商和系統管理員合作,診斷並解決 I/O 緩慢的原因

如需詳細指示,請參閱 針對 I/O 問題和 MSSQLSERVER_833 所造成的 SQL Server 效能緩慢進行疑難排解。