SQL SERVER – Error 9002: The Transaction Log for Database ‘SQLDB’ is Full Due to ‘DATABASE_MIRRORING’

It is interesting to see in SQL Server that same error message is raised due to multiple reasons. One such error is 9002. In this blog, we would quickly learn about the cause of error 9002: The transaction log for database ‘SQLDB’ is full due to ‘DATABASE_MIRRORING’

In earlier versions of SQL Server, the error message 9002 was not very informative. This was the message earlier.

The transaction log for database ‘Database_Name’ is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases.

In my opinion, it was a less useful message because it doesn’t tell the cause. If you ask any DBA why log file is full, they won’t be able to tell all the possible reasons. Here is the complete list as of today from books online. Here are the various values which can be seen in log_reuse_wait_desc in sys.databases catalog view.

Solarwinds
  • LOG_BACKUP
  • ACTIVE_BACKUP_OR_RESTORE
  • ACTIVE_TRANSACTION
  • DATABASE_MIRRORING
  • REPLICATION
  • DATABASE_SNAPSHOT_CREATION
  • LOG_SCAN
  • AVAILABILITY_REPLICA
  • OLDEST_PAGE

In the current version of SQL Server, the text of error number 9002 is as below:

The transaction log for database ‘%ls’ is full due to ‘%ls’.

As we can see there are two placeholders, database name and the reason. In my client’s database it was DATABASE_MIRRORING.

WORKAROUND/SOLUTION

Based on the reason in the error message, we need to take action. In my client’s server, the database was configured for database mirroring but due to some reason mirror server was not able to come in sync with the principal server. So, the quickest way to get free space on the principal database was to break the mirroring and remove mirror server for this database.

ALTER DATABASE SQLDB SET PARTNER OFF

If you want to use UI and able to open database properties, then you can go to “Database Mirroring” page and choose “Remove Mirroring” as shown below.

SQL SERVER - Error 9002: The Transaction Log for Database 'SQLDB' is Full Due to 'DATABASE_MIRRORING' err-9002-miror-01

After this, we restarted SQL and database came online successfully.

Reference: Pinal Dave (https://blog.SQLAuthority.com)

Solarwinds
, , , ,
Previous Post
SQL SERVER – Install Error: Validation for Setting ‘AGTSVCACCOUNT’ Failed. Error Message: The RPC Server is Unavailable
Next Post
SQL SERVER – Database Mirroring Login Attempt Failed With Error: ‘Connection Handshake Failed. An OS Call Failed: (80090350)

Related Posts

2 Comments. Leave new

Leave a Reply

Menu