SQL 服务器死锁事件文件的时间戳记录遵循哪些时区设置

What time-zone settings are followed for Timestamp logging by SQL Server deadlock event file

我的数据库出现死锁。我使用 SQL Server Profiler 工具捕获了 Deadlock Graph 事件。捕获事件后,您可以将整个信息保存在 *.xdl 文件中。这是它捕获的整个 XML 的部分片段。我在下面的内容中乱码了私人数据。

<deadlock-list>
    <deadlock victim="process6ff035c38">
        <process-list>
            <process id="process6ff035c38" taskpriority="0" logused="0" waitresource="PAGE: 5:1:294008 " waittime="3969" ownerId="4585079252" transactionname="SELECT" lasttranstarted="2016-09-09T16:25:57.270" XDES="0x1b3cefc50" lockMode="S" schedulerid="5" kpid="7676" status="suspended" spid="66" sbid="2" ecid="3" priority="0" trancount="0" lastbatchstarted="2016-09-09T16:25:57.270" lastbatchcompleted="2016-09-09T16:25:57.270" lastattention="1900-01-01T00:00:00.270" clientapp="<garbled>" hostname="<garbled>" hostpid="7932" isolationlevel="read committed (2)" xactid="4585079252" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
                <executionStack>
                    <frame procname="adhoc" line="1" sqlhandle="0x02000000164ea431e4d3c4ea517af1905e1a3ff28dc19d360000000000000000000000000000000000000000">

我的简单问题是关于记录在此 xml 文件中的各种时间戳,例如lasttranstarted("2016-09-09T16:25:57.270"), lastbatchstarted("2016-09-09T16:25:57.270"), lastbatchcompleted("2016-09-09T16 :25:57.270”)。这些值是基于安装了 SQL 服务器的机器的格林威治标准时间还是本地时区?

是否可以配置时区 SQL 服务器分析器应该在它生成的事件日志中使用?我问的原因是因为一些与此死锁相对应的应用程序日志也会在应用程序端创建。应用程序日志文件根据本地时区记录日志的时间戳。如果我不知道时区 SQL Server Profiler 工具在其事件日志记录中遵循,那么很难将两者关联起来。

我终于自己弄明白了。这样的日期时间字符串 2016-09-09T16:25:57.270 是本地时区日期时间。您可以在 this link 查看各种日期时间字符串格式说明符。我在 post 中询问的具体格式是 ISO 8601 格式,在 .Net 中使用 o 格式说明符(往返 date/time 模式)表示。这是它的样子:

  • 2009-06-15T13:45:30.0000000Z - 此值表示 Utc 时间。这里 Z 表示 GMT 时间的零偏移量。
  • 2016-09-09T16:25:57.270 - 这个值(在我的问题中)代表本地时区日期时间。