[dba-SQLServer] Moving A Database From C: to D:

Francisco Tapia fhtapia at gmail.com
Fri Apr 15 10:26:01 CDT 2005


You want to lookup the DETACH and ATTACH commands in BOL

This is the help for doing it in EM (FROM BOL)

How to attach and detach a database (Enterprise Manager) 

*To attach a database* 

   1. Expand a server group, and then expand a server.
   
   2. Right-click *Databases*, and select *All Tasks/Attach Database*.
   
   3. Enter the name of the MDF (*master* data file) of the database to 
   attach. If you are not sure where the file is located, click browse (*
   ...*) to search. There can only be up to 16 file names specified. For 
   more information, see sp_attach_db <javascript:hhobj_1.Click()>.
   
   4. To ensure that the specified MDF file is correct, click *Verify*. 
   The Original File Name(s) column lists all the files in the database (data 
   files and log files). The Current File(s) Location column lists the file 
   names and paths. If Microsoft(r) SQL Server™ cannot find the files in the 
   specified locations, the attach operation fails. The Current File(s) 
   Location column can be edited, and the current location of the file must be 
   in this column for the attach operation to work. For example, if you have 
   changed the default location of the file before you detached it, you must 
   specify the current location for the attach operation to be successful.
   
   5. In the *Attach as* box, enter the name of the database. The 
   database name must not match any existing database names.
   
   6. Specify the database owner.
   
   7. Click *OK*. A database node for the newly attached database is 
   created in the Database folder. 

*To detach a database* 

   1. Expand a server group, and then expand a server.
   
   2. Expand *Databases*.
   
   3. Right-click the database, and then select *All Tasks/Detach 
   Database*. This menu is visible only if you are a member of the *
   sysadmin* fixed server role and the server to which you are connected 
   is SQL Server 2000. The *master*, *model*, and *tempdb* databases 
   cannot be detached. 
   
   4. In the *Detach Database* dialog box, check the status of the 
   database. To successfully detach a database, STATUS should be: *The 
   database is ready to be detached*. Optionally, you can select to 
   update statistics prior to the detach operation.
   
   5. To terminate any existing connections from the database, click *
   Clear*.
   
   6. Click *OK*. The database node for the detached database is removed 
   from the Database folder. 



On 4/15/05, Paul Hartland <Paul.Hartland at orridge.co.uk> wrote:
> 
> To all,
> 
> We currently have a SQL Server 2000 database located on the C: drive of
> one of our servers (I must have had a brain dead moment when I done
> this), is there any simple way of moving the entire database onto the D:
> drive
> 
> Thanks in advance for any help on this....
> 
> PAUL HARTLAND
> Database Designer/Programmer
> paul.hartland at isharp.co.uk
> ISHARP
> 
> ISHARP (Information Services for Hospitality, Audit, Retail and
> Pharmacy) provide IT resources for the Christie Group Stock & Inventory
> Services companies.
> 
> _______________________________________________
> 
> This e-mail is intended only for the addressee named above.
> 
> As this e-mail may contain confidential or privileged information, if you 
> are not the named addressee, or the person responsible for delivering the 
> message to the named addressee, please return to the sender and delete the 
> original. The contents should not be disclosed to any other person nor 
> copies taken.
> 
> The Orridge web site can be found at : http://www.orridge.co.uk
> 
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
> 
> 


-- 
-Francisco
http://pcthis.blogspot.com |PC news with out the jargon!
http://sqlthis.blogspot.com | Tsql and More...


More information about the dba-SQLServer mailing list