我想知道如何识别实际填充 TEMPDB 数据库事务日志的确切查询或存储过程。
sql-server-2005 sql-server-2008 sql-server tempdb transaction-log
服务器 (SQL Server 2008) 的 tempdb 每月数次增加到 500GB+。是否可以找出导致此问题的 SQL 语句?问题通常不是由create table #temp...; insert into #temp...
或select ... into #temp...
复杂的连接引起的。
某些 tempdb 文件的初始大小每次也会自动设置为更大的值。如何预防?
有时缓存的计划会阻止调整/缩小文件的大小。如何找到哪一个持有tempdb?
我们有一个 SQL Server 2005 数据库,临时数据库已满。通过进入 SQL Server Management Studio,我可以看到 tempdb 中的所有临时表。是否可以判断哪个会话持有哪个临时表?理想情况下,一个查询将列出每个会话使用的临时表。
谢谢,
我在 SQL 2008 上有一个 TempDB,它变得非常大(> 40gb),我想缩小它。我已经通过 Management Studio 使用了 dbcc 收缩数据库、dbcc 收缩文件和收缩命令。
我收到以下错误:
页面 1:4573184 无法移动,因为它是工作表页面。
通过运行 DBCC FREEPROCCACHE 并重新运行其中一个收缩例程,我已经能够回收一些空间使我脱离危险,但显然这并不理想,而且可能只会给我争取一点时间。
我已经运行 DBCC OpenTran 并且没有任何东西挂在那里。
我在互联网上读到的所有地方都归结为回收 SQL Server ……肯定有更好的方法……有人吗?
谢谢,
汤姆
我们为一些 SQL Server 2005 数据库启用了“READ_COMMITTED_SNAPSHOT”。
现在我们不时看到我们的 TempDB 正在填满硬盘,我们怀疑版本存储是罪魁祸首。
我们监视 TempDB 的使用情况sys.dm_db_file_space_usage
,一旦我们看到版本存储在增加(如 所报告的那样 version_store_reserved_page_count
),我们希望识别正在使用版本存储的事务。
我正在使用以下语句来查找使用版本存储的事务:
SELECT db_name(spu.database_id) as database_name,
at.transaction_begin_time as begin_time,
case
when at.transaction_state in (0,1) then 'init'
when at.transaction_state = 2 then 'active'
when at.transaction_state = 3 then 'ended'
when at.transaction_state = 4 then 'committing'
when at.transaction_state = 6 then 'comitted'
when at.transaction_state = 7 then 'rolling back'
when at.transaction_state = 6 then 'rolled back'
else 'other'
end as transaction_state,
ast.elapsed_time_seconds as elapsed_seconds,
ses.program_name, …
Run Code Online (Sandbox Code Playgroud) 我在使用 sql 代理服务时遇到问题。是否有理由担心设置新的 sql broker 服务?我真的很担心这样做,但我有点不知所措,因为我知道它会清除要发送的消息队列,但这是我唯一需要担心的事情吗?当我运行此语句时,还有什么我应该寻找或必须完成的吗?