Groups | Blog | Home
all groups > sql server (microsoft) > june 2007 >

sql server (microsoft) : Major Problem - lost my whole database


iporter
6/12/2007 9:24:06 AM
Hi, I need some help.

I've been trying to detach my SQL Server 2005 Express database so as
to attach it to my remote server. This has worked in the past, but I
can't get it to work this time - it attaches to the remote server as
read-only. However, then suddenly it would no longer attach back to
the local server, with a new error message and so I was left with no
database at all! This new error now comes when trying to attach to
either the remote or local server.

Basically somehow, when reattaching, it started taking the wrong paths
from the file - i.e. even though I pressed add and selected the mdf
file, it then put the wrong paths, and so couldn't find the files.
The error message was along the lines of, 'The directory 'C:\etc'
cannot be found'. But then it started working properly again, so I
got my database back.

However, I'm now highly concerned about doing anything, so I have a
couple of questions:

- When I lost the database, I tried to restore a backup I had made,
but I couldn't because the database wasn't present to restore to
(because it was detached). Is there a way to restore a database
without the database being there?

- The original problem I was experiencing was the database attaching
to the remote server as read-only. Any ideas as to why this is? I
tried going into Properties > Options and setting Read-Only to false,
but got the error message, 'Unable to open the physical file 'E:
\etc'.


Option 1: I created a backup of the database called database.bak.
However I can't seem to attach it restore it unless the database is
there to restore it too (which I don't have, as it won't reattach).
Is there a way to do this?
iporter
6/12/2007 9:53:51 AM
ok, I must have wavered over my touchpad and submitted early, sorry.
The above is unfinished and a mixture of drafts! I don't seem to be
able to edit / delete my post - a bit rubbish.

Ok - while waiting for the post to appear so I could edit, I have
figured out the original problem - I uploaded the detached files to a
virtual directory, and so hooked up with that type of permissions
instead of normal permissions - SQL Server didn't get permission, and
so attached the database as read-only.

However, I'd still like any insights as to the second issue (about not
finding the file, even thought I selected it from the directory tree
within the SQL interface), and particularly on restoring a backup when
the database is no longer present in the database.

Thanks, sorry for the extended post.

brent.mccracken NO[at]SPAM gmail.com
6/14/2007 6:35:16 AM
[quoted text, click to view]

yes, you can restore without the database being there... that is a
good way to move databases... backup and restore.

but be careful cos if you detached and then try to do a restore you
might have a problem cos the restore might try to overwrite the data
files cos you will be restoring to the same location unless you use
the move command to put the datafile some where else or rename them.
AddThis Social Bookmark Button