Solved

sql server moved database files now it says recovery pending

Posted on 2012-12-29
2
1,215 Views
Last Modified: 2012-12-29
I moved my database files from my C drive to my J drive, then ran this code to move the database locations.  It appeared to work, but my databases all 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?

ALTER DATABASE  HOD200203 MODIFY FILE (NAME = HOD200203 , FILENAME = 'J:\OptionDB\HOD200203.mdf ');
ALTER DATABASE  HOD200203 MODIFY FILE (NAME = HOD200203_log , FILENAME = 'J:\OptionDB\HOD200203_log.ldf ');
0
Comment
Question by:jackjohnson44
2 Comments
 
LVL 9

Accepted Solution

by:
sognoct earned 500 total points
ID: 38730109
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 2000 the db got corruption and had to restore a backup !!!!
0
 

Author Comment

by:jackjohnson44
ID: 38730113
I am actually detaching them all now then I am going to recreate, like you said.  Thanks!
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question