Here's the situation:
- Someone renamed database
A
toA_old
in SSMS - They did not rename the physical nor logical file; physical file was renamed somehow to
A_old.mdf
- They then created a new database called
A
that hasA.mdf
as filename - However
A_old
database is now in recovery mode because it still has logical file nameA.mdf
I tried to rename the logical file with a script (ALTER DATABASE ... MODIFY FILE
), getting and not getting the database offline, as admin in SSMS, but still getting an error:
Database 'A_OLD' cannot be opened due to inaccessible files or insufficient memory or disk space.
There is disk space and memory. If I set offline/online this does not work, because it keeps trying to attach the database to the new one's file which is using it. Also tried to copy the mdf file and manually attach it using SSMS but it does not work because it looks for the file without the _old
suffix.
I'm running out of ideas. Is there any way to recover this database?
A
. They actually renamed the files on disk with the server offline but did not update the properties in SSMS.