Skip to content

Commit 38ce61f

Browse files
Update AzureTempDB_SpaceMonitoring.txt
Adding log file information
1 parent 74e9fd5 commit 38ce61f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

AzureTempDB_SpaceMonitoring.txt

+11-5
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,28 @@ SELECT
4949
SUM(a.used_pages) * 8 AS UsedSpaceKB,
5050
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
5151
FROM
52-
tempdb.sys.tables t
52+
tempdb.sys.tables(nolock) t
5353
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
5555
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
5757
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
5959
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
6161
WHERE
6262
t.NAME LIKE '#%' -- filter out system tables for diagramming
6363
GROUP BY
6464
t.Name, s.Name, p.Rows
6565
ORDER BY
6666
s.Name, t.Name
6767

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+
6874

6975

7076
-- another option to monitor TemoDB usage is by using Adam Machanic WhoIsActive stored procedure.

0 commit comments

Comments
 (0)