/*
-- 0. 高速压缩tempdb为初始值
USE tempdb
DBCC SHRINKFILE(2,TRUNCATEONLY);
*/-- 1. tempdb以下未回收的暂时表 ,某些版本号可能查不到数据
use tempdb;
select * from sys.objects o where o.type like '%U%';-- Chapter 7 - Knowing Tempdb
-- christian@coeo.com-- Show tempdb usage by type across all files
SELECT  SUM(user_object_reserved_page_count) AS user_object_pages,SUM(internal_object_reserved_page_count) AS internal_object_pages,SUM(version_store_reserved_page_count) AS version_store_pages,total_in_use_pages = SUM(user_object_reserved_page_count)+ SUM(internal_object_reserved_page_count)+ SUM(version_store_reserved_page_count),SUM(unallocated_extent_page_count) AS total_free_pages
FROM    sys.dm_db_file_space_usage ;-- Find the top 5 sessions running tasks that use tempdb
SELECT TOP 5*
FROM    sys.dm_db_task_space_usage
WHERE   session_id > 50
ORDER BY user_objects_alloc_page_count + internal_objects_alloc_page_count DESC ;--return currently running T-SQL with Execution Plans
SELECT  session_id,text,query_plan
FROM    sys.dm_exec_requestsCROSS APPLY sys.dm_exec_sql_text(sql_handle)CROSS APPLY sys.dm_exec_query_plan(plan_handle) ;--view historic tempdb usage by session
SELECT  *
FROM    sys.dm_db_session_space_usage
WHERE   session_id > 50
ORDER BY user_objects_alloc_page_count + internal_objects_alloc_page_count DESC ;-- Temp Tables Creation Rate
SELECT  *
FROM    sys.dm_os_performance_counters
WHERE   counter_name = 'Temp Tables Creation Rate' ;

转载于:https://www.cnblogs.com/yutingliuyl/p/7084585.html

tempdb 相关总结相关推荐

  1. tempdb相关文章

    Why does the buffer pool contain so many dirty tempdb pages? 本文大意: 对于tempdb来说,还原模式为简单模式也只能是简单模式,不需要从 ...

  2. SQL Server 2019 (15.x) 新特性概要

    2019.11.4 SQL Server 2019发布,趁热打铁了解下2019的新特性.下面整理一些个人感觉重要的或者工作上能用到的新特性,有删减,完整版参考 SQL Server 2019 中的新增 ...

  3. [转]oracle临时表相关知识

    回复: 临时表存放在哪儿? DML statements on temporary tables do not generate redo logs for the data changes. How ...

  4. 转:asp.net 负载平衡-Session相关

    来自:http://www.cnblogs.com/zxylonely/archive/2009/12/23/1630197.html http://blog.csdn.net/lvlingwy/ar ...

  5. 第八章 了解tempdb数据库

    1.一个sqlserver数据库实例上只能有一个tempdb数据库,这个实例上所有的用户都共享这个数据库. 2.tempdb数据库在每次sqlserver重启后都会重新创建,所以数据会丢失. 3.因为 ...

  6. SQL Server Junior Database Administrator方案相关的访谈问答

    In this article, we will discuss a number of questions that you may be asked when applying to a juni ...

  7. sql tempdb清理_SQL Server 2019中的内存优化的TempDB元数据

    sql tempdb清理 介绍 (Introduction) In-memory technologies are one of the greatest ways to improve perfor ...

  8. 数据文件shrink_SQL Server中的Shrink TempDB数据库概述

    数据文件shrink This article explores the usage of TempDB and different ways to shrink the TempDB databas ...

  9. tempdb数据库清理_tempdb数据库,简介和建议

    tempdb数据库清理 介绍 ( Introduction ) Many times the people focus on the user databases to improve the per ...

最新文章

  1. 提升大学社团管理工具--轻雀协作
  2. 放心,GPT-3不会“杀死”编程
  3. client-go删除job同时删除job关联的pod
  4. 【SSM框架系列】Mybatis基本介绍
  5. angularjs directive 的几点使用技巧
  6. #舍得Share#Flash Media Server4.5迅雷高速下载地址by lwxshow
  7. 神经网络如何处理测试阶段出现的新特征?面向开放环境特征外推的图学习解决方案...
  8. jquery validate常用方法及注意问题
  9. SAP Spartacus 如何借助env-cmd 实现 B2B 和 B2C 功能启动的无缝切换
  10. 两数之和(Leetcode第1题)
  11. 蔚来汽车回应“十四万元补胎”纠纷:车主未及时报案 除轮胎外底盘也严重受损...
  12. 开发对接微信卡包会员卡_产品||AI刷脸会员+电子会员卡
  13. python二分法代码_Python的算法之二分法
  14. C++结构体传参问题
  15. Simulink仿真---clark变换、反clark变换
  16. 嵌入式Linux使用TFT屏幕:使用TinyDRM点亮ST7789V屏幕
  17. 小糊涂家装预算软件 官方
  18. 鸿蒙初开三界未立,太子长琴
  19. vc6.0 如何添加全局变量
  20. 沐风:小程序固然好!凭什么能自动赚钱?

热门文章

  1. 四川中职计算机专业考的学校,四川中职学校哪家专业
  2. textview加载html glide,TextView加载HTML,文字和图片
  3. java 常量区存放 new_java---堆、栈、常量池的存储数据
  4. c语言内容逆置程序设计,C语言程序设计练习题含程序及参考答案.docx
  5. python django restful框架_Django RESTful API 实例带你快速上手开发
  6. python爬取百度文库_利用Python语言轻松爬取数据
  7. php mysql query 行数_如何在PHP中获取MYSQL数据库返回的数据的行数?
  8. java 规格overview_《Java數據結構和算法》- OverView
  9. php poi,GitHub - satthi/poi-php: poi-php
  10. centos7恢复mysql数据库_mysql数据库恢复过程记录