Перейти к содержимому

Recovery pending sql как исправить

  • автор:

How to fix Recovery Pending State in SQL Server Database?

How to fix Recovery Pending State in SQL Server Database?

a_horse_with_no_name's user avatar

Mahesh Thorat 's user avatar

9 Answers 9

Execute the following set of queries:

a_horse_with_no_name's user avatar

Mahesh Thorat 's user avatar

When your Database .mdf file name is renamed, this issue is occurred. To solve:

Restart SQL EXPRESS in Services, Pending issue is solved.

In our case it was caused by the disk drive running out of space. We deleted some junk to free space, then fixed the "Recovery Pending" by stopping and restarting the SQL Server Service.

Detach, re-attach, solved !

François Breton's user avatar

While using SQL Management Studio, there is an intermittent issue when a user is changing the Database Names then sometimes SQL Server uses the same DB file for two different Databases. If SQL Server is in this state then you would be probably seeing the following error if you try Mahesh’s answer:

«The process cannot access the file because it is being used by another process»

To fix this issue:

  1. Stop MSSQLServer service from the Services Console MMC
  2. Rename the DB and the Log files (Database Properties -> Files)
  3. In the Object Explorer window in SQL Management Studio, refresh the ‘Databases Folder’, if you see that there is another Database node (in addition to the one which you are trying to rectify this issue) which is shown in ‘Recovery Pending State’ then proceed to the next step. If you do not see this error then you need to try something else to resolve this issue
  4. Make a backup of the DB and Log files for new offending node from step 3 and !!Careful!! delete the database
  5. Restore the Db File names which you changed in Step 2
  6. Now start the MSSQLServer service from the Services Console
  7. Re-try the steps from Mahesh’s answer

In my case, this affected the secondary server in a High Availability SQL Server cluster. The primary was Synchronizing but the secondary was Recovery Pending .

After checking in cluadmin.msc , realised that the secondary server wasn’t healthy in the cluster. Then determined Cluster Service had failed to start on the second cluster box after a Windows Update enforced reboot (may have happened because the file share witness was rebooting after a similar Windows Update at the same time).

Starting the Cluster Service brought the databases back into Synchronizing status.

fiat's user avatar

Ensure that the "Log On" account for the "SQL Server (201x)" service (listed in Windows Services (Manager)) has sufficient rights. You may try changing it to another Logon. In my case, changing it from "This account" to "Local System account", restarting the "SQL Server (xxxx)" service and SQL Server Management Studio (SSMS), and logging into SSMS again resolved the issue.

Background (in my particular case): I had 3 different instances of SQL (2008r2, 2012 and 2014) running on my local PC, and was busy moving a folder (which I later discovered contained some SQL data & log database files) to another PC. Halfway through, I stopped the SQL Services in Service (Manager), hoping that the files would move across without issues — since they would now, no longer be in use. I realized that I needed to confirm the database names, and file locations in SQL (in order to set them up again on the new pc), so I copied the SQL data and log files back (to the original locations). After restarting the PC — the majority of the databases on various instances all showed as: "Recovery Pending" in SSMS. After first trying the procedure from stellarinfo (listed as an answer here by @Mahesh Thorat) on 2 of the databases, and still not having any luck, a post SQL SERVER – Where is ERRORLOG? Various Ways to Find ERRORLOG Location on Pinal Dave’s SQL Authority website and the post: Operating System error 5(Access is Denied) on SQL Server Central gave me an idea that it could be rights related after looking at the SQL Errorlog and finding "Operating system error 5: "5(Access is denied.)". Another post Msg 3201, Level 16 Cannot open backup device. Operating system error 5(Access is denied.) at SqlBak Blog seems to support this.

Recovery pending sql как исправить

Mariana Rosie

Locate “SQL database recovery pending” Error

Every management either it is at large scale or at small scale needs to store or organize their data. There are many strategies that helps us to store, retrieve or organize their data like Microsoft, Oracle, Sybase, IBM, DB2, Informix, MS SQL and many others. Among them, SQL is one of the widely used database software that is being used by millions of user. It efficiently store all the data and is very easy to used and it’s not a big thing that the database get corrupted which is really very miserable. SQL save data in the form of table and fields with .MDF and .NDf database file extensions. And if that file become damage then, whole database can get corrupted, which will prevents you from accessing database. Also it throws so many errors while accessing it which may be out of reach of common people. Among so many errors “Recovery Pending” is one that once occurred means SQL couldn’t open the database files for some reason and generally occurred while recovering your database. And it cause damage to database or files. In that case, user have to lost their valuable data.

Are you also getting “ Recovery Pending” error while recovering your file” ?

Then don’t worry, you are at right place and at right time. Although there is some manual method that provide access to your data, but sometimes it get fails. Means there is possibility of not recovering that data. Also, it needs good knowledge of system files and folder. In that case, it is better to use any third party software that easily recover all the data from the database and provide access to them. Experts advice to to use “SQL Database Recovery Software” as, it has been designed very carefully that completely repair all the corrupted data and helps you to get rid of “Recovery Pending” errors. There are many benefit of using this software which are as follows.

Ручной Способ исправить Состояние ожидания восстановления SQL Server

Люди, которые использовали SQL-сервер, возможно, однажды столкнулись с ошибкой SQL база данных в состояние ожидания восстановления из-за ее повторного появления. Если вы не знаете, почему происходит эта ошибка, значит, ваш раздел базы данных, вероятно, заполнен. SQL не может открыть базу данных и не может заблокировать файл базы данных, который очень похож на базу данных в автономном режиме. Это больше похоже на то, что что-то мешает запуску сервера. В этом блоге мы собираемся обсудить, как исправить состояние ожидания восстановления SQL Server с помощью наилучших возможных методов. Прежде чем продолжить, давайте узнаем, каковы причины этой ошибки.

Причины – Состояние Ожидания восстановления базы данных SQL Server

  • Раздел базы данных переполнен или недостаточно памяти
  • Аппаратный сбой
  • Повреждение в лог-файлах
  • Из-за какой-либо незавершенной задачи или при закрытии были некоторые действия, ожидающие со стороны пользователя
  • Повреждение или повреждение в файлах MDF
  • Запуск сервера без промежутков времени

Мгновенное Решение: Используйте средство восстановления SQL SysTools, чтобы исправить состояние ожидания восстановления в базе данных SQL Server. Это программное обеспечение может быстро устранить все ошибки, связанные с базой данных SQL. После восстановления он предоставляет возможность экспортировать данные в базу данных SQL или сценарии SQL.

Ручные способы исправить Состояние ожидания восстановления SQL Server

Как всегда можно увидеть или испытать, что ручные способы довольно сложны и опасны в использовании. Поэтому, прежде чем запустить его, убедитесь, что у вас есть резервная копия базы данных. Если вы новичок в этом, то рекомендуется, чтобы вы выполняли его под руководством технического специалиста или не выполняли его.

Способ 1

В этом ручном методе для разрешения Состояние ожидания восстановления базы данных SQL Server необходимо запустить принудительное восстановление.

1. Запустите нижеуказанные SQL-запросы.

ALTER DATABASE (Database Name) SET EMERGENCY;

ALTER DATABASE (Database Name) set single_user

DBCC CHECKDB ([Database Name], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;

ALTER DATABASE (Database Name) set multi_user

2. База данных помечена как READ_ONLY в аварийном режиме, отключает ведение журнала и предоставляет доступ только системным администраторам.

3. После того, как эти шаги будут выполнены, повреждение файла будет исправлено, и база данных снова будет подключена автоматически.

Способ 2

В этом втором методе, который может разрешить состояние ожидания восстановления в базе данных SQL Server, нам нужно сначала поработать в аварийном режиме, давайте посмотрим, как.

1. Выполните следующие команды:

ALTER DATABASE (Database Name) SET EMERGENCY;

ALTER DATABASE (Database Name) set multi_user

EXEC sp_detach_ db ‘(Database Name)’

EXEC sp_attach_single_file_db @Database Name = ‘(Database Name)’, @physname = N’(mdf path)’

2. Система автоматически удалять поврежденные журналы и создаст новый.

Если вы успешно выполнили оба метода, то до сих пор проблема Состояние ожидания восстановления базы данных SQL Server может быть решена. Если нет, то рекомендуется перейти на более безопасный и лучший подход, который является автоматизированным методом.

Автоматизированное решение для исправления Состояние Ожидания восстановления SQL Server

Автоматизация гораздо лучше, чем тратить много времени и усилий на ручные методы. Для автоматического метода вы можете перейти к Восстановление базы данных SQL. Это программное обеспечение помогает восстановить поврежденный файл MDF со всеми объектами базы данных. Для выполнения процесса восстановления базы данных SQL не требуется резервное копирование. Можно легко восстановить базу данных SQL без резервного копирования. Давайте узнаем, как это работает для восстановления поврежденных файлов базы данных SQL и устранения состояние ожидания восстановления в базе данных SQL Server.

1. Установите и запустите программу восстановления SQL, затем нажмите кнопку «Открыть», чтобы загрузить файл базы данных.

Восстановление SQL

2. Выберите режим быстрого или расширенного сканирования, а затем установите флажок Автоопределение версии файла SQL Server.

3. Теперь начнется процесс сканирования. После сканирования вы можете увидеть предварительный просмотр восстановленных предметов.

Восстановление SQL

4. Выберите опцию «Экспорт» сверху и выберите «Экспорт данных в базу данных SQL или сценарии SQL».

SQL база данных в состояние ожидания восстановления

5. Заполните все необходимые данные ниже и выберите экспорт только со схемой или только со схемой и данными.

Состояние ожидания восстановления базы данных SQL Server

6. В конце нажмите кнопку «Экспорт», чтобы восстановить файлы базы данных SQL.

Состояние ожидания восстановления SQL Server

Вывод

Как мы уже обсуждали в блоге, насколько важна для нас база данных SQL и насколько она склонна к состояние ожидания восстановления SQL Server , вы должны знать эти методы для спасения. Но как мы видим, насколько сложен ручной метод, поэтому всегда рекомендуется переходить на автоматизированный метод. Это лучший инструмент SQL для восстановления поврежденной базы данных SQL и устранения проблемы SQL база данных в состояние ожидания восстановления.

Easy Ways to Fix Recovery Pending State in SQL Server 2014/2016/2017

One of the technical issues when using SQL database is Recovering pending state in SQL server. When the problem occurs, you can fix it with the possible solutions here. If you’re not a pro at solving SQL database issues, don’t worry, you can use EaseUS MS SQL Recovery to help you make it effortlessly.

In everyday use, the SQL server database may face many technical issues and are tough to settle. One of the problems is «Recovering pending state in SQL server database». If you encounter this issue unexpectedly, don’t worry. Resort to the fixes here to solve recovery pending state in SQL server database. Besides, if you are not a professional in SQL server database issues and do not have the confidence to settle this problem, you can use EaseUS MS SQL Recovery to help you do it in a simple and effective way.

Workable Solutions Step-by-step Troubleshooting
1. Mark SQL Database in Emergency Mode The emergency mode will mark the SQL database as READ_ONLY, disable logging. Full steps
2. Disconnect the Main Database ALTER DATABASE [DBName] SET EMERGENCY > ALTER DATABASE [DBName] set multi_user. Full steps
3. Fix Recovery Pending State Download and run EaseUS MS SQL Recovery. Click the two dots (Browse button) to choose the target MDF. Full steps

Three States of SQL Server Databases

If a single or multiple core MDF/NDF files corrupted, an SQL database is likely to be damaged. Different levels of damage will show up in different states. Let’s look into the details.

You can execute the following query statement to know the SQL server state.

SELECT name, state_desc from sys.databases

  • Online: If one of the data files has been damaged, the database will remain accessible and online.
  • Suspect: The transaction log file is damaged and it inhibits recovery or prevents transaction rollback from completion, which will result in failure of SQL database.
  • Recovery Pending: The SQL Server needs to run database recovery, but is prevented from starting due to some causes. This is unlike a Suspect state that shows recovery may fail, but it has not started yet.

Reasons for Recovery Pending State in SQL Server

Several factors can lead to recovery pending state in SQL Server database. The main reasons are listed as follows.

  • The database is not cleanly shut down. In other words, one or more unaccomplished transaction is active at that time and its log file has been deleted.
  • The transaction log files are corrupted during the process of transfer to solve performance issues.
  • Insufficient free storage space on the database partition, which causes SQL can’t open the database and can’t lock the database files.

How to Fix Recovery Pending State in SQL Server Database

You can fix the recovery pending state issue in the SQL Server database manually with some queries. Or to avoid worse problems due to misoperations, you can use a professional MS SQL recovery tool to take you through.

Method 1. Mark SQL Database in Emergency Mode

The emergency mode will mark the SQL database as READ_ONLY, disable logging. At this time, DBA is only allowed to access. Entering emergency mode and start database recovery can solve any technical issue. And the database will automatically come out of the EMERGENCY mode.

ALTER DATABASE [DBName] SET EMERGENCY;

ALTER DATABASE [DBName] set single_user

DBCC CHECKDB ([DBName], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;

ALTER DATABASE [DBName] set multi_user

Method 2. Mark SQL Database in Emergency Mode, Disconnect the Main Database

These queries will cause the server to get rid of the corrupt log and build a new one automatically.

ALTER DATABASE [DBName] SET EMERGENCY;

ALTER DATABASE [DBName] set multi_user

EXEC sp_detach_db ‘[DBName]’

EXEC sp_attach_single_file_db @DBName = ‘[DBName]’, @physname = N'[mdf path]’

An Easier and Risk-Free Way to Fix Recovery Pending State in SQL Server

The above manual solutions can fix recovery pending state issues effectively. If you are a pro at SQL Server database issues, they are your first choices. However, if you don’t know much about SQL Server databases, we highly recommend you try a safer and automated workaround. Use MS SQL recovery software to repair the corrupted database in 823/824/825 errors.

Step 1. Download and run EaseUS MS SQL Recovery.

Step 2. Click the two dots (Browse button) to choose the target MDF file or click «Search» and select the desired file to repair from the list found below. Then, click «Repair» to start the repairing process.

recover MDF file - Step 2

Step 3. When the process completes, a Window will appear to confirm the successful analysis. All the deleted tables & records recovered items will be listed on the left pane in the name of the original tables.

recover MDF file - Step 3

Step 4. Click the «Export» button in the bottom right corner of the screen. You can save the recovered database to database & SQL scripts based on your need. Then, you need to enter Server/Instance Name and connect to the server. If you choose to «Export to database», you can create a new database or export to an existing database.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *