|
1 | 1 | --- |
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)." |
3 | 3 | title: "sys.sp_persistent_version_cleanup (Transact-SQL)" |
4 | 4 | ms.custom: "" |
5 | | -ms.date: "02/18/2022" |
| 5 | +ms.date: 07/12/2022 |
6 | 6 | ms.prod: sql |
7 | 7 | ms.reviewer: "" |
8 | 8 | ms.technology: system-objects |
@@ -74,39 +74,44 @@ Requires the **ALTER DATABASE** permission to execute. |
74 | 74 |
|
75 | 75 | 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. |
76 | 76 |
|
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. |
80 | 78 |
|
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: |
82 | 80 |
|
83 | 81 | ```sql |
84 | 82 | SELECT * FROM sys.dm_exec_requests |
85 | 83 | WHERE command LIKE '%PERSISTED_VERSION_CLEANER%'; |
86 | 84 | ``` |
87 | 85 |
|
| 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 | + |
88 | 92 | ## Example |
89 | 93 |
|
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: |
91 | 95 |
|
92 | 96 | ```sql |
93 | 97 | EXEC sys.sp_persistent_version_cleanup [database_name]; |
94 | 98 | ``` |
95 | 99 |
|
96 | | -For example, |
| 100 | +For example: |
97 | 101 |
|
98 | 102 | ```sql |
99 | 103 | EXEC sys.sp_persistent_version_cleanup [WideWorldImporters]; |
100 | 104 | ``` |
101 | 105 |
|
102 | | -Or to assume the current database context, |
| 106 | +Or, to assume the current database context: |
103 | 107 |
|
104 | 108 | ```sql |
105 | 109 | USE [WideWorldImporters]; |
| 110 | +GO |
106 | 111 | EXEC sys.sp_persistent_version_cleanup; |
107 | 112 | ``` |
108 | 113 |
|
109 | | -## See also |
| 114 | +## Next steps |
110 | 115 |
|
111 | 116 | - [Accelerated database recovery](../accelerated-database-recovery-concepts.md) |
112 | 117 | - [Troubleshoot accelerated database recovery](../accelerated-database-recovery-troubleshoot.md) |
|
0 commit comments