Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 deleting transaction log file

Author  Topic 

aliyesami
Starting Member

30 Posts

Posted - 2008-04-16 : 18:59:22
I am trying to remove the transaction log file since I have created another one on a seperate drive by it wont let me do it . I get this error "cant delete the primary data or log file"
Now microsoft site clearly state steps for deleting the transaction log file , by first emptying it and then deleting it BUT IT DOESNT WORK.
I have even tried detaching the database and then removing the transaction log file and then attaching the database again BUT it attaches the transaction file back again GRRRRRR

then on top of this MS SQL studio does not allow to put PRIMARY or anyother value to the Filegroup for tansaction log files so how on earth can a transaction file be "primary" as the error is stating ??????

can anyone tell me how to get rid of a transaction log file that was created with the database ?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-16 : 19:09:30
Delete your new log file, detach the database, copy the LDF file to your separate drive, then reattach the database specifying both MDF and LDF, making sure to provide the new location.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

aliyesami
Starting Member

30 Posts

Posted - 2008-04-16 : 20:26:38
THANKS A LOT ! IT WORKED .
how can MS get away with wrong documentation I wonder. This is what they have for deleting transaction log file :

"Deleting a data or transaction log file removes the file from the database. You cannot remove a file from the database unless the file has no existing data or transaction log information; the file must be completely empty before it can be removed. To empty a data file by moving data from the data file to other files in the same filegroup, use the DBCC SHRINKFILE statement and specify the EMPTYFILE clause. Because the Database Engine no longer allows data to be placed on the file after the shrink operation, the empty file can be removed by using the ALTER DATABASE statement or SQL Server Management Studio"
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-16 : 23:20:35
Could you post the article link from where you got this information?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

sql_1
Starting Member

1 Post

Posted - 2010-05-01 : 10:50:48
here is the link for SQL 2K8

http://msdn.microsoft.com/en-us/library/ms191433.aspx
Go to Top of Page
   

- Advertisement -