SQL Server 表填充源

发布于 2024-08-07 19:08:53 字数 202 浏览 7 评论 0原文

我有一个审计数据库(由其他人创建)。

有些东西正在用表大小数据填充它(这很有意义,因为它是审计数据库)。

SQL 服务器有太多的工作。

我想知道审计表中填充了什么。

有没有像 sys.comments 之类的东西?它可以告诉我什么正在填充表,或者我是否必须检查每个作业中的代码?

问候

曼乔特

I have an Audit database(created by someone else).

Something is polulating it, with table sizes data (which makes sense as it is Audit database).

The SQL server has too many jobs.

I want to know what is populating the audit tables.

Is there anything like sys.comments etc? which can tell me what is populating tables or do I have to check the code inside each job?

Regards

Manjot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

你与昨日 2024-08-14 19:08:53

你可以尝试运行这样的东西:

SELECT DISTINCT
    o.name,o.type_desc
    FROM sys.sql_modules        m 
        INNER JOIN sys.objects  o ON m.object_id=o.object_id
    WHERE m.definition Like '%YourTableName%'
    ORDER BY 2,1

编辑在OP提到SQL Server 2000之后

这应该适用于SQl Server 2000:

--remove comments to see the actual text too
SELECT DISTINCT
    o.name --,c1.colid,c1.text
    FROM sysobjects                  o
        INNER JOIN syscomments      c1 ON o.id = c1.id
        --join to next section of code in case search value is split over two rows
        LEFT OUTER JOIN syscomments c2 ON o.id = c2.id AND c2.colid=c1.colid+1
    WHERE c1.text Like '%YourTableName%'
        OR RIGHT(c1.text,100)+LEFT(c2.text,100) Like '%YourTableName%'
    ORDER BY 1--,2

you could try running something like this:

SELECT DISTINCT
    o.name,o.type_desc
    FROM sys.sql_modules        m 
        INNER JOIN sys.objects  o ON m.object_id=o.object_id
    WHERE m.definition Like '%YourTableName%'
    ORDER BY 2,1

EDIT after OP mentioned SQL Server 2000

this should work on SQl Server 2000:

--remove comments to see the actual text too
SELECT DISTINCT
    o.name --,c1.colid,c1.text
    FROM sysobjects                  o
        INNER JOIN syscomments      c1 ON o.id = c1.id
        --join to next section of code in case search value is split over two rows
        LEFT OUTER JOIN syscomments c2 ON o.id = c2.id AND c2.colid=c1.colid+1
    WHERE c1.text Like '%YourTableName%'
        OR RIGHT(c1.text,100)+LEFT(c2.text,100) Like '%YourTableName%'
    ORDER BY 1--,2
那伤。 2024-08-14 19:08:53

尝试在命令列中查看 msdb..sysjobsteps 以获取目标表名称;仅当他们使用 T-SQL 填充表时这才有效。如果他们使用 SSIS(或 DTS)包,这将不起作用。

Try looking at msdb..sysjobsteps in the command column for the destination table names; this will only work if they are using T-SQL to populate the tables. If they're using an SSIS (or DTS) package, this won't work.

养猫人 2024-08-14 19:08:53

最有可能的是它是由审计表上的触发器填充的。

most likely it is being populated by triggers onteh the audited tables.

烙印 2024-08-14 19:08:53

如果您知道导致数据进入审核表的原因,您可以针对数据库运行一个(非常)简短的 Profiler 会话,专门针对该表进行过滤,同时触发操作。这将为您提供进一步的步骤来回溯根本操作。

If you know what causes data to go into the audit table, you can run a (very) brief Profiler session against the database, filtering specifically on that table, while triggering the action. That will give you further steps to back-trace the root action.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文