How to Add Datafile.ndf in Production database ?

  • Hi ,

    I have 2TB database in production which has 1 MDF file ,2NDF files i am Planning to add one more datafile with out any down time in production ? Can I add file directly to DB right click and add file ?

    appreciate your comments and suggestion.

    Thanks

    Ichbin

  • Look up ALTER DATABASE in Books Online. The options to add files are well described.

    Why a new file? What are you trying to achieve?

    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
  • ichbinraj (2/10/2009)


    Hi ,

    I have 2TB database in production which has 1 MDF file ,2NDF files i am Planning to add one more datafile with out any down time in production ? Can I add file directly to DB right click and add file ?

    appreciate your comments and suggestion.

    Thanks

    Ichbin

    Is your existing ndf file taking all the space on the disk, if so are you creating a new ndf file on a new drive with enough space. Only in this case you need to add a new ndf file.

    However, you can right click database, go to properties and then go to Files tab in the Select a page section.

    On the bottom click on add and name the file and specify the location. I assume this is a SQL 2005 database

    Also, as Gail suggested you can use the ALTER DATABASE command too.

    Thanks!!

    The_SQL_DBA
    MCTS

    "Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives."

  • We have recommendations from team- lead to increase the datafiles in db ...he suggested us to maintain ratio 2:1 (datafiles :Processors ). thats what I am planning to do ?

    if I add file according to your specification do I need to restart the MS SQL server ?

  • ichbinraj (2/10/2009)


    if I add file according to your specification do I need to restart the MS SQL server ?

    As a DBA always learn to say No and please Question as many things as you can.

    However, for a large database having more than a couple data files is recommended.

    ADDING A FILE DOES NOT NEED REBOOT, you can add as many files as you want but don't have too many files too.

    Also place the new ndf file on a better RAID like RAID 10 or RAID 1..

    Thanks!!

    The_SQL_DBA
    MCTS

    "Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives."

  • ichbinraj (2/10/2009)


    We have recommendations from team- lead to increase the datafiles in db ...he suggested us to maintain ratio 2:1 (datafiles :Processors ). thats what I am planning to do ?

    if I add file according to your specification do I need to restart the MS SQL server ?

    No need to reboot or anything like that. 2:1 flies/cpu ratio, seems a bit excessive.


    * Noel

  • ichbinraj (2/10/2009)


    We have recommendations from team- lead to increase the datafiles in db ...he suggested us to maintain ratio 2:1 (datafiles :Processors )

    Does he intend to mean that 2:1 ratio of Data files to Processors?

    If so is it for this 2TB database or for all of them?

    In that case as a production would most of the times be a 8 CPU machine does that mean we need to have 16 data files..

    I don't buy this recommendation..

    What if my database size is 100Gb do I still need 2:1 ration..I DON'T think so..

    That's why I said QUESTION EVERYTHING you possibly could like Is it the right thing to do?

    Thanks!!

    The_SQL_DBA
    MCTS

    "Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives."

  • Yes, its processor and datafile ration.

    Server has only 1 Database size 2 tb. I have completed adding ndf file successfully.

    Thanks

    ichbin

  • ichbinraj (2/10/2009)


    We have recommendations from team- lead to increase the datafiles in db ...he suggested us to maintain ratio 2:1 (datafiles : Processors ).

    Tell your team lead that the recommendation he's talking about is only for TempDB and not for user databases. Even for tempDB, it's only for cases there are bottlenecks on the allocation pages. User databases do not get new tables added fast enough (many per second) to need such treatment

    The only reasons you would add files to a user database are:

    1) IO performance. In this case, the files must be on separate physical drives to see any gain at all

    2) Faster backups and piecemeal restores. Requires filegroups and a careful design

    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
  • If we add new secondary datafile to existing production database, how the data will be shared between mdf and newly created ndf file? do we need to move data from mdf to ndf or the database itself take care of that?

  • Why we use NDF file...

    Thanks

  • Pl tell the detail use of NDF file

    Thanks

  • guptaajay1985 (2/10/2009)


    Why we use NDF file...

    Have a read through of Books online, all sections on files or filegroups.

    No need to repost after 30 min. This is a forum, not a chat room.

    kotlas7 (2/10/2009)


    If we add new secondary datafile to existing production database, how the data will be shared between mdf and newly created ndf file? do we need to move data from mdf to ndf or the database itself take care of that?

    If it's a new file in primary, SQL will use its proportional fill algorithm to add data across all files. If it's a new file in a new filegroup, then you'll have to move data. See Books Online for details

    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
  • Thanx Gila,It was just by mistake not deliberately...

    Thanks

Viewing 14 posts - 1 through 13 (of 13 total)

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