January 14, 2013 at 11:23 am
By accident on one of the databases instead of adding a LDF file an NDF file was added with an extension .LDF
The files was added as a data file however has the extention of .LDF.
What is best approach to rename this file as .NDF?
Will this work?
- Dettach the db
- Move the file to new location (currently sitting a diff drive)
- rename the file from .LDF to .NDF on the new location
- Attach the file as .NDF
January 14, 2013 at 11:30 am
That should work.
I assume when you attach, you are attaching the MDF/LDF and new NDF at the same time.
January 14, 2013 at 11:38 am
Steve Jones - SSC Editor (1/14/2013)
That should work.I assume when you attach, you are attaching the MDF/LDF and new NDF at the same time.
That is correct. My only concern though is to change the extension from .LDF to .NDF. I dont know what are effects of doing that.
January 14, 2013 at 11:59 am
No effect. The extensions have no bearing on the files' purpose or use. They are set to mdf/ndf/ldf only for convention.
January 14, 2013 at 12:22 pm
Steve Jones - SSC Editor (1/14/2013)
No effect. The extensions have no bearing on the files' purpose or use. They are set to mdf/ndf/ldf only for convention.
Great!! Appreciate your help.
January 14, 2013 at 12:27 pm
ALTER DATABASE with the MOVE option will likely be easier. That changes the name in the system catalog, then you just take the DB offline, change the extensions in Windows Explorer and bring the DB back online.
As for extensions, this works without a hitch...
CREATE DATABASE [Silly] ON PRIMARY
( NAME = N'Silly', FILENAME = N'D:\Develop\Databases\Silly.doc' )
LOG ON
( NAME = N'Silly_log', FILENAME = N'D:\Develop\Databases\Sillylog.txt' )
SQL doesn't care what the file extensions are.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 14, 2013 at 1:15 pm
Will give it a try. Thanks.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply