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.
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.
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.
After this, we restarted SQL and database came online successfully.
Reference: Pinal Dave (https://blog.SQLAuthority.com)