Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2007
    Posts
    44

    Unanswered: moving all Databases

    hi i am trying to move my databases from one drive to another..sometimes could be into different network. i know how to do this through management studio. but how easy it could be doing it from query analyzer or may be using batch file. if you have experience please drop some words.

  2. #2
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    sp_detach_db
    sp_attach_db
    sp_attach_single_file_db

    -- This is all just a Figment of my Imagination --

  3. #3
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    Quote Originally Posted by tomh53
    sp_detach_db
    sp_attach_db
    sp_attach_single_file_db
    doesn't 2005 allow you to "alter database modify file" for user dbs in addition to tempdb ?

  4. #4
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    do not forget to recreate your logins
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  5. #5
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    yes it does:

    MODIFY FILE Specifies the file that should be modified. Only one <filespec> property can be changed at a time. NAME must always be specified in the <filespec> to identify the file to be modified. If SIZE is specified, the new size must be larger than the current file size.
    To modify the logical name of a data file or log file, specify the logical file name to be renamed in the NAME clause, and specify the new logical name for the file in the NEWNAME clause. For example:

    http://msdn2.microsoft.com/Platform/...s/copy_off.gif Copy Code

    MODIFY FILE ( NAME = logical_file_name, NEWNAME = new_logical_name )
    To move a data file or log file to a new location, specify the current logical file name in the NAME clause and specify the new path and operating system file name in the FILENAME clause. For example:

    -- This is all just a Figment of my Imagination --

  6. #6
    Join Date
    Jun 2007
    Posts
    44
    My two cents,attaching and detaching works for different server, but i am trying to move database from one drive to other drive. but stil on same server.

  7. #7
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    Quote Originally Posted by drek_01
    My two cents,attaching and detaching works for different server, but i am trying to move database from one drive to other drive. but stil on same server.
    After inflation, your $0.02 is now only worth one centime

    It works well for same server as well as different servers. Just detach the db, move the file or files needed, then reattach with the proper file names.

    EDIT: added (s) to last "file name"

    -- This is all just a Figment of my Imagination --

  8. #8
    Join Date
    Jun 2007
    Posts
    44
    Quote Originally Posted by tomh53
    After inflation, your $0.02 is now only worth one centime
    ohh...

    sure 'll do
    thanks

Posting Permissions

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