在 Azure SQL Database 中調整彈性集區Scale elastic pool resources in Azure SQL Database

本文說明如何在 Azure SQL Database 中調整彈性集區和集區資料庫可用的計算和儲存資源。This article describes how to scale the compute and storage resources available for elastic pools and pooled databases in Azure SQL Database.

變更計算資源 (虛擬核心或 Dtu)Change compute resources (vCores or DTUs)

一開始選取的虛擬核心或 Edtu 數目之後, 您可以調整彈性集區增加或相應減少以動態方式根據實際經驗,使用Azure 入口網站PowerShell,則Azure CLI,則REST APIAfter initially picking the number of vCores or eDTUs, you can scale an elastic pool up or down dynamically based on actual experience using the Azure portal, PowerShell, the Azure CLI, or the REST API.

變更服務層或重新調整計算大小的影響Impact of changing service tier or rescaling compute size

變更服務層,或計算的彈性集區的大小類似的模式與單一資料庫和主要牽涉的服務,執行下列步驟:Changing the service tier or compute size of an elastic pool follows a similar pattern as for single databases and mainly involves the service performing the following steps:

  1. 建立新的彈性集區的計算執行個體Create new compute instance for the elastic pool

    要求的服務層與計算大小,會建立新的計算執行個體的彈性集區。A new compute instance for the elastic pool is created with the requested service tier and compute size. 服務層和計算的大小變更的一些組合,每個資料庫的複本必須建立新的計算執行個體這牽涉到將資料複製,並會強烈影響的整體延遲。For some combinations of service tier and compute size changes, a replica of each database must be created in the new compute instance which involves copying data and can strongly influence the overall latency. 不論如何,資料庫期間維持線上狀態此步驟中,並連接可以繼續導向至原始的計算執行個體中的資料庫。Regardless, the databases remain online during this step, and connections continue to be directed to the databases in the original compute instance.

  2. 切換到新的計算執行個體的連線的路由Switch routing of connections to new compute instance

    會卸除現有的連接,原始的計算執行個體中的資料庫。Existing connections to the databases in the original compute instance are dropped. 資料庫會建立任何新的連線,新的計算執行個體中。Any new connections are established to the databases in the new compute instance. 服務層和計算的大小變更的一些組合,資料庫檔案中斷連結,並在切換期間重新附加上。For some combinations of service tier and compute size changes, database files are detached and reattached during the switch. 不論如何,此參數可能會導致短暫服務中斷資料庫時無法使用,通常為小於 30 秒,通常只有幾秒鐘的時間。Regardless, the switch can result in a brief service interruption when databases are unavailable generally for less than 30 seconds and often for only a few seconds. 如果有長時間執行交易時的連接會中斷執行,此步驟的持續時間可能更久才能復原中止的交易。If there are long running transactions running when connections are dropped, the duration of this step may take longer in order to recover aborted transactions. 加速資料庫復原可以減少從中止長時間執行交易的影響。Accelerated Database Recovery can reduce the impact from aborting long running transactions.

重要

在工作流程中的任何步驟期間,不會遺失任何資料。No data is lost during any step in the workflow.

變更服務層或重新調整計算大小的延遲Latency of changing service tier or rescaling compute size

若要變更服務層,或重新調整單一資料庫或彈性集區的計算大小估計的延遲是經過參數化,如下所示:The estimated latency to change the service tier or rescale the compute size of a single database or elastic pool is parameterized as follows:

服務層Service tier 基本的單一資料庫,Basic single database,
標準 (S0 S1)Standard (S0-S1)
基本的彈性集區Basic elastic pool,
標準 (S2-S12)Standard (S2-S12),
超大規模Hyperscale,
一般用途的單一資料庫或彈性集區General Purpose single database or elastic pool
進階或業務關鍵的單一資料庫或彈性集區Premium or Business Critical single database or elastic pool
基本的單一資料庫,
標準 (S0 S1)
Basic single database,
Standard (S0-S1)
•  獨立的空間使用的常數時間延遲•  Constant time latency independent of space used
•  一般而言,小於 5 分鐘•  Typically, less than 5 minutes
•  使用複製資料的資料庫空間成正比的延遲•  Latency proportional to database space used due to data copying
•  一般而言,小於 1 分鐘,每 GB 的可用空間•  Typically, less than 1 minute per GB of space used
•  使用複製資料的資料庫空間成正比的延遲•  Latency proportional to database space used due to data copying
•  一般而言,小於 1 分鐘,每 GB 的可用空間•  Typically, less than 1 minute per GB of space used
基本的彈性集區
標準 (S2-S12)
超大規模
一般用途的單一資料庫或彈性集區
Basic elastic pool,
Standard (S2-S12),
Hyperscale,
General Purpose single database or elastic pool
•  使用複製資料的資料庫空間成正比的延遲•  Latency proportional to database space used due to data copying
•  一般而言,小於 1 分鐘,每 GB 的可用空間•  Typically, less than 1 minute per GB of space used
•  獨立的空間使用的常數時間延遲•  Constant time latency independent of space used
•  一般而言,小於 5 分鐘•  Typically, less than 5 minutes
•  使用複製資料的資料庫空間成正比的延遲•  Latency proportional to database space used due to data copying
•  一般而言,小於 1 分鐘,每 GB 的可用空間•  Typically, less than 1 minute per GB of space used
進階或業務關鍵的單一資料庫或彈性集區Premium or Business Critical single database or elastic pool •  使用複製資料的資料庫空間成正比的延遲•  Latency proportional to database space used due to data copying
•  一般而言,小於 1 分鐘,每 GB 的可用空間•  Typically, less than 1 minute per GB of space used
•  使用複製資料的資料庫空間成正比的延遲•  Latency proportional to database space used due to data copying
•  一般而言,小於 1 分鐘,每 GB 的可用空間•  Typically, less than 1 minute per GB of space used
•  使用複製資料的資料庫空間成正比的延遲•  Latency proportional to database space used due to data copying
•  一般而言,小於 1 分鐘,每 GB 的可用空間•  Typically, less than 1 minute per GB of space used

注意

  • 如果是變更服務層,或重新調整彈性集區的計算,在集區中的所有資料庫使用的空間總和應該用於計算估計值。In the case of changing the service tier or rescaling compute for an elastic pool, the summation of space used across all databases in the pool should be used to calculate the estimate.
  • 在移動資料庫從彈性集區,只將資料庫所使用的空間會影響延遲,而不使用彈性集區的空間。In the case of moving a database to/from an elastic pool, only the space used by the database impacts the latency, not the space used by the elastic pool.

提示

若要監視進行中的作業,請參閱:使用 SQL REST API 管理作業使用 CLI 管理作業使用 T-SQL 監視作業,以及下列兩個 PowerShell 命令:取得 AzSqlDatabaseActivity停止 AzSqlDatabaseActivityTo monitor in-progress operations, see: Manage operations using the SQL REST API, Manage operations using CLI, Monitor operations using T-SQL and these two PowerShell commands: Get-AzSqlDatabaseActivity and Stop-AzSqlDatabaseActivity.

其他考量事項變更服務層或重新調整運算大小Additional considerations when changing service tier or rescaling compute size

  • 虛擬核心或彈性集區的 Edtu,縮減大小時,集區使用的空間必須小於允許的目標服務層和集區 Edtu 大小上限。When downsizing vCores or eDTUs for an elastic pool, the pool used space must be smaller than the maximum allowed size of the target service tier and pool eDTUs.
  • 重新調整時的虛擬核心或彈性集區的 Edtu,如果集區 (1) 的儲存體最大大小支援的目標集區中,而且 (2) 儲存體大小上限超過目標集區的內含儲存體數量,適用於產生額外的儲存體成本。When rescaling vCores or eDTUs for an elastic pool, an extra storage cost applies if (1) the storage max size of the pool is supported by the target pool, and (2) the storage max size exceeds the included storage amount of the target pool. 例如,如果大小上限為 100 GB 的 100 eDTU 標準集區縮減為 50 eDTU 標準集區,則會產生額外的儲存體成本,因為目標集區可支援 100 GB 的大小上限,而且其內含儲存體數量只有 50 GB。For example, if a 100 eDTU Standard pool with a max size of 100 GB is downsized to a 50 eDTU Standard pool, then an extra storage cost applies since target pool supports a max size of 100 GB and its included storage amount is only 50 GB. 因此,額外的儲存體數量為 100 GB – 50 GB = 50 GB。So, the extra storage amount is 100 GB – 50 GB = 50 GB. 如需額外儲存體的價格詳細資訊,請參閱 SQL Database 定價For pricing of extra storage, see SQL Database pricing. 如果實際的使用空間量小於內含的儲存體數量,則可將資料庫大小上限降低至內含量,以避免造成額外成本。If the actual amount of space used is less than the included storage amount, then this extra cost can be avoided by reducing the database max size to the included amount.

重新調整期間的計費Billing during rescaling

您需要支付使用最高服務層資料庫存在的時數 + 在該小時適用的計算大小,不論使用狀況或資料庫是否在作用中少於一小時。You are billed for each hour a database exists using the highest service tier + compute size that applied during that hour, regardless of usage or whether the database was active for less than an hour. 例如,假設您建立了單一資料庫並在五分鐘後刪除,您的帳單就會反映一個資料庫時數的費用。For example, if you create a single database and delete it five minutes later your bill reflects a charge for one database hour.

變更彈性集區儲存體大小Change elastic pool storage size

重要

在某些情況下,您可能需要壓縮資料庫來回收未使用的空間。Under some circumstances, you may need to shrink a database to reclaim unused space. 如需詳細資訊,請參閱管理 Azure SQL Database 中的檔案空間For more information, see Manage file space in Azure SQL Database.

以虛擬核心為基礎的購買模型vCore-based purchasing model

  • 可以將儲存體佈建到大小上限:Storage can be provisioned up to the max size limit:

    • 針對標準或一般用途服務層級中的儲存體,增加或減少大小 (以 10 GB 為增量單位)For storage in the standard or general purpose service tiers, increase or decrease size in 10-GB increments
    • 針對進階或商務關鍵性服務層級中的儲存體,增加或減少大小 (以 250 GB 為增量單位)For storage in the premium or business critical service tiers, increase or decrease size in 250-GB increments
  • 增加或減少其大小上限,即可佈建彈性集區的儲存體。Storage for an elastic pool can be provisioned by increasing or decreasing its max size.

  • 彈性集區儲存體的價格為儲存體數量乘以服務層的儲存體單價。The price of storage for an elastic pool is the storage amount multiplied by the storage unit price of the service tier. 如需有關額外儲存體的價格詳細資訊,請參閱 SQL Database 定價For details on the price of extra storage, see SQL Database pricing.

重要

在某些情況下,您可能需要壓縮資料庫來回收未使用的空間。Under some circumstances, you may need to shrink a database to reclaim unused space. 如需詳細資訊,請參閱管理 Azure SQL Database 中的檔案空間For more information, see Manage file space in Azure SQL Database.

以 DTU 為基礎的購買模型DTU-based purchasing model

  • 彈性集區的 eDTU 價格包含一定數量不額外收費的儲存體。The eDTU price for an elastic pool includes a certain amount of storage at no additional cost. 佈建超過內含量的額外儲存體會產生額外費用,以 250 GB 為單位最多增加到大小上限 1 TB,超過 1 TB 則以 256 GB 為單位增加。Extra storage beyond the included amount can be provisioned for an additional cost up to the max size limit in increments of 250 GB up to 1 TB, and then in increments of 256 GB beyond 1 TB. 如需了解內含儲存體數量和大小上限,請參閱彈性集區:儲存體大小與計算大小For included storage amounts and max size limits, see Elastic pool: storage sizes and compute sizes.
  • 可藉由使用 Azure 入口網站PowerShellAzure CLIREST API 增加其大小上限,以佈建彈性集區的額外儲存體。Extra storage for an elastic pool can be provisioned by increasing its max size using the Azure portal, PowerShell, the Azure CLI, or the REST API.
  • 彈性集區之額外儲存體的價格為額外儲存體數量乘以服務層的額外儲存體單價。The price of extra storage for an elastic pool is the extra storage amount multiplied by the extra storage unit price of the service tier. 如需有關額外儲存體的價格詳細資訊,請參閱 SQL Database 定價For details on the price of extra storage, see SQL Database pricing.

重要

在某些情況下,您可能需要壓縮資料庫來回收未使用的空間。Under some circumstances, you may need to shrink a database to reclaim unused space. 如需詳細資訊,請參閱管理 Azure SQL Database 中的檔案空間For more information, see Manage file space in Azure SQL Database.

後續步驟Next steps

如需整體資源限制,請參閱SQL Database 以虛擬核心為基礎的資源限制 - 彈性集區SQL Database 以 DTU 為基礎的資源限制 - 彈性集區For overall resource limits, see SQL Database vCore-based resource limits - elastic pools and SQL Database DTU-based resource limits - elastic pools.