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
 General SQL Server Forums
 New to SQL Server Programming
 Detach and Attach ndf file

Author  Topic 

KKKKT
Starting Member

2 Posts

Posted - 2008-09-04 : 09:24:50
I have a database in SQL 7 where the log file is out of control. I have not been able to shrink it, so I am going to detach it, rename the log file and the attach the database.

My database consists of mdf and ndf files, and also a ldf file. I am not sure what the syntax is when attaching the ndf file. To detach the database, I will do the following:

use master
go
sp_detach_db 'armygh'
go

to attach:

My questions is, when attaching the file, do I specify the path of the ndf file? Example:

use master
go
sp_attach_db 'armygh', 'e:\sqldata\armygh.mdf', 'E:\sqldata\armyghidx.ndf'
go

Is this correct?

KMU

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-09-04 : 09:28:35
Why are you doing this?
If it is Emergency, Can you change your recovery model to simple and truncate log file? But only if you don't care about Point in time recovery.You should follow up with full backup.
Go to Top of Page
   

- Advertisement -