|
1 | 1 | --- |
2 | 2 | title: "Troubleshoot full transaction log error 9002" |
3 | 3 | description: Learn about possible responses to a full transaction log in SQL Server and how to avoid the problem in the future. |
4 | | -ms.date: "06/22/2021" |
| 4 | +ms.date: "09/14/2021" |
5 | 5 | ms.prod: sql |
6 | 6 | ms.prod_service: "database-engine" |
7 | 7 | ms.reviewer: "" |
@@ -52,7 +52,7 @@ ms.custom: "seo-lt-2019" |
52 | 52 | - Replication or availability group synchronization that is unable to complete |
53 | 53 |
|
54 | 54 |
|
55 | | -## Resolving a full transaction log |
| 55 | +## How to resolve a full transaction log |
56 | 56 |
|
57 | 57 | The following specific steps will help you find the reason for a full transaction log and resolve the issue. |
58 | 58 |
|
@@ -255,13 +255,13 @@ The most common actions you can consider here is to review your database recover |
255 | 255 |
|
256 | 256 | #### Recovery model |
257 | 257 |
|
258 | | -Consider each database's to recovery model carefully. Perform log backups on all databases in FULL or BULK_LOGGED recovery models. For more information, see [Recovery Models](../backup-restore/recovery-models-sql-server.md) |
| 258 | +The transaction log may be failing to truncate with LOG_BACKUP log_reuse_wait category, because you have never backed it up. In many of those cases, your database is using FULL or BULK_LOGGED recovery model, but you did not back up transaction logs. You should consider each database recovery model carefully: perform transaction log backups on all databases in FULL or BULK LOGGED recovery models to minimize occurrences of error 9002. For more information, see [Recovery Models](../backup-restore/recovery-models-sql-server.md) |
259 | 259 |
|
260 | 260 | #### Back up the log |
261 | 261 |
|
262 | | -Under the FULL or BULK_LOGGED recovery model, if the transaction log has not been backed up recently, backup might be what is preventing log truncation. If the log has never been backed up, you **must create two log backups** to permit the [!INCLUDE[ssDE](../../includes/ssde-md.md)] to truncate the log to the point of the last backup. Truncating the log frees logical space for new log records. To keep the log from filling up again, take log backups regularly and more frequently. For more information, see [Recovery Models](../backup-restore/recovery-models-sql-server.md). |
| 262 | +Under the FULL or BULK_LOGGED recovery model, if the transaction log has not been backed up recently, backup might be what is preventing log truncation. You must back up the transaction log to allow log records to be released and the log truncated. If the log has never been backed up, you **must create two log backups** to permit the [!INCLUDE[ssDE](../../includes/ssde-md.md)] to truncate the log to the point of the last backup. Truncating the log frees logical space for new log records. To keep the log from filling up again, take log backups regularly and more frequently. For more information, see [Recovery Models](../backup-restore/recovery-models-sql-server.md). |
263 | 263 |
|
264 | | -To review the complete backup history of a database, use the following sample script: |
| 264 | +A complete history of all SQL Server backup and restore operations on a server instance is stored in the `msdb` system database. To review the complete backup history of a database, use the following sample script: |
265 | 265 |
|
266 | 266 | ```tsql |
267 | 267 | SELECT bs.database_name |
@@ -290,7 +290,9 @@ AND bs.backup_start_date > DATEADD(month, -2, sysdatetime()) --only look at last |
290 | 290 | ORDER BY bs.database_name asc, bs.Backup_Start_Date desc; |
291 | 291 | ``` |
292 | 292 |
|
293 | | - **To create a transaction log backup** |
| 293 | +A complete history of all SQL Server backup and restore operations on a server instance is stored in the `msdb` system database. For more information on backup history, see [Backup History and Header Information (SQL Server)](/sql/relational-databases/backup-restore/backup-history-and-header-information-sql-server). |
| 294 | + |
| 295 | +#### To create a transaction log backup |
294 | 296 |
|
295 | 297 | > [!IMPORTANT] |
296 | 298 | > If the database is damaged, see [Tail-Log Backups (SQL Server)](../../relational-databases/backup-restore/tail-log-backups-sql-server.md). |
@@ -322,8 +324,7 @@ Sometimes you just have to end the transaction; you may have to use the [KILL](. |
322 | 324 |
|
323 | 325 | When transaction changes at primary Availability replica are not yet hardened on the secondary replica, the transaction log on the primary replica cannot be truncated. This can cause the log to grow , and can occur whether the secondary replica is set for synchronous or asynchronous commit mode. For information on how to troubleshoot this type of issue see [Error 9002. The transaction log for database is full due to AVAILABILITY_REPLICA error](/troubleshoot/sql/availability-groups/error-9002-transaction-log-large)[Error 9002. The transaction log for database is full due to AVAILABILITY_REPLICA error](/troubleshoot/sql/availability-groups/error-9002-transaction-log-large) |
324 | 326 |
|
325 | | - |
326 | | -## Disk volume is full |
| 327 | +## Resolve full disk volume |
327 | 328 |
|
328 | 329 | In some situations the disk volume that hosts the transaction log file may fill up. You can take one of the following actions to resolve the log-full scenario that results from a full disk: |
329 | 330 |
|
|
418 | 419 |
|
419 | 420 | ``` |
420 | 421 |
|
421 | | -## Log size set to a fixed maximum or Autogrow is disabled |
| 422 | +## Change log size limit or enable Autogrow |
422 | 423 |
|
423 | 424 | Error 9002 can be generated if the transaction log size has been set to an upper limit or Autogrow is not allowed. In this case, enabling autogrow or increasing the log size manually can help resolve the issue. Use this T-SQL command to find such log files and follow the recommendations provided: |
424 | 425 |
|
|
486 | 487 | SELECT 'Found no files that have reached max log file size' as Findings |
487 | 488 | ``` |
488 | 489 |
|
489 | | -### Increase log file size or enable Autogrow |
| 490 | +### Increase log file size or enable Autogrow |
490 | 491 |
|
491 | 492 | If space is available on the log disk, you can increase the size of the log file. The maximum size for log files is two terabytes (TB) per log file. |
492 | 493 |
|
|
0 commit comments