如何查看SQL Server中更改了哪些表? [英] How can I see which tables are changed in SQL Server?

查看:211
本文介绍了如何查看SQL Server中更改了哪些表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我没有建立的数据库,现在我必须在该数据库上工作。我必须插入一些信息,但是某些信息必须保存在一个表而不是多个表中。我

I have a database which I didn't make and now I have to work on that database. I have to insert some information, but some information must be saved in not one table but several tables. I

可以使用创建数据库并在其中插入信息的程序。在执行此操作时,我想查看哪些表已更新。我听说SQL Server Management Studio有一个使我们看到更改的工具或其他工具。

can use the program which have made the database and insert information with that. While I am doing that, I want to see that which tables are updated. I heard that SQL Server Management Studio has a tool or something which make us see changes.

您知道吗?如果没有,我如何查看数据库表上的更改?如果您不明白我的问题,请问我的意思。谢谢

Do you know something like that? If you don't, how can I see changes on the database's tables? If you don't understand my question, please ask what I mean. Thanks

编辑:是的,绝对是我想要的Sql Profiler,但是我使用的是SQL Server 2008 R2 Express,在Express版中,Sql Profiler工具在工具菜单选项中不存在。现在我正在寻找如何添加它。

Edit : Yes absolutely Sql Profiler is what I want but I am using SQL Server 2008 R2 Express and in Express edition, Sql Profiler tool does not exist in Tools menu option. Now I am looking for how to add it.

编辑2:尤其是@SchmitzIT,谢谢大家对他的回答。我将SQL Server Management Studio从2008 R2速成版升级到了2012 Web Developer Edition。

Edit 2 : Thank you all especially @SchmitzIT for his pictured answer. I upgraded my SQL Server Management Studio from 2008 R2 express edition to 2012 Web Developer Edition. SQL Profiller Trace definitely works.

推荐答案

我同意@ Lmu92。 SQL Server Profiler是您想要的。

I agree with @Lmu92. SQL Server Profiler is what you want.

从SQL Server Management Studio中,单击工具菜单选项,然后选择使用 SQL SErver Profiler启动工具。配置文件允许您实时查看针对数据库执行的语句以及这些语句的统计信息(处理请求所花费的时间,以及有关语句对服务器本身影响的统计信息)。

From SQL Server Management Studio, click on the "Tools" menu option, and then select to use "SQL SErver Profiler" to launch the tool. The profier will allow you to see statements executed against the database in real time, along with statistics on these statements (time spent handling the request, as well as stats on the impact of a statement on the server itself).

统计信息在对性能进行故障排除时可以提供真正的帮助,因为它可以帮助您确定长时间运行的查询或对磁盘系统有重大影响的查询

The statistics can be a real help when you're troubleshooting performance, as it can help you identify long running queries, or queries that have a significant impact on your disk system.

在繁忙的数据库上,您可能最终会看到很多信息,因此弄清楚幕后发生的事情的关键是确保实现正确过滤事件。

On a busy database, you might end up seeing a lot of information zip by, so the key to figuring out what's happening behind the scenes is to ensure that you implement proper filtering on the events.

为此,将Profiler连接到服务器后,在跟踪属性屏幕中,单击事件选择选项卡:

To do so, after you connect Profiler to your server, in the "Trace properties" screen, click the "Events Selection" tab:

您最好取消选中审核列前面的框,因为它们与您的特定问题无关。但是,此屏幕上的重要位是列过滤器按钮:

You probably are good to uncheck the boxes in front of the "Audit" columns, as they are not relevant for your specific issue. However, the important bit on this screen is the "Column filters" button:

在这里您将能够实现仅显示要查看数据的过滤器。例如,可以将过滤器添加到 ApplicationName,以确保仅看到由具有指定名称的应用程序生成的事件。只需单击赞旁边的 +号,您就可以在文本框中填写应用程序名称。

This is where you will be able to implement filters that only show you the data you want to see. You can, for instance, add a filter to the "ApplicationName", to ensure you only see events generated by an application with the name you specify. Simply click on the "+" sign next to "Like", and you will be able to fill in an application name in the textbox.

如果需要,可以选择添加其他过滤器(例如, NTUsername按AD用户名过滤,或SQL Server用户的 LoginName。)

You can choose to add additional filters if you want (like "NTUsername" to filter by AD username, or "LoginName" for an SQL Server user.

对结果感到满意后,单击确定,就可以开始看到一些结果,然后您可以在分析器跟踪运行时使用该应用程序执行所需的任务,然后停止它

Once you are satisfied with the results, click "OK", and you will hopefully start seeing some results. Then you can simply use the app to perform the task you want while the profiler trace runs, and stop it once you are done.

然后您可以滚动浏览收集的数据以查看其对数据库的确切作用,结果也可以存储为表格以方便

You can then scroll through the collected data to see what exactly it has been doing to your database. Results can also be stored as a table for easy querying.

希望这会有所帮助。

这篇关于如何查看SQL Server中更改了哪些表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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