Friday, March 9, 2012

Error 5020 after try to delete one of log files

Platform: SQL Server 2k with sp2
OS: W2k sp2
I tried to move log files at one database from location A
to another location B. I first created new log fileB.ldf
for this database at locationB. Then shrank the original
log fileA.ldf as much as possible. Next I tried to
delete fileA from SQL Server EM -> properties ->
transaction log-> highligt fileA.ldf -> delete. But I got
error 5020: The primary data or log file cannot be removed
from a database.
How can I drop or move log files from database?
Thanks.Maggie,
First, detach the database using sp_detach_db after making sure that users
are not accessing it.Once done, the database is thus offline.Now copy the
.ldf file to location B.Attach the database using sp_attach_db, mentioning
the new location for .ldf.
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Maggie" <seamorning@.yahoo.com> wrote in message
news:5d4901c35781$4df49c60$a001280a@.phx.gbl...
> Platform: SQL Server 2k with sp2
> OS: W2k sp2
> I tried to move log files at one database from location A
> to another location B. I first created new log fileB.ldf
> for this database at locationB. Then shrank the original
> log fileA.ldf as much as possible. Next I tried to
> delete fileA from SQL Server EM -> properties ->
> transaction log-> highligt fileA.ldf -> delete. But I got
> error 5020: The primary data or log file cannot be removed
> from a database.
> How can I drop or move log files from database?
> Thanks.|||Go to EM, right click the database, then Transaction Log tab, select the 2nd
log file, press Delete button.
You can't delete first log file, but other log files you can delete.
"Maggie" <seamorning@.yahoo.com> wrote in message
news:5e5d01c3578e$5cd34cb0$a001280a@.phx.gbl...
> How can just delete the extra log files from one
> location? I only want to keep one?
> >--Original Message--
> >Maggie,
> >
> >First, detach the database using sp_detach_db after
> making sure that users
> >are not accessing it.Once done, the database is thus
> offline.Now copy the
> >..ldf file to location B.Attach the database using
> sp_attach_db, mentioning
> >the new location for .ldf.
> >
> >--
> >Dinesh.
> >SQL Server FAQ at
> >http://www.tkdinesh.com
> >
> >"Maggie" <seamorning@.yahoo.com> wrote in message
> >news:5d4901c35781$4df49c60$a001280a@.phx.gbl...
> >> Platform: SQL Server 2k with sp2
> >> OS: W2k sp2
> >> I tried to move log files at one database from location
> A
> >> to another location B. I first created new log
> fileB.ldf
> >> for this database at locationB. Then shrank the
> original
> >> log fileA.ldf as much as possible. Next I tried to
> >> delete fileA from SQL Server EM -> properties ->
> >> transaction log-> highligt fileA.ldf -> delete. But I
> got
> >> error 5020: The primary data or log file cannot be
> removed
> >> from a database.
> >>
> >> How can I drop or move log files from database?
> >>
> >> Thanks.
> >
> >
> >.
> >

No comments:

Post a Comment