Solved

Move MS SQL server from C: to D: drive

Posted on 1998-12-16
7
296 Views
Last Modified: 2010-03-19
I have MS SQL 6.5 installed on the C: drive of my server, which is running out of space,(200MB). I would like to reinstall it onto the D: drive (2GB) what is the best way of doing this, transfering the databases etc?
0
Comment
Question by:mursell
7 Comments
 

Expert Comment

by:kt1230
ID: 1092289
I would suggest one methods:

(1)Keep you existing SQL system and data file intact; Build a
   new device file on D drive, and expand your database to this
   newly created device. ( No need to reinstall, might get
   some perfomance boot and less hassle).
 


0
 
LVL 4

Expert Comment

by:dwwang
ID: 1092290
If you want to free the disk space of C:, I have a solution, I have done this before:

1. Delete your original database and then the corresponding device from Enterprise Manager. NOTE: the DAT file is not deleted when you delete the database and the device :)

2. Create a new device in D: of exactly the SAME NAME AND SIZE as the original one, then create the database, (also of exactly the same name of the original one)

3. Shutdown SQL server, then copy the old DAT file from C: to D: to overwrite the newly created DAT file.

4. Restart SQL Server and you can see every thing is OK now!

Anyway, you take your own risk to do all this.

You can first do some tests before take out the real task, also be sure to backup all schema/data before doing the transfer, it's always better than sorrow :)
0
 
LVL 1

Expert Comment

by:ivanh
ID: 1092291
I had the same problem, but all I did was move my database devices to another drive.  Microsoft has some stored proc that assist in this, but I had problems in even finding those stored procs (I think it was called sp_movedevice, or something like that), anyway, I move my master.dat and all my other dats manually and it works just fine.

Steps I took:
1.  Shut down SQL Server.  
2.  COPY (don't move) all your dats to the new location.  Master as well, if you want
3.  Go into the registry \\HKEY_LOCAL_MACHINE\Microsoft\MSSQLServer\Parameters.  Change SQLArg0 to the new location of your master.dat
4.  Start SQL Server
5.  In the master database, do a select * from sysdevices.  You will see all your dats and their path.  Change these to the new location of your dats with an update statement.
6.  stop and restart SQL Server

Poke around and make sure none of your DB's are suspect.  If so, then you will need to make a change in sysdatabases (status column).  

Just for kicks, I also ran a dbcc checkdb just to make sure everything was still okay.

If you want to leave your master.dat where it is, then just do 1,2,5,6

I've been running fine for about 3 weeks now.

0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Expert Comment

by:ivanh
ID: 1092292
when you feel confident, delete the old dats.
0
 
LVL 1

Expert Comment

by:ivanh
ID: 1092293
I would also suggest before updating sysdevices that you make a copy of the table by doing a select into.
0
 
LVL 3

Accepted Solution

by:
traygreen earned 100 total points
ID: 1092294
If you want the server engine on th new drive, go ahead and install it there

then/or
1) Create a device on the D Drive
2) Create a database on the new device (must be as large as the source database - not actual data)
3) (if you created new server)make sure both servers are registered in one of the servers
4) Right click on the database on your c drive and select the "transfer" option
5) Verify the Source and set the target database
6) Click "Start Transfer"

Then you can delete the database on C and remove the device etc.
0
 
LVL 3

Expert Comment

by:traygreen
ID: 1092295
Other option is just to create a new device on the new drive and then Alter the database to include space from the new drive.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now