規劃 Azure SQL Database 的 Azure 維護事件Planning for Azure maintenance events in Azure SQL Database

了解如何為 Azure SQL 資料庫的計劃性維護事件做準備。Learn how to prepare for planned maintenance events on your Azure SQL database.

什麼是計劃性維護事件What is a planned maintenance event

針對每個資料庫,Azure SQL DB 會維持資料庫複本仲裁,以一個複本作為主要複本。For each database, Azure SQL DB maintains a quorum of database replicas where one replica is the primary. 主要複本必須隨時在線上提供服務,而且至少一個次要複本必須狀況良好。At all times a primary replica must be online servicing, and at least one secondary replica must be healthy. 計劃性維護期間,資料庫仲裁的成員每次只會有一個離線,目的是在線上隨時保有一個可回應的主要複本和至少一個次要複本,以確保用戶端不會停機。During planned maintenance, members of the database quorum will go offline one at a time, with the intent that there is one responding primary replica and at least one secondary replica online to ensure no client downtime. 主要複本需要離線時,會產生重新設定/容錯移轉程序,這時,其中一個次要複本會成為新的主要複本。When the primary replica needs to be brought offline, a reconfiguration/failover process will occur in which one secondary replica will become the new primary.

計劃性維護事件期間的預期情況What to expect during a planned maintenance event

重新設定/容錯移轉通常會在 30 秒內完成,平均是 8 秒。Reconfigurations/failovers generally complete within 30 seconds – the average is 8 seconds. 若已成功連線,您的應用程式必須重新連線至健康情況良好的新資料庫主要複本。If already connected, your application must reconnect to the healthy copy new primary replica of your database. 資料庫正在重新設定而新主要複本尚未上線時,若新連線在此時進行嘗試,您會收到錯誤訊息 40613 (資料庫無法使用):「伺服器 {servername} 上的資料庫 {databasename} 目前無法使用。If a new connection is attempted while the database is undergoing a reconfiguration before the new primary replica is online, you get error 40613 (Database Unavailable): “Database '{databasename}' on server '{servername}' is not currently available. 請稍後重試連線。」Please retry the connection later.”. 若您資料庫執行查詢的時間很長,此查詢將在重新設定期間中斷,並且需要重新啟動。If your database has a long running query, this query will be interrupted during a reconfiguration and will need to be restarted.

重試邏輯Retry Logic

任何連線到雲端資料庫服務的用戶端生產應用程式均應實作健全的連線重試邏輯Any client production application that connects to a cloud database service should implement a robust connection retry logic. 此步驟有助於減緩這些情況,而且通常能夠讓終端使用者知道這些錯誤。This will help mitigate these situations and should generally make the errors transparent to the end user.

頻率Frequency

平均而言,每個月會發生 1.7 次計劃性維護事件。On average, 1.7 planned maintenance events occur each month.

資源健全狀況Resource Health

若您的 SQL 資料庫發生登入失敗,請查看 Azure 入口網站中的資源健康狀態視窗,了解目前狀態。If your SQL database is experiencing login failures, check the Resource Health window in the Azure portal for the current status. [健康情況歷程記錄] 區段會包含每個事件停止運作的原因 (如果有的話)。The Health History section contains the downtime reason for each event (when available).

後續步驟Next steps