sql server recovery pending

0 votes
No avatar asked by (120 points)

I decided to move My database files from one disk to another. Then I ran code to change the location of the database.

HOD200203 ALTER DATABASE MODIFY FILE (NAME = HOD200203 , FILENAME = 'J:\OptionDB\HOD200203.mdf ');

HOD200203 ALTER DATABASE MODIFY FILE (NAME = HOD200203log , FILENAME = 'J:\OptionDB\HOD200203log.ldf ');

It moved and ready to work, but all the databases say "recovery pending". If I try to open one, I get an error that says The database HOD200301 is not accessible. (ObjectExplorer).
How can I fix this? Microsoft SQL Server 2014 SP2, v.12.0.5000.0

1 Answer

0 votes
No avatar answered by (140 points)

I usually prefer backup databases then drop db and restore in new folder
Or detach db then stop SQL service, move files then attach the db
In your case seems that alter database is done to db hod200203 while error is on db hod2002031 there is a 1 on the final ....
Maybe is this the problem
Another kind of similar problem can occurr when you have moved files without stopping the service....
When I've done such things on SQL 2008 the db got corruption and had to restore mdf file repair via MDF Repair Kit because the backup was very old.
http://www.mdf.repair/

commented by (120 points)
Thanks for the help! you helped me a lot!)

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...