Solved

Move MS SQL server from C: to D: drive

Posted on 1998-12-16
7
302 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server Results to Excel File 18 73
Pivot Table in SQL Server 8 28
Sql case statement to calculate totals 5 32
T-SQL: Stored Procedure Syntax 3 29
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

679 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