Professional Web Applications Themes

How to move .mdf file to another drive. - Microsoft SQL / MS SQL Server

I want to move my .mdf file from one drive (E:) to another drive (C:). Can I do it without backup/restore? WHat are the steps?...

  1. #1

    Default How to move .mdf file to another drive.

    I want to move my .mdf file from one drive (E:) to another
    drive (C:). Can I do it without backup/restore? WHat are
    the steps?

    Sender Guest

  2. #2

    Default Re: How to move .mdf file to another drive.

    Please always state what version you are using.

    You can do this with sp_detach_db and sp_attach_db. Please read about these
    commands in the Books Online.
    If you are SQL Server 2000, you perform a detach and an attach by right
    clicking on the database in Enterprise Manager.

    Basically, the steps are:

    Detach the database
    Move the files
    Attaching the database, specifying the new file locations

    --
    HTH
    ----------------
    Kalen Delaney
    SQL Server MVP
    www.SolidQualityLearning.com


    "Sender" <com> wrote in message
    news:047c01c35abc$e56181b0$gbl... 


    Kalen Guest

  3. #3

    Default Re: How to move .mdf file to another drive.

    Hi there,

    Open your Enterprise Manager ang to your SQL GROUP -> SQL Server ->
    Databases and right click your server.
    Go to All tasks and then BACKUP DataBase.
    follow the steps on the screen ...

    Daniel

    "Sender" <com> escreveu na mensagem
    news:047c01c35abc$e56181b0$gbl... 


    Daniel Guest

  4. #4

    Default Re: How to move .mdf file to another drive.

    I'm Sorry, I was on the phone and didn't pay the proper attention to the
    thread.

    To perform the task you can create a new database in the place you want it
    to be, then ShutDown the SQL Server Service (the one on the System Tray),
    and then move the files of the old database overwriting the files of the new
    database, then you turn on the SQL Service again and erase the olde
    database. Well, I can see this isn't the best way to do it, even working.
    Best to follow the advices of the other guys about the _db_attach and
    db_detach (probably I will in the future)

    Sorry for the inconvinient.

    "AlexS" <ca> escreveu na mensagem
    news:phx.gbl... 
    >
    >[/ref]


    Daniel Guest

  5. #5

    Default Re: How to move .mdf file to another drive.

    Check sp_detach_db and sp_attach_db. Steps: detach, copy .mdf and .ldf,
    attach.

    HTH
    Alex

    "Sender" <com> wrote in message
    news:047c01c35abc$e56181b0$gbl... 


    AlexS Guest

Similar Threads

  1. Moveing Tape drive, need to move catalog files...
    By Jon Smith in forum Windows Server
    Replies: 0
    Last Post: June 7th, 05:51 PM
  2. Replies: 0
    Last Post: October 31st, 02:02 AM
  3. #25977 [NEW]: fopen('file', 'r'); doesn't move to the end of the file
    By nightstorm at tlen dot pl in forum PHP Development
    Replies: 0
    Last Post: October 24th, 04:53 PM
  4. How do I move a log file to another drive?
    By John in forum Microsoft SQL / MS SQL Server
    Replies: 3
    Last Post: July 16th, 02:04 PM
  5. Cannot copy a file from NFS mounted drive to windows C:\ drive
    By Jagdish in forum Windows Setup, Administration & Security
    Replies: 0
    Last Post: July 15th, 03:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139