why we need secondary(.ndf) file in Database

  • Create Database dbTest

    ON

    (

    NAME='sample1',

    FILENAME='G:\Testing\Sample1.mdf',

    SIZE=5MB,

    MAXSIZE=10MB

    ),

    (

    NAME='sample2',

    FILENAME='G:\Testing\Sample2.mdf',

    SIZE=5MB,

    MAXSIZE=10MB

    ),

    (

    NAME='sample3',

    FILENAME='G:\Testing\Sample3.mdf',

    SIZE=5MB,

    MAXSIZE=10MB

    )

    if we create database with multiple mdf files,then what is use of ndf file?

    I am new in sql,can anyone help me?

  • whenever you create a database with multiple data files, the first file will be created as .mdf and all other as .ndf.

    Normally we create database with multiple data files to keep the data on different IO disk, for better performace and management.

  • The extensions are just a naming convention, nothing more. A secondary data file is a secondary data file, whether it has the mdf extension, the ndf extension or any other extension that you like.

    SQL doesn't enforce the file extension convention anywhere, it won't automatically make secondary files have a .ndf extension.

    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
  • It's just a way to differentiate between primary and secondary data files.If we keep all the data file extension same then others might confuse between primary and secondary data file.

    Primary data file contains some metadata about secondary files.

    Although we can keep the extension whatever we like .x,.y etc.

    Pramod
    SQL Server DBA | MCSE SQL Server 2012/2014

    in.linkedin.com/in/pramodsingla/
    http://pramodsingla.wordpress.com/

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

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