Database files mismatched

  • Hi,

    our client give an environment. That environment having one database.that database having 4 mdf files and 1 ldf files. That clients are done with db creation through some tool .

    it created the 4 mdf files instead of creating ndf file and also given ldf extension to database data files.

    how to correct this?

  • As far as I'm aware the extensions of the files should not matter. Mdf, ndf and ldf are just the standard naming conventions that Microsoft recommend. https://technet.microsoft.com/en-us/library/aa174545%28v=sql.80%29.aspx

    The only way to change the file extensions would be to either detach the db, rename and then re-attach or backup and restore.

  • You can detach/attach or you can use ALTER DATABASE ... MODIFY and then change the names of the files in the file system, same process as you'd use to move the files to a different location.

    That said, SQL doesn't care about file extensions, you could name a database file .txt and SQL would be fine with it. Only make the change if you need to adhere to some standard or it's bothering you.

    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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply