File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -49,22 +49,28 @@ SELECT
49
49
SUM(a.used_pages) * 8 AS UsedSpaceKB,
50
50
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
51
51
FROM
52
- tempdb.sys.tables t
52
+ tempdb.sys.tables(nolock) t
53
53
INNER JOIN
54
- tempdb.sys.schemas s ON s.schema_id = t.schema_id
54
+ tempdb.sys.schemas(nolock) s ON s.schema_id = t.schema_id
55
55
INNER JOIN
56
- tempdb.sys.indexes i ON t.OBJECT_ID = i.object_id
56
+ tempdb.sys.indexes(nolock) i ON t.OBJECT_ID = i.object_id
57
57
INNER JOIN
58
- tempdb.sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
58
+ tempdb.sys.partitions(nolock) p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
59
59
INNER JOIN
60
- tempdb.sys.allocation_units a ON p.partition_id = a.container_id
60
+ tempdb.sys.allocation_units(nolock) a ON p.partition_id = a.container_id
61
61
WHERE
62
62
t.NAME LIKE '#%' -- filter out system tables for diagramming
63
63
GROUP BY
64
64
t.Name, s.Name, p.Rows
65
65
ORDER BY
66
66
s.Name, t.Name
67
67
68
+ -- Get Log file information
69
+ select counter_name,instance_name, SizeInMB=cntr_value/1024
70
+ from sys.dm_os_performance_counters
71
+ where counter_name in('Log File(s) Size (KB)','Log File(s) Used Size (KB)')
72
+ and instance_name='tempdb'
73
+
68
74
69
75
70
76
-- another option to monitor TemoDB usage is by using Adam Machanic WhoIsActive stored procedure.
You can’t perform that action at this time.
0 commit comments