You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: DBCC SQLPERF provides transaction log space usage statistics for all databases.
4
4
author: rwestMSFT
5
5
ms.author: randolphwest
6
-
ms.date: 12/05/2022
6
+
ms.date: 12/05/2025
7
7
ms.service: sql
8
8
ms.subservice: t-sql
9
9
ms.topic: reference
@@ -24,9 +24,7 @@ dev_langs:
24
24
25
25
[!INCLUDE [SQL Server SQL Database Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdb-asdbmi.md)]
26
26
27
-
Provides transaction log space usage statistics for all databases. In [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], it can also be used to reset wait and latch statistics.
28
-
29
-
**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions, and [!INCLUDE[sssds](../../includes/sssds-md.md)] ([Preview in some regions](/azure/azure-sql/database/features-comparison?WT.mc_id=TSQL_GetItTag))
27
+
Provides transaction log space usage statistics for all databases. Can also be used to reset wait and latch statistics.
Returns the current size of the transaction log and the percentage of log space used for each database. Use this information to monitor the amount of space used in a transaction log.
50
48
51
49
> [!IMPORTANT]
52
-
> For more information about space usage information for the transaction log starting with [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)], see the [Remarks](#remarks) section in this topic.
50
+
> For more information about space usage information for the transaction log starting with [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)], see the [Remarks](#remarks) section in this article.
53
51
54
52
#### "sys.dm_os_latch_stats", CLEAR
55
53
56
-
Resets the latch statistics. For more information, see [sys.dm_os_latch_stats (Transact-SQL)](../../relational-databases/system-dynamic-management-views/sys-dm-os-latch-stats-transact-sql.md). This option isn't available in [!INCLUDE[ssSDS](../../includes/sssds-md.md)].
54
+
Resets the latch statistics. For more information, see [sys.dm_os_latch_stats](../../relational-databases/system-dynamic-management-views/sys-dm-os-latch-stats-transact-sql.md).
57
55
58
56
#### "sys.dm_os_wait_stats", CLEAR
59
57
60
-
Resets the wait statistics. For more information, see [sys.dm_os_wait_stats (Transact-SQL)](../../relational-databases/system-dynamic-management-views/sys-dm-os-wait-stats-transact-sql.md). This option isn't available in [!INCLUDE[ssSDS](../../includes/sssds-md.md)].
58
+
Resets the wait statistics. For more information, see [sys.dm_os_wait_stats](../../relational-databases/system-dynamic-management-views/sys-dm-os-wait-stats-transact-sql.md).
61
59
62
60
#### WITH NO_INFOMSGS
63
61
64
62
Suppresses all informational messages that have severity levels from 0 through 10.
65
63
66
-
## Result sets
64
+
## Result set
67
65
68
66
The following table describes the columns in the result set.
69
67
70
68
| Column name | Definition |
71
69
| --- | --- |
72
70
|**Database Name**| Name of the database for the log statistics displayed. |
73
-
|**Log Size (MB)**| Current size allocated to the log. This value is always smaller than the amount originally allocated for log space because the [!INCLUDE[ssDE](../../includes/ssde-md.md)] reserves a small amount of disk space for internal header information. |
71
+
|**Log Size (MB)**| Current size allocated to the log. This value is always smaller than the amount originally allocated for log space because the [!INCLUDE[ssDE](../../includes/ssde-md.md)] reserves a small amount of disk space for internal header information. |
74
72
|**Log Space Used (%)**| Percentage of the log file currently in use to store transaction log information. |
75
73
|**Status**| Status of the log file. Always 0. |
76
74
77
75
## Remarks
78
76
79
-
Starting with [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)], use the [sys.dm_db_log_space_usage](../../relational-databases/system-dynamic-management-views/sys-dm-db-log-space-usage-transact-sql.md) DMV instead of `DBCC SQLPERF(LOGSPACE)`, to return space usage information for the transaction log per database.
77
+
Starting with [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)], use the [sys.dm_db_log_space_usage](../../relational-databases/system-dynamic-management-views/sys-dm-db-log-space-usage-transact-sql.md) DMV instead of `DBCC SQLPERF(LOGSPACE)`, to return space usage information for the transaction log per database.
80
78
81
-
The transaction log records each transaction made in a database. For more information, see [The Transaction Log (SQL Server)](../../relational-databases/logs/the-transaction-log-sql-server.md) and [SQL Server Transaction Log Architecture and Management Guide](../../relational-databases/sql-server-transaction-log-architecture-and-management-guide.md).
79
+
The transaction log records each transaction made in a database. For more information, see [The transaction log](../../relational-databases/logs/the-transaction-log-sql-server.md) and [SQL Server transaction log architecture and management guide](../../relational-databases/sql-server-transaction-log-architecture-and-management-guide.md).
82
80
83
81
## Permissions
84
82
85
-
[!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] requires **VIEW SERVER STATE** permission on the server to run `DBCC SQLPERF(LOGSPACE)`. To reset wait and latch statistics requires `ALTER SERVER STATE` permission on the server.
83
+
[!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] requires `VIEW SERVER STATE` permission on the server to run `DBCC SQLPERF(LOGSPACE)`. To reset wait and latch statistics requires `ALTER SERVER STATE` permission on the server.
86
84
87
-
[!INCLUDE[ssSDS](../../includes/sssds-md.md)] Premium and Business Critical tiers require the **VIEW DATABASE STATE** permission in the database. [!INCLUDE[ssSDS](../../includes/sssds-md.md)] Standard, Basic, and General Purpose tiers require the [!INCLUDE[ssSDS](../../includes/sssds-md.md)] admin account. Reset wait and latch statistics aren't supported.
85
+
[!INCLUDE[ssSDS](../../includes/sssds-md.md)] Premium and Business Critical tiers require the `VIEW DATABASE STATE` permission in the database. [!INCLUDE[ssSDS](../../includes/sssds-md.md)] Standard, Basic, and General Purpose tiers require the [!INCLUDE[ssSDS](../../includes/sssds-md.md)] admin account.
88
86
89
87
## Examples
90
88
91
89
### A. Display log space information for all databases
92
90
93
-
The following example displays `LOGSPACE` information for all databases contained in the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
91
+
The following example displays `LOGSPACE` information for all databases contained in the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
0 commit comments