Tuesday, March 20, 2012

Backup Question Old Files still attached

I was setting up the backup for a new database last evening and seem
to have created a small problem. Although I was able to create a
backup and restore it, in the process I seem to have left a couple of
other copies of the database files in a state where they cannot be
moved, deleted or copied.
I started by right clicking on the database and selecting Back Up. I
then did a Full Backup of the Database (not the Files and
Filegroups). I then detached the original database (probably a
mistake) and went to the Databases level, right-clicked and selected
Restore Database. I did not find the name of my database in the "To
Database:" list so I typed it in and proceeded to select the From
Database (which did have the name of my database and the correct
backup time) and restored the database.
The database seemed to work fine.
However when I checked the files I found not only my original
DatabaseName_Data.MDF and DatabaseName_Log.LDF files, but two new
ones
DatabaseName.MDF and DatabaseName_1.LDF. These last two files are
the
actual files being used by the restored database.
I would now like to do two things:
1) Move the original DatabaseName_Data.MDF and DatabaseName_Log.LDF
files to a new location, and
2) Rename the files that are actually being used from
DatabaseName.MDF
and DatabaseName_1.LDF to DatabaseName_Data.MDF and
DatabaseName_Log.LDF as they were before.
However I can't seem to do anything with the original files because
they seem to still be attached to the server. How can I SAFELY
accomplish what I want without endangering my good database (with the
wrong file names)?
Thanks.Detach the databases and do whatevery you want. Move them, rename them or
whatever and then reattach whichever one you want to use.
--
Ekrem Önsoy
"ExcelMan" <sfarkas@.sjfcg.com> wrote in message
news:1188538011.871157.326450@.q5g2000prf.googlegroups.com...
> I was setting up the backup for a new database last evening and seem
> to have created a small problem. Although I was able to create a
> backup and restore it, in the process I seem to have left a couple of
> other copies of the database files in a state where they cannot be
> moved, deleted or copied.
> I started by right clicking on the database and selecting Back Up. I
> then did a Full Backup of the Database (not the Files and
> Filegroups). I then detached the original database (probably a
> mistake) and went to the Databases level, right-clicked and selected
> Restore Database. I did not find the name of my database in the "To
> Database:" list so I typed it in and proceeded to select the From
> Database (which did have the name of my database and the correct
> backup time) and restored the database.
>
> The database seemed to work fine.
>
> However when I checked the files I found not only my original
> DatabaseName_Data.MDF and DatabaseName_Log.LDF files, but two new
> ones
> DatabaseName.MDF and DatabaseName_1.LDF. These last two files are
> the
> actual files being used by the restored database.
>
> I would now like to do two things:
>
> 1) Move the original DatabaseName_Data.MDF and DatabaseName_Log.LDF
> files to a new location, and
> 2) Rename the files that are actually being used from
> DatabaseName.MDF
> and DatabaseName_1.LDF to DatabaseName_Data.MDF and
> DatabaseName_Log.LDF as they were before.
>
> However I can't seem to do anything with the original files because
> they seem to still be attached to the server. How can I SAFELY
> accomplish what I want without endangering my good database (with the
> wrong file names)?
>
> Thanks.
>

No comments:

Post a Comment