如何在 Sybase 中杀死不守规矩的 spid?
我的数据库中有几个流氓 spid,当我以 sa
身份登录并使用 sp_who
时,我可以看到它们正在休眠,但尝试使用 kill
消除它们失败了,我实际上无权访问服务器本身来反弹它。 还有其他方法可以消灭这些东西吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
系统进程无法被杀死。 例如,在 sp_who 的输出中,其中 cmd 为 NETWORK HANDLER、MIRROR HANDLER 和 CHECKPOINT SLEEP(或很少为 CHECKPOINT),并且无法终止 AUDIT PROCESS。 如果它们的状态为“recv sleep”、“send sleep”、“alarm sleep”和“lock sleep”,则可以杀死它们。
在 sp_who 输出中,您无法判断状态为“recv sleep”的进程是否属于正在使用 SQL Server 的用户,但可能正在暂停以检查命令的结果,或者该进程是否指示用户已重新启动 SQL Server PC或其他终端,并留下了一个搁浅的进程。您可以通过查询sysprocesses表来了解有关可疑进程的更多信息。 例如:
select hostprocess, program_name from sysprocesses where spid = 8
如果program_name是isql,你就知道这个spid可以被杀死。(依此类推...)
System processes cannot be killed. For example in the output of sp_who where cmd is NETWORK HANDLER, MIRROR HANDLER and CHECKPOINT SLEEP (or rarely, CHECKPOINT) and AUDIT PROCESS cannot be killed. If they have status as "recv sleep", "send sleep", "alarm sleep" and "lock sleep" , they can be killed.
In sp_who output, you cannot tell whether a process whose status is "recv sleep" belongs to a user who is using SQL Server, but may be pausing to examine the results of a command, or whether the process indicates that a user has rebooted a PC or other terminal, and left a stranded process.You can learn more about a questionable process by querying the sysprocesses table for information. For ex :
select hostprocess, program_name from sysprocesses where spid = 8
If program_name is isql you know that this spid can be killed.(and so forth ... )
我有一个客户端应用程序有时会执行类似的操作。 客户端通常处于选择过程中,但不再检索行。 (这可能是客户端光标,但我不确定)。 这些蜘蛛看起来是杀不死的。 我必须找到用户并要求他们注销。
我遇到的另一种情况是在服务器上出现错误或堆栈跟踪之后。 检查您的错误日志,看看其中是否有任何可疑的条目。 如果有,那么重新启动将是您唯一的选择。
I have a client application that sometimes does similar things. The client is usually in the middle of a select, but is no longer retrieving rows. (This may be a client side cursor, but I'm not sure). These spids seem un-killable. I have to find the user and ask them to log off.
The other scenario in which I've had these is after errors or stacktraces on the server. Check your errorlog to see if there's any dodgy entries in there. If there is then a restart is going to be your only option.