使用触发器进行跟踪 [英] Tracing With Triggers

查看:115
本文介绍了使用触发器进行跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 sql server 2005 ,如果特定用户"A"已登录网站并在wesite上进行了一些修改,则它们将反映在数据库中,因此我有一个应用程序.所以我想创建一个触发器来跟踪该特定用户对数据库的所有表所做的修改.


所以我以为我会创建 trigger ,因此,如果用户尝试更新或删除所有表中的任何记录,那么我们将监视该用户是否做了某些事情(例如更新或删除了某些记录).
有人可以建议我使用触发器进行监视是正确的方法还是需要以其他方式进行处理.

所有跟踪信息都应保存在文本文件中
谢谢
Srinivas

Hi i am using sql server 2005 , i have an application if a particular user "A" is logged in to website and does some modifications on the wesite so they will be reflected on the database. so i want to create a triggers to trace the modifications done by that particular user on all the tables of the database.


so i thought i will create trigger so if the user is trying to update or delete any record in all tables then we monitor that user had done something(like updating or deleted some records).
can someone please suggest me is it correct way to monitor with triggers or need to approach in different way.

all the tracing information should be saved in a text file
Thanks
Srinivas

推荐答案

您可以选择的一种方法是使用SQL Server Profiler ..非常强大的工具...但是要小心,因为文件会变得很大..考虑一下您的磁盘空间也...

One option for you is to use SQL Server Profiler.. very powerful tool...but be careful as files get really large.. think about your disk space as well...

http://technet.microsoft.com/en-us/library/ms181091[^]


这篇关于使用触发器进行跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆