在sqlserver 2008中监视长时间运行的批处理

时间:2014-09-16 11:28:25

标签: sql-server oracle

我希望在Sql Server 2008中监视长时间运行的脚本。

我在oracle中搜索等效的dbms_application_info。我想在运行时和会话期间使用某种v$session表在会话上设置状态。

我知道我可以设置一个事件表,但我认为可能有一个构建解决方案(尽管我非常怀疑它已经处理了sql server一段时间了)。

1 个答案:

答案 0 :(得分:0)

您可以创建一个全局临时表(只需在表名前添加##)并将作业状态数据插入其中:

CREATE TABLE ##status …

全局临时表对其他会话/连接可见(因此"全局")并且一旦引用它的所有连接都关闭,它将自动被删除。

有关SQL Server中临时表的说明,请参阅例如Stack Overflow问题"Local and global temporary tables in SQL Server",特别是this answer listing the different kinds of temporary tables

相关问题