I love connecting community via various channels. One of my clients explained an interesting issue to me. He explained that he has a production database which is going to Recovery Pending state by itself and without any user intervention, it’s coming back as well.


SQL SERVER   Database going to Recovery Pending Automatically and Coming Back

As you might have seen my earlier post, I always start by asking SQL Server ERRORLOG file to see if there are some interesting messages.

SQL SERVER Where is ERRORLOG? Various Ways to Find ERRORLOG Location

Here is what I saw in ERROLOG which made complete sense about the behavior.

2016-07-16 17:06:00.38 spid58 Starting up database ‘ProdDB’.

2016-07-16 17:06:01.40 spid58 Error: 17204, Severity: 16, State: 1.

2016-07-16 17:06:01.40 spid58 FCB::Open failed: Could not open file G:\mssql11.MSSQLSERVER\MSSQL\DATA\ProdDB_log.ldf for file number 2. OS error: 32(The process cannot access the file because it is being used by another process.).

2016-07-16 17:06:01.42 spid58 Error: 5105, Severity: 16, State: 1.

2016-07-16 17:06:01.42 spid58 A file activation error occurred. The physical file name ‘G:\MSSQL11.MSSQLSERVER\MSSQL\DATA\ProdDB_log.ldf’ may be incorrect. Diagnose and correct additional errors, and retry the operation.

2016-07-16 17:06:01.45 spid58 Error: 5170, Severity: 16, State: 1.

2016-07-16 17:06:01.45 spid58 Cannot create file ‘G:\MSSQL11.MSSQLSERVER\MSSQL\DATA\ProdDB_log.ldf’ because it already exists. Change the file path or the file name, and retry the operation.

2016-07-16 17:06:01.45 spid58 Error: 5170, Severity: 16, State: 1.

2016-07-16 17:06:01.45 spid58 Cannot create file ‘G:\MSSQL11.MSSQLSERVER\MSSQL\DATA\ProdDB_log.ldf’ because it already exists. Change the file path or the file name, and retry the operation.

Since the database was getting started (another issue) it was trying to get the file handle and open the files. Due to “OS error: 32(The process cannot access the file because it is being used by another process.).” SQL was unable to open files and hence going to Recovery Pending state.

Now, the questions are

Why database is getting started automatically? Which is the “another” process which is having open handle on the files.

For the first issue, you can read my earlier blog!

SQL SERVER Starting Up Database Why Multiple Times in Errorlog?

While investigating I found that they had Antivirus running on the server, which was doing “On-Access” scan which was causing SQL to not get handle and cause OS error 32. If you have not seen earlier, here is the Microsoft knowledge base article on the same topic.

How to choose antivirus software to run on computers that are running SQL Server

Once we fixed Auto_Close setting and added file exception for MDF, LDF files, the issue never occurred.

Have you ever encountered such behavior?

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

本文数据库(mssql)相关术语:熊片数据库 mssql数据库 oracle数据库 pubmed数据库 access数据库 万方数据库

主题: SQLSQL Server
分页:12
转载请注明
本文标题:SQL SERVER Database going to Recovery Pending Automatically and Coming Back
本站链接:http://www.codesec.net/view/485467.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(mssql) | 评论(0) | 阅读(25)