Need to load data onto a new drive

  • I have SQL installed on the C Drive and I have couple of databases on C drive. I am running out of space on C drive and need to load data on E drive. Please advise me of the steps I need to follow.

    Thank you

  • 1) Detatch the database(s)

    2) Copy mdf & ldf files you your new drive(s)

    3) Attach the databases(s)

  • You can always detach the databases, move 'em to E and reattach... just one of many ways. But of course the database is not available while you do this.

  • Add a new datafile and logfile on the e: drive.

    This can be done through Enterprize Manager

    right click the database

    select properties

    Go to the Data files tab

    Type in a name for your datafile in the filename box

    Edit the location box  to point to e:

    Specify the size of the datafile

    For the old datafile, uncheck the autogrow option

    Repeat for the logfile 

  • But if you want to move your data from C to E with no DB downtime, you do as mise13 says. With the addition of placing the new file in a new filegroup, go into design mode of your tables and modify Table Filegroup to be your new file group. Do the same for indexes and save the tables. This will effectively move the table, with it's data, to your E drive.

    Having more then a couple of tables with some indexes makes this approach cumbersome and then you should take a look in the scripts section for a script that does it for you...

     

    Hanslindgren

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

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