时间:2021-07-01 10:21:17 帮助过:20人阅读
解析数据
select SWITCHOFFSET(n.value(‘@timestamp‘,‘Datetime‘),‘+08:00‘) as EventTime, n.value(‘(data[@name="duration"]/value)[1]‘, ‘int‘) as duration, n.value(‘(data[@name="statement"]/value)[1]‘, ‘nvarchar(max)‘) as statement, n.value(‘(action[@name="database_name"]/value)[1]‘, ‘nvarchar(128)‘) as database_name, n.value(‘(action[@name="client_app_name"]/value)[1]‘, ‘nvarchar(128)‘) as client_app_name, n.value(‘(action[@name="username"]/value)[1]‘, ‘nvarchar(128)‘) as username, n.value(‘(action[@name="nt_username"]/value)[1]‘, ‘nvarchar(128)‘) as nt_username, n.value(‘(action[@name="client_hostname"]/value)[1]‘, ‘nvarchar(128)‘) as client_hostname from (select cast(event_data as XML) as event_data from sys.fn_xe_file_target_read_file(‘D:\XEvent\DB_Usage_0*.xel‘, null, null, null)) ed cross apply ed.event_data.nodes(‘event‘) as q(n)
ExtendEvent-判断DB是否有在使用
标签:color arc ali mem name 扩展 pack targe retention