Showing posts with label attached. Show all posts
Showing posts with label attached. Show all posts

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.
>

Saturday, February 25, 2012

Backup of Log files

Dear All,
My nightly backups for log files are failing as there are
users still attached to the database being backup up.
What is the best stratergy for dealing with this ?
Do I
1) Make the DB single user ?
2) Have a script to kill all connections
3) Modify my backup plans
4) Some other
Any help here would be greatly appriciated.
PeterHi Peter,
Which version of SQL Server do you use? SQL Server 2000 and 7 (and probably
some earlier versions as well, but I don't have experience with them) allow
database and log backups when there are users connected to the database.
--
Jacco Schalkwijk MCDBA, MCSD, MCSE
Database Administrator
Eurostop Ltd.
"Peter" <nospam@.thisemailaddress.co.uk> wrote in message
news:05ae01c35fe8$90bfb4c0$a101280a@.phx.gbl...
> Dear All,
> My nightly backups for log files are failing as there are
> users still attached to the database being backup up.
> What is the best stratergy for dealing with this ?
> Do I
> 1) Make the DB single user ?
> 2) Have a script to kill all connections
> 3) Modify my backup plans
> 4) Some other
> Any help here would be greatly appriciated.
> Peter|||Hello,
Thanks for both of your replies.
I am using SQL 2000. However the backups I am doing are
part of the database maintence plan backups.
I do know that you can back up log files when people are
connected (I do this every hour with our production
database) but once a week I perform a backup of all our
databases with all sort of integrity checks, re builds of
indexes and so on. Its these back ups the log file back
ups are failing on.
Thanks
Peter
>--Original Message--
>Dear All,
>My nightly backups for log files are failing as there are
>users still attached to the database being backup up.
>What is the best stratergy for dealing with this ?
>Do I
>1) Make the DB single user ?
>2) Have a script to kill all connections
>3) Modify my backup plans
>4) Some other
>Any help here would be greatly appriciated.
>Peter
>.
>|||How do you know that they are failing because users are attached? Where are
you getting these error messages from ?
What is the exact message from the Maintenance plan history ?
--
--
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Peter" <nospam@.thisemailaddress.co.uk> wrote in message
news:060601c35fee$5e973990$a101280a@.phx.gbl...
> Hello,
> Thanks for both of your replies.
> I am using SQL 2000. However the backups I am doing are
> part of the database maintence plan backups.
> I do know that you can back up log files when people are
> connected (I do this every hour with our production
> database) but once a week I perform a backup of all our
> databases with all sort of integrity checks, re builds of
> indexes and so on. Its these back ups the log file back
> ups are failing on.
> Thanks
> Peter
> >--Original Message--
> >Dear All,
> >
> >My nightly backups for log files are failing as there are
> >users still attached to the database being backup up.
> >
> >What is the best stratergy for dealing with this ?
> >
> >Do I
> >1) Make the DB single user ?
> >2) Have a script to kill all connections
> >3) Modify my backup plans
> >4) Some other
> >
> >Any help here would be greatly appriciated.
> >
> >Peter
> >.
> >