sys.fn_hadr_distributed_ag_database_replica (Transact-SQL)

適用於:SQL Server 2016 (13.x) 和更新版本

用來將分散式可用性群組中的資料庫對應至本機可用性群組中的資料庫。

Transact-SQL 語法慣例

語法

  
sys.fn_hadr_distributed_ag_database_replica( lag_Id, database_id )  

引數

'lag_Id'
這是分散式可用性群組的標識碼。 lag_Id為 uniqueidentifier 類型

'database_id'
這是分散式可用性群組中資料庫的標識碼。 database_id為 uniqueidentifier 類型

傳回的數據表

傳回下列資訊。

資料行名稱 資料類型 描述
group_database_id uniqueidentifier 本機可用性群組中資料庫的標識碼。

範例

使用sys.fn_hadr_distributed_ag_database_replica

下列範例會傳入分散式可用性群組中的資料庫標識碼。 它會傳回數據表,其中包含與本機可用性群組相關聯的資料庫標識符。

DECLARE @lagId uniqueidentifier = '4A03D1A8-4AE6-B153-E7E9-ED22A546008D'  
DECLARE @databaseId uniqueidentifier = '3FFA882A-C4C3-5B9E-A203-8F44BD9659F7'  
  
SELECT * FROM sys.fn_hadr_distributed_ag_database_replica(@lagId, @databaseId)  
GO  

另請參閱

AlwaysOn 可用性群組函式 (Transact-SQL)
Always On 可用性群組 (SQL Server)
分散式可用性群組 (AlwaysOn 可用性群組)
CREATE AVAILABILITY GROUP (Transact-SQL)
ALTER AVAILABILITY GROUP (Transact-SQL)