Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The SQL log is growing rapidly, how to query the corresponding operation sql content?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

/ * query which log records will cause such a sharp change. , /

Select @ @ SPID,Operation,dblog. [Transaction Name], [Transaction ID], AllocUnitName, [Server UID], dblog.SPID,dblog. [Begin Time]

Dblog. [AllocUnitName]

, dblog. [RowLog Contents 1]

From fn_dblog (null, null) dblog

WHERE dblog.Begin Time > = '2020 Universe 01Accord 01'

/ * execute the sql statement according to the corresponding SPID,session_id query * /

Select er.session_id,CAST (csql.text AS varchar (255)) AS CallingSQL

From master.sys.dm_exec_requests er WITH (NOLOCK)

CROSS APPLY MASTER.sys.fn_get_sql (er.sql_handle) csql

Where er.session_id = SPID

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report