Professional Web Applications Themes

How do I move a log file to another drive? - Microsoft SQL / MS SQL Server

Hi, Simple scenario; one .mdf and one .ldf in the same directory. I would like to move the .ldf to a different drive, for fault tolerance. I guess I need an ALTER DATABASE command, but can't figure it out. And I can't delete the .ldf, since it is the primary log file. Any help appreciated. Thanks, John....

  1. #1

    Default How do I move a log file to another drive?

    Hi,

    Simple scenario; one .mdf and one .ldf in the same
    directory. I would like to move the .ldf to a different
    drive, for fault tolerance. I guess I need an ALTER
    DATABASE command, but can't figure it out. And I can't
    delete the .ldf, since it is the primary log file.

    Any help appreciated.

    Thanks,
    John.

    John Guest

  2. #2

    Default Re: How do I move a log file to another drive?

    John,

    Simple way would be to :

    1.Detach the database using sp_detach_db. [requires that no user is
    accessing the database and also database would be offline till you attach it
    back]
    2.Move the .ldf file to desired location.
    3.Attach the database back using sp_attach_db , this time mentioning the new
    ..ldf location.

    --
    Dinesh.
    SQL Server FAQ at
    http://www.tkdinesh.com

    "John" <ab.com> wrote in message
    news:0cd501c34b25$ca0e3df0$gbl... 


    Dinesh.T.K Guest

  3. #3

    Default Re: How do I move a log file to another drive?


    Thanks, Dinesh. Will give it a try!
     
    no user is 
    till you attach it 
    mentioning the new 
    >
    >
    >.
    >[/ref]
    John Guest

  4. #4

    Default Re: How do I move a log file to another drive?

    John,

    IIRC during SQL Setup, it wont ask you for a default log/data file
    location.But once SQL Server is up and running, you can mention the same in
    : Enterprise manager, right click on the SQL Server | properties and check
    in 'Database settings' tab.For Question2, I guess you have to , unless there
    is some other fancy way.


    --
    Dinesh.
    SQL Server FAQ at
    http://www.tkdinesh.com

    "John" <ab.com> wrote in message
    news:060601c34b36$90ee0120$gbl... 
    > no user is 
    > till you attach it 
    > mentioning the new 
    > >
    > >
    > >.
    > >[/ref][/ref]


    Dinesh.T.K Guest

Similar Threads

  1. Move a file
    By Neill Taylor in forum PERL Beginners
    Replies: 6
    Last Post: May 3rd, 10:20 PM
  2. Moveing Tape drive, need to move catalog files...
    By Jon Smith in forum Windows Server
    Replies: 0
    Last Post: June 7th, 05:51 PM
  3. Replies: 0
    Last Post: October 31st, 02:02 AM
  4. #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
  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