SQL Server:如何找出正在更改我的数据的内容?
这是我的问题的简化版本:
我的表格中有很多文章。假设有 10,000 行。大约每周一次,ArticleAuthor 列 [Nvarchar(255)] 的 5-10 个值会被相同的数据覆盖 - 全部来自另一篇文章。
该代码实际上非常庞大且陈旧,并且事实证明很难找到有问题的进程。
我想我可能会在表上放置一个临时触发器来记录它何时更新等并从那里开始工作。
有人有更好的想法吗?
提前致谢!
顺便说一句,我正在使用 SQL Server 2005!
Here's a simplified version of my problem:
I have lots of articles in a table. Say, 10,000 rows. About once a week 5-10 of the values of the ArticleAuthor column [Nvarchar(255)] get overwritten with the same data - all from another article.
The code is actaully really huge and old and it's proved tough to find the offending process.
I'm thinking I might put a temporary trigger on the table to log when it gets updated etc and work from there.
Anyone got any better ideas?
Thanks in advance!
I'm using SQL Server 2005 by the way!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以使用 SQL Profiler 并让它运行一周,然后解析结果日志以查找有问题的进程。确保使用过滤器来减少日志记录。
You could also use SQL Profiler and leave it running for a week and then parse the result log to find the offending process. Make sure you use filters though to trim down the logging.
除非数据为您提供日期/时间信息,否则临时触发器可能是最好的起点。您还可以尝试在应用程序代码中搜索关键字(“UPDATE TABLENAME”或“Set ArticleAuthor=”)。我还会查看现有的触发器,以确保它们都不包含恶意代码。
Unless the data provides you date/time information a temporary trigger is probably the best starting point. You could also try searching application code for keywords like ('UPDATE TABLENAME' or 'Set ArticleAuthor='). I would also take a look at the triggers that are already on the table to make sure none of them contain the rogue code.