TempDb在SQL Server上的问题

huangapple go评论62阅读模式
英文:

Problems with TempDb on the SQL Server

问题

我遇到了一些关于我的SQL Server的问题。一些外部查询写入Temp db,每2-3天它就会变满,我们不得不重新启动SQL数据库。我已经使用Whoisactive进行了监视,而且我们还可以在Grafana上进行监视。因此,当查询开始大量写入临时数据库时,我可以获得确切的时间。有人可以告诉我如何在获得确切时间后搜索用户吗?

select top 40 User_Account, start_date, tempdb_allocations
from Whoisactive
where start_date between '15-02-2023 14:12:14.13' and '15-02-2023 15:12:14.13'
order by tempdb_allocations desc
User_Account Start_Date tempdb_allocations
kkarla1 15-02-2023 14:12:14.13 12
bbert2 11-02-2023 12:12:14.13 0
ubert5 15-02-2023 15:12:14.13 888889

<details>
<summary>英文:</summary>

I got some problems with my SQL Server. Some external queries write into the Temp db and every 2-3 days it is full and we have to restart the SQL database. I got who is active on it. And also we can check monitor it over grafana. So I get a exact time when the query starts to write a lot of data into the temp db. Can someone give me a tip on how I can search for the user when I get the exact time?

select top 40 User_Account, start_date, tempdb_allocations
from Whoisactive
order by tempdb_allocation, desc
where start_date between ('15-02-2023 14:12:14.13' and '15-02-2023 15:12:14.13')



| User_Account | Start_Date              |tempdb_allocations|
| --------     |  --------               |-------- 
| kkarla1      | 15-02-2023 14:12:14.13  |12   |
| bbert2       | 11-02-2023 12:12:14.13  |0  |
| ubert5       | 15-02-2023 15:12:14.13  |888889  |

</details>


# 答案1
**得分**: 1

无法翻译的部分:代码部分

翻译部分:
我本想将这个作为评论添加,但我没有必要的声誉点数。

无论如何,你可能会发现这个有帮助。
[链接]:https://dba.stackexchange.com/questions/182596/temp-tables-in-tempdb-are-not-cleaned-up-by-the-system

它并不是没有自身的缺点,但我认为如果另一种选择是每2或3天重新启动服务器,这可能已经足够了。

如果你能添加一些关于导致tempdb溢出的作业的更多细节,那也可能会有所帮助。

这个有问题的作业是每天调用你的数据库吗?每分钟一次?还是更频繁?

我之所以这么问,是因为如果它更像是每天调用一次,那么我认为链接中的答案更可能有帮助。

<details>
<summary>英文:</summary>

I would add this as a comment but I don’t have the necessary reputation points.

At any rate - you might find this helpful.

https://dba.stackexchange.com/questions/182596/temp-tables-in-tempdb-are-not-cleaned-up-by-the-system

It isn’t without its own drawbacks but I think that if the alternative is restarting the server every 2 or 3 days this may be good enough.

It might also be helpful if you add some more details about the jobs that are blowing up your tempdb.

Is this problematic job calling your database once a day?  Once a minute? More?

I ask because if it’s more like once a day then I think the answer in the link is more likely to be helpful.





</details>



huangapple
  • 本文由 发表于 2023年2月16日 07:23:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75466351.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定