您好,登錄后才能下訂單哦!
監(jiān)控自動種子設定
系統(tǒng)動態(tài)管理視圖
sys.dm_hadr_automatic_seeding
在主要副本上,查詢 sys.dm_hadr_automatic_seeding 以檢查自動種子設定過程的狀態(tài)。 對于每個種子設定過程,該視圖都將返回一行。 例如:
SELECT start_time, completion_time, is_source, current_state, failure_state, failure_state_desc, error_code FROM sys.dm_hadr_automatic_seeding
sys.dm_hadr_physical_seeding_stats
在主要副本上,查詢 sys.dm_hadr_physical_seeding_stats DMV 以查看當前運行的每個種子設定過程的物理統(tǒng)計信息。 種子設定正在運行時,以下查詢將返回多行:
SELECT local_database_name, role_desc, internal_state_desc, transfer_rate_bytes_per_second, transferred_size_bytes, database_size_bytes, start_time_utc, end_time_utc, estimate_time_complete_utc, total_disk_io_wait_time_ms, total_network_wait_time_ms, is_compression_enabled FROM sys.dm_hadr_physical_seeding_stats
錯誤日志
擴展事件
下表列出了與自動種子設定相關的擴展事件:
屬性 | 描述 |
hadr_db_manager_seeding_request_msg | 種子設定請求消息 |
hadr_physical_seeding_backup_state_change | 物理種子設定備份端狀態(tài)更改 |
hadr_physical_seeding_restore_state_change | 物理種子設定還原端狀態(tài)更改 |
hadr_physical_seeding_forwarder_state_change | 物理種子設定轉發(fā)器端狀態(tài)更改 |
hadr_physical_seeding_forwarder_target_state_change | 物理種子設定轉發(fā)器目標端狀態(tài)更改 |
hadr_physical_seeding_submit_callback | 物理種子設定提交回調事件 |
hadr_physical_seeding_failure | 物理種子設定失敗事件 |
hadr_physical_seeding_progress | 物理種子設定進度事件 |
hadr_physical_seeding_schedule_long_task_failure | 物理種子設定計劃長任務失敗事件 |
hadr_automatic_seeding_start | 在提交自動種子設定操作時發(fā)生 |
hadr_automatic_seeding_state_transition | 在自動種子設定操作更改狀態(tài)時發(fā)生 |
hadr_automatic_seeding_success | 在自動種子設定操作成功時發(fā)生 |
hadr_automatic_seeding_failure | 在自動種子設定操作失敗時發(fā)生 |
hadr_automatic_seeding_timeout | 在自動種子設定操作超時時發(fā)生 |
創(chuàng)建擴展事件
CREATE EVENT SESSION [DirectSeed] ON SERVER ADD EVENT sqlserver.hadr_ar_controller_debug( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_automatic_seeding_failure( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_automatic_seeding_start( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_automatic_seeding_state_transition( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_automatic_seeding_success( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_automatic_seeding_timeout( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)) ADD TARGET package0.event_file(SET filename=N'C:\XE\DirectSeed.xel',max_rollover_files=(10)) GO CREATE EVENT SESSION [PhysicalSeed] ON SERVER ADD EVENT sqlserver.hadr_physical_seeding_backup_state_change( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_physical_seeding_failure( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_physical_seeding_forwarder_state_change( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_physical_seeding_forwarder_target_state_change( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_physical_seeding_progress( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_physical_seeding_restore_state_change( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_physical_seeding_schedule_long_task_failure( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)), ADD EVENT sqlserver.hadr_physical_seeding_submit_callback( ACTION(sqlserver.database_id,sqlserver.sql_text,sqlserver.tsql_stack)) ADD TARGET package0.event_file(SET filename=N'C:\XE\PhysicalSeed',max_rollover_files=(10)) GO ALTER EVENT SESSION [DirectSeed] ON SERVER STATE = START ALTER EVENT SESSION [PhysicalSeed] ON SERVER STATE = START
分析擴展事件
IF OBJECT_ID('tempdb..#DirectSeed') IS NOT NULL DROP TABLE [#DirectSeed]; CREATE TABLE [#DirectSeed] ( [ID] INT IDENTITY(1, 1) NOT NULL , [EventXML] XML , CONSTRAINT [PK_DirectSeed] PRIMARY KEY CLUSTERED ( [ID] ) ); INSERT [#DirectSeed] ( [EventXML] ) SELECT CONVERT(XML, [event_data]) AS [EventXML] FROM [sys].[fn_xe_file_target_read_file]('C:\XE\DirectSeed*.xel', NULL, NULL, NULL) CREATE PRIMARY XML INDEX [DirectSeedXML] ON [#DirectSeed]([EventXML]); CREATE XML INDEX [DirectSeedXMLPath] ON [#DirectSeed]([EventXML]) USING XML INDEX [DirectSeedXML] FOR VALUE; SELECT [ds].[EventXML].[value]('(/event/@name)[1]', 'VARCHAR(MAX)') AS [event_name], [ds].[EventXML].[value]('(/event/@timestamp)[1]', 'DATETIME2(7)') AS [event_time], [ds].[EventXML].[value]('(/event/data[@name="debug_message"]/value)[1]', 'VARCHAR(8000)') AS [debug_message], /*hadr_automatic_seeding_state_transition*/ [ds].[EventXML].[value]('(/event/data[@name="previous_state"]/value)[1]', 'VARCHAR(8000)') AS [previous_state], [ds].[EventXML].[value]('(/event/data[@name="current_state"]/value)[1]', 'VARCHAR(8000)') AS [current_state], /*hadr_automatic_seeding_start*/ [ds].[EventXML].[value]('(/event/data[@name="operation_attempt_number"]/value)[1]', 'BIGINT') as [operation_attempt_number], [ds].[EventXML].[value]('(/event/data[@name="ag_id"]/value)[1]', 'VARCHAR(8000)') AS [ag_id], [ds].[EventXML].[value]('(/event/data[@name="ag_db_id"]/value)[1]', 'VARCHAR(8000)') AS [ag_id], [ds].[EventXML].[value]('(/event/data[@name="ag_remote_replica_id"]/value)[1]', 'VARCHAR(8000)') AS [ag_remote_replica_id], /*hadr_automatic_seeding_success*/ [ds].[EventXML].[value]('(/event/data[@name="required_seeding"]/value)[1]', 'VARCHAR(8000)') AS [required_seeding], /*hadr_automatic_seeding_timeout*/ [ds].[EventXML].[value]('(/event/data[@name="timeout_ms"]/value)[1]', 'BIGINT') as [timeout_ms], /*hadr_automatic_seeding_failure*/ [ds].[EventXML].[value]('(/event/data[@name="failure_state"]/value)[1]', 'BIGINT') as [failure_state], [ds].[EventXML].[value]('(/event/data[@name="failure_state_desc"]/value)[1]', 'VARCHAR(8000)') AS [failure_state_desc] FROM [#DirectSeed] AS [ds] ORDER BY [ds].[EventXML].[value]('(/event/@timestamp)[1]', 'DATETIME2(7)') DESC
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。