SQL SERVER – Databases Going to Recovery Pending State Randomly

SQL SERVER - Databases Going to Recovery Pending State Randomly Process-Warning-icon One of my famous offerings is Comprehensive Database Performance Health Check where we always go over various SQL Server and database level properties. Lots of people do not know that there are quite a few SQL Server and database level settings which can help us improve our SQL Server performance many folds. Let us learn in this blog post how to fix the error about Databases Going to Recovery Pending State Randomly.

While doing this for one of my clients, they had an interesting issue. The informed that they noticed that sometimes, very randomly, one of their databases go to recovery pending state. As a usual troubleshooting step, I checked SQL Server ERRORLOG to see if there is anything interesting about the database. SQL SERVER – Where is ERRORLOG? Various Ways to Find ERRORLOG Location

Here is the filtered information for one of the database HRFINDB

2018-05-16 11:16:00.38 spid58 Starting up database ‘HRFINDB’.
2018-05-16 11:16:01.40 spid58 Error: 17204, Severity: 16, State: 1.
2018-05-16 11:16:01.40 spid58 FCB::Open failed: Could not open file T:\MSSQL12.MSSQLSERVER\MSSQL\DATA\HRFINDB_log.ldf for file number 2. OS error: 32(The process cannot access the file because it is being used by another process.).
2018-05-16 11:16:01.42 spid58 Error: 5105, Severity: 16, State: 1.
2018-05-16 11:16:01.42 spid58 A file activation error occurred. The physical file name ‘T:\MSSQL12.MSSQLSERVER\MSSQL\DATA\HRFINDB_log.ldf’ may be incorrect. Diagnose and correct additional errors, and retry the operation.
2018-05-16 11:16:01.45 spid58 Error: 5170, Severity: 16, State: 1.
2018-05-16 11:16:01.45 spid58 Cannot create file ‘T:\MSSQL12.MSSQLSERVER\MSSQL\DATA\HRFINDB_log.ldf’ because it already exists. Change the file path or the file name, and retry the operation.

Solarwinds

I also found many starting up messages like below.

2018-05-14 15:27:03.80 spid61 Starting up database ‘HRFINDB’.
2018-05-14 15:27:08.23 spid54 Starting up database ‘HRFINDB’.
2018-05-14 15:28:20.02 spid52 Starting up database ‘HRFINDB’.
2018-05-14 15:29:46.88 spid54 Starting up database ‘HRFINDB’.
2018-05-14 15:29:48.20 spid54 Starting up database ‘HRFINDB’.

I immediately recalled message as I blogged about it long ago.

SQL SERVER – Starting Up Database – Why Multiple Times in Errorlog?

WORKAROUND/SOLUTION

The issue is a combination of Auto Close and Antivirus real-time scanning of the file. Read the link 1 and link 2.

So, have changed the Auto_Close to OFF for database ‘HRFINDB’ and we didn’t see same behavior again.  I also help them to configure antivirus settings as per above article.

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

Solarwinds
, , ,
Previous Post
SQL SERVER – FIX: Msg 22004 – The Log File is Not Using Unicode Format
Next Post
SQL SERVER – SQL Server Cluster Resource Doesn’t Come Online Randomly

Related Posts

Leave a Reply

Menu