How to split 400GB database into multiple data files

Last post 07-08-2009 10:37 AM by satya. 13 replies.
Page 1 of 1 (14 items)
Active Topics My Discussions Unanswered Sort Posts: Previous Next
  • 03-07-2008 10:35 PM

    • Eric72
    • Not Ranked
    • Joined on 03-08-2008
    • Posts 2

    How to split 400GB database into multiple data files

    I have inherited a SQL Server 2005 database that is 400GB in size with 300GB of data on one data file on a RAID 10 disk and a second 100GB data file with indexes only on another drive. The log is on a separate drive as well.

    I would like to split the data data file into multiple files and the index data file into multiple files potentially to span different disks to achieve parallel i/o. I believe this can be accomplished with the creating several data files then using the empty file command or by using the restore method with move.

    Does anyone have any insights into a "best solution" method?

    Thanks.  

  • 03-10-2008 4:34 AM In reply to

    • satya
    • Top 10 Contributor
    • Joined on 11-05-2002
    • United Kingdom
    • Posts 23,751
    • Microsoft MVP
      Moderator

    Re: How to split 400GB database into multiple data files

    Welcome to the forums!

    What is the furture growth of this database?

    DO you have any performance issues at the moment?

    Why you are thinking about partitioning the data?

    -Satya S K J

    SQL Server MVP



    Knowledge is Power, you will gain by sharing it. SSQA.net - Invisible contributions to the users & visible success in SQL Community.
  • 03-10-2008 2:56 PM In reply to

    • Eric72
    • Not Ranked
    • Joined on 03-08-2008
    • Posts 2

    Re: How to split 400GB database into multiple data files

    Satya, 

    I want to split the one big data file and potentially index file into 4 or more files for file portability and for parallel i/o. These files reside on a SAN.

    Thanks,

    Eric

  • 03-11-2008 5:47 AM In reply to

    • satya
    • Top 10 Contributor
    • Joined on 11-05-2002
    • United Kingdom
    • Posts 23,751
    • Microsoft MVP
      Moderator

    Re: How to split 400GB database into multiple data files

    Yes you can achieve that by uisng ALTER DATABASE statment, if you have the data in 1 file already then you should move them to these files in order to see what you want to achieve.

    -Satya S K J

    SQL Server MVP



    Knowledge is Power, you will gain by sharing it. SSQA.net - Invisible contributions to the users & visible success in SQL Community.
  • 06-03-2009 5:55 AM In reply to

    • viv
    • Not Ranked
    • Joined on 06-03-2009
    • Posts 8

    Re: How to split 400GB database into multiple data files

     

    satya:

    Yes you can achieve that by uisng ALTER DATABASE statment, if you have the data in 1 file already then you should move them to these files in order to see what you want to achieve.

     

     How will you actually move data across this newly created datafiles?

  • 06-17-2009 5:32 AM In reply to

    Re: How to split 400GB database into multiple data files

    Welcome to the forums.....

    First you need to add those new data files to the database by using alter database as suggested by Satya.

    Then you need to divide your table into groups as what tables you want on which data file. Now you need to move those table data to the respective datafile. And you can achieve this by CREATE INDEX with the DROP_EXISTING clause.

    Ram
    MCDBA
    View Rohit Paliwal's profile on LinkedIn
  • 06-17-2009 12:58 PM In reply to

    Re: How to split 400GB database into multiple data files

    Usually DB Architects consider splitting database files influenced by table size.. rather than actual table usage. for 'example' if a db has 10 tables, its seen in practice you create as following [Opt 1] 5 files having 2 tables each- simply called equal share OR [opt 2] 4 files having 1 table each of larger sizes and 6 tables in 1 file only - called table size distribution OR [Opt 3] this I usually follow, I look into each table importance/usage by application and corresponding size and create files having balanced DISKIO because not all tables are equally important and being used frequently; it helps increasing parallelism on SAN and faster query results. though its difficult to implement as a lot ground work needs to be done before making decision about which table goes where for balanced division. Good luck;
    Deepak.Kumar@SQLKnowledge.com

    View Deepak Kumar's profile on LinkedIn

    Disclaimer: This post is provided as is with no rights warranty for accuracy, for the sake of knowledge sharing only.
  • 06-18-2009 3:53 AM In reply to

    • viv
    • Not Ranked
    • Joined on 06-03-2009
    • Posts 8

    Re: How to split 400GB database into multiple data files

    Thanks a lot for you replies guys.

    I suppose to increasing parallelism on SAN and faster query results you will have to split this datafiles (.ndf files) accross different disk arrays served by an independent disk controller on SAN. Sorry, if i may sound a bit ignorent here but i dont really understand SAN Architecture very well.

    Regards,

    Viv

  • 06-18-2009 7:44 AM In reply to

    Re: How to split 400GB database into multiple data files

    Yup, database files (mdf/ndf/ldf)should be placed in physically/logically different SAN RAID array's & controllers. by having this placement you will get true parallelism benefits. have a quick look on this article: http://www.novell.com/coolsolutions/appnote/19687.html
    Deepak.Kumar@SQLKnowledge.com

    View Deepak Kumar's profile on LinkedIn

    Disclaimer: This post is provided as is with no rights warranty for accuracy, for the sake of knowledge sharing only.
  • 07-03-2009 3:53 AM In reply to

    • cteune
    • Not Ranked
    • Joined on 07-03-2009
    • Posts 1

    Re: How to split 400GB database into multiple data files

    Sorry if this discussion is already closed but I had a question. Is there any performance improvements gained by splitting a database into separate files if your server is not running an array and is a single drive server? i ask this because the emphasis seems to be on parallel IO as the reason for file splitting but with a single disk this is not going to help.
  • 07-03-2009 3:56 AM In reply to

    Re: How to split 400GB database into multiple data files

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Contributing Editor, Writer & Forum Moderator http://www.sql-server-performance.com
    Webmaster: http://www.insidesql.org
    View Frank Kalis's profile on LinkedIn
  • 07-03-2009 9:37 AM In reply to

    Re: How to split 400GB database into multiple data files

    MohammedU.
    Microsoft SQL Server MVP
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.
  • 07-03-2009 10:28 AM In reply to

    • viv
    • Not Ranked
    • Joined on 06-03-2009
    • Posts 8

    Re: How to split 400GB database into multiple data files

     Hi cteune

    There will not be significant if any  performance improvements improvement if you are planning to split database into seperate files on a server with one physical disk.

    As per microsoft, If you had a disk array, Each separate file is physically placed on a disk or set of disks (if the hardware disks are striped). SQL Server maintains a map of each file's location on the disk. If one file is created across a hardware stripe of four disks, one map points to the location of data on all four disks. If four files are created across a hardware stripe of four disks, four maps point to the location of the data on all four disks, one map in each file for each object in that file.Whenever a data object (table) is accessed sequentially, a separate thread is created for each file in parallel. Therefore, a tablescan for a table that is assigned to a filegroup with four files uses four separate threads to read the data in parallel.

     So in the the case of disk array you are better off with the multiple file setup.

     I understand this is not all comprehensive message but there whole lot more to this subject. Please feel free to ask questions.

     Vivek

     

     

     

  • 07-08-2009 10:37 AM In reply to

    • satya
    • Top 10 Contributor
    • Joined on 11-05-2002
    • United Kingdom
    • Posts 23,751
    • Microsoft MVP
      Moderator

    Re: How to split 400GB database into multiple data files

    To addup you have got many great references out there on that question, but within my experience it depends on hwo the database is normalized. No matter if you sprawl out the db files in multiple disks the performance will suffer if the data modification/insert process hammers the database heavily.

    cteune:
    Sorry if this discussion is already closed but I had a question. Is there any performance improvements gained by splitting a database into separate files if your server is not running an array and is a single drive server? i ask this because the emphasis seems to be on parallel IO as the reason for file splitting but with a single disk this is not going to help.

    -Satya S K J

    SQL Server MVP



    Knowledge is Power, you will gain by sharing it. SSQA.net - Invisible contributions to the users & visible success in SQL Community.
Page 1 of 1 (14 items)
Active Topics   My Discussions    Unanswered Posts


© 2010 Jude O'Kelly All Rights Reserved.