Home > database >  Who is connecting to the database query which tables?
Who is connecting to the database query which tables?

Time:09-22

Leadership suspected someone was "all parties", give me the task, must find out who is in a month where "all parties" queries on a computer,
Our unit is HIS database SQL server2008 R2, prescription and orders data in zy library and ys garage, such as zy pool table zyb_sfxm_skd and ys garage yf_cfjbxx and yf_cfxm these tables are important data sensitive table,

What should I do, can know which workstations fixed network (IP) in what time to visit the three tables, and has carried on the system query, is group by ysxm, ypmc, DJ, sl, ysxm is the meaning of the doctor's name, behind a few is pinyin in code,

Pray god help!

CodePudding user response:

SQL server2008 version is too low, can only use SQL profiler,
The search related information you see,

CodePudding user response:

If you have a DBA permission, try:

SELECT * FROM: : fn_trace_getinfo (default)

- If the current file is the for example C: \ Program Files \ Microsoft SQL Server \ MSSQL15 MSSQLSERVER01 \ MSSQL \ Log \ log_178 TRC, log_178. TRC etc. Get the contents of the trace with:

SELECT * FROM fn_trace_gettable (' C: \ Program Files \ Microsoft SQL Server \ MSSQL15 MSSQLSERVER01 \ MSSQL \ Log \ log_178 TRC ', default)

Then try:

The SELECT d.p lan_handle,
D.s ql_handle,
E. ext
The FROM sys. Dm_exec_query_stats d
CROSS the APPLY sys. Dm_exec_sql_text (d.p lan_handle) AS e
WHERE d.l ast_execution_time & gt; '02/20/2020 - e.g. : any time
AND the text like '% % something'

CodePudding user response:

refer to the second floor Seagull16 response:
if you have a DBA permission, try:

SELECT * FROM: : fn_trace_getinfo (default)

- If the current file is the for example C: \ Program Files \ Microsoft SQL Server \ MSSQL15 MSSQLSERVER01 \ MSSQL \ Log \ log_178 TRC, log_178. TRC etc. Get the contents of the trace with:

SELECT * FROM fn_trace_gettable (' C: \ Program Files \ Microsoft SQL Server \ MSSQL15 MSSQLSERVER01 \ MSSQL \ Log \ log_178 TRC ', default)

Then try:

The SELECT d.p lan_handle,
D.s ql_handle,
E. ext
The FROM sys. Dm_exec_query_stats d
CROSS the APPLY sys. Dm_exec_sql_text (d.p lan_handle) AS e
WHERE d.l ast_execution_time & gt; '02/20/2020 - e.g. : any time
Something AND text like '% %'

The somebody else want to know who to check, you have no?
  • Related