Database with mdf and ndf

  • hi Gurus,

    I have database D1(5Gb) with one mdf and one log file(By default).

    How can i store data from mdf to ndf file(after creation) in database?

    It will be great help if given with example

    Any help is appreciated

    Thanks,

    Neerav

  • 1. create a filegroup and a file in it

    2. to move a table from one filegroup to other:

    If u've got clustered index on the table, rebuild the clustered index on the new filegroup, This way the table will be moved. If you dont hv a clustered index, then create a clustered index in the new filegroup, this will move the table and then u can drop the clustered index.

    Refer BOL on details on how to add a filegroup and how to create a clustered index.



    Pradeep Singh

  • Neerav,

    Your requirement is not clear

    If you want to create a file and create all new objects in the new file

    1) Add file using alter database command

    2) disable auto growth for current file

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • this is easily done in enterprise manager/management studio

    note - you are moving the table between "filegroup" and not file

    a file is a member of filegroup and all tables in a filegroup are proportionally filled across the files in the the group

    1) create a new filegroup

    2) add a file to the filegroup

    3)right click on the table and look at the design and look at the right hand properties pane

    4)set the ""regualr data space" and "text/image filegroup" to the new filegroup

    5) also do this with indexes on the table

    you can script all of this , but if you're asking the question in the way you did, then i'm assuming it will be safer to use the GUI to do it.

    MVDBA

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

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