SQL Server 2005 变更审核

发布于 2024-07-10 08:19:39 字数 87 浏览 9 评论 0原文

SQL Server 2005 中是否有内置的方法来审计诸如删除存储过程之类的事情? 有没有历史表可以查询? 我们有一个神秘的存储过程,现在已经消失了几次。

Is there a built in way in SQL Server 2005 to audit things specifically like deleting a stored procedure? Is there a history table that I can query? We have a mystery sproc that has disappeared a few times now.

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

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

发布评论

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

评论(6

长发绾君心 2024-07-17 08:19:39

您可以使用 DDL 触发器构建此触发器:

http://msdn.microsoft.com/ en-us/library/ms190989.aspx

You can build this using DDL triggers:

http://msdn.microsoft.com/en-us/library/ms190989.aspx

剑心龙吟 2024-07-17 08:19:39

仅当您使用DDL 触发器或使用分析器跟踪文本“% DROP%PROC%procname%"

Only if you use DDL triggers or use profiler to trace text "%DROP%PROC%procname%"

穿越时光隧道 2024-07-17 08:19:39

请注意,在 SQL Server 2008 中,他们现在还使用 AUDIT 来取代 Profiler Traces 来进行审计活动。 类似但有自己的配置 UI 和查看结果的 UI

Note that in SQL Server 2008 they also now have AUDIT to replace Profiler Traces for auding activities. It is similar but has its own configuration UI and UI to view results

浪推晚风 2024-07-17 08:19:39

您可以设置探查器跟踪来捕获审核架构对象管理事件并根据您关心的数据库名称进行过滤。 每当创建、删除、编辑架构中的对象时,都会在探查器中触发一个事件,其中包括进行更改的人员和存储过程的名称。

您至少需要这些分析器列:
ApplicationName - 进行更改时正在运行的应用程序用户的名称
DatabaseName - 包含已更改对象的数据库
EventSubClass - 操作类型显示更改、修改、删除、创建等
LoginName - 进行更改的用户
ObjectName - 受影响的对象

You can setup a profiler trace to capture the Audit Schema Object Management event and filter based on the database name you care about. Any time an object in the schema is created, dropped, edited it will fire an event in profiler that includes the person who did the change and the name of the stored procedure.

You will want at least these profiler columns:
ApplicationName - name of app user was running when they made change
DatabaseName - Databse containing the object changed
EventSubClass - Type of action shows Alter, Modify, Drop, Create etc
LoginName - user making change
ObjectName - object affected

¢蛋碎的人ぎ生 2024-07-17 08:19:39

[较晚的一篇,但添加了有关如何在审核系统到位之前查看谁进行了更改的详细信息]

其他人已经介绍了您可以开始审核数据以监控未来更改的不同方式,但如果您最初没有任何审核如果系统已经到位,那么很难找出历史上谁做了什么以及何时做了。

唯一的选择是假设数据库处于完全恢复模式,尝试读取事务日志。 问题是默认情况下不支持此功能。 选项包括:

有关更多详细信息,请参阅以下主题:

如何在 SQL Server 2008 中查看事务日志

SQL Server 事务日志资源管理器/分析器

如何在 SQL Server Management Studio 中查看查询历史记录

[late one but adds details on how to see who made the change even before auditing system is put into place]

Others have already covered different ways you can start auditing data in order to monitor future changes but if you originally didn’t have any auditing system in place then it’s very difficult to find out who did what and when historically.

Only option is to try reading transaction log assuming database is in full recovery mode. Problem is that this is not supported by default. Options are:

See these topics for more details:

How to view transaction log in SQL Server 2008

SQL Server Transaction Log Explorer/Analyzer

How to see query history in SQL Server Management Studio

初见你 2024-07-17 08:19:39

我同意。 它可以是带有过滤器的 SQL Server 分析器。 SQL Server 中存在 DDL 触发器。
您可以创建如下内容:

 CREATE TRIGGER ddl_drop_procedure 
    ON DATABASE 
    FOR DROP_PROCEDURE
   AS 
     RAISERROR ('You deleted a stored procedure',10, 1)

   GO

另一个选项是使用第三方工具,例如 Codeplex 中的 Auto Audit 或 apexSQL 触发器。

I agree. It can be the SQL Server profiler with filters. The DDL triggers existed in SQL Server.
You could create something like this:

 CREATE TRIGGER ddl_drop_procedure 
    ON DATABASE 
    FOR DROP_PROCEDURE
   AS 
     RAISERROR ('You deleted a stored procedure',10, 1)

   GO

The other option is to use third party tools like Auto Audit from codeplex, or apexSQL trigger.

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