Skip to content

Commit e079bca

Browse files
20220713 adr pvs cleanup
1 parent 688925d commit e079bca

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

docs/relational-databases/system-stored-procedures/sys-sp-persistent-version-cleanup-transact-sql.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
description: "sys.sp_persistent_version_cleanup (Transact-SQL)"
2+
description: "The sys.sp_persistent_version_cleanup system stored procedure manually starts persistent version store (PVS) cleanup process, a key element of accelerated database recovery (ADR)."
33
title: "sys.sp_persistent_version_cleanup (Transact-SQL)"
44
ms.custom: ""
5-
ms.date: "02/18/2022"
5+
ms.date: 07/12/2022
66
ms.prod: sql
77
ms.reviewer: ""
88
ms.technology: system-objects
@@ -74,39 +74,44 @@ Requires the **ALTER DATABASE** permission to execute.
7474

7575
The `sys.sp_persistent_version_cleanup` stored procedure is synchronous, meaning that it will not complete until all version information is cleaned up from the current PVS.
7676

77-
Database Mirroring cannot be set for a database where ADR is enabled or there are still versions in the persisted version store (PVS). If ADR is disabled, run `sys.sp_persistent_version_cleanup` to clean up previous versions still in the PVS.
78-
79-
In SQL Server 2019, the PVS cleanup process only executes for one database at a time. In Azure SQL Database and Azure SQL Managed Instance, the PVS cleanup process can execute in parallel against multiple databases in the same instance.
77+
In SQL Server 2019, the PVS cleanup process only executes for one database at a time. In Azure SQL Database and Azure SQL Managed Instance, and beginning with [!INCLUDE[sssql22-md](../../includes/sssql22-md.md)], the PVS cleanup process can execute in parallel against multiple databases in the same instance.
8078

81-
If the PVS cleanup process is already running against the desired database, this stored procedure will be blocked and wait for completion before starting another PVS cleanup process. You can monitor the version cleaner task by looking for its process with the following sample query:
79+
If the PVS cleanup process is already running against the desired database, this stored procedure will be blocked and wait for completion before starting another PVS cleanup process. Active, long-running transactions in any database where ADR is enabled can also block scleanup of the PVS. You can monitor the version cleaner task by looking for its process with the following sample query:
8280

8381
```sql
8482
SELECT * FROM sys.dm_exec_requests
8583
WHERE command LIKE '%PERSISTED_VERSION_CLEANER%';
8684
```
8785

86+
87+
88+
### Limitations
89+
90+
Database Mirroring cannot be set for a database where ADR is enabled or there are still versions in the persisted version store (PVS). If ADR is disabled, run `sys.sp_persistent_version_cleanup` to clean up previous versions still in the PVS.
91+
8892
## Example
8993

90-
To activate the PVS cleanup process manually between workloads or during maintenance windows, use:
94+
To activate the PVS cleanup process manually between workloads or during maintenance windows, use the following sample script:
9195

9296
```sql
9397
EXEC sys.sp_persistent_version_cleanup [database_name];
9498
```
9599

96-
For example,
100+
For example:
97101

98102
```sql
99103
EXEC sys.sp_persistent_version_cleanup [WideWorldImporters];
100104
```
101105

102-
Or to assume the current database context,
106+
Or, to assume the current database context:
103107

104108
```sql
105109
USE [WideWorldImporters];
110+
GO
106111
EXEC sys.sp_persistent_version_cleanup;
107112
```
108113

109-
## See also
114+
## Next steps
110115

111116
- [Accelerated database recovery](../accelerated-database-recovery-concepts.md)
112117
- [Troubleshoot accelerated database recovery](../accelerated-database-recovery-troubleshoot.md)

0 commit comments

Comments
 (0)