Solved

Move SQL Server 2005 database files to a new folder location

Posted on 2013-01-09
5
373 Views
Last Modified: 2013-01-24
current path

Path:

    C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
    C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA


i want to create new path in drive D
because i don't have  space in C
0
Comment
Question by:afifosh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 6

Expert Comment

by:Peter Kiprop
ID: 38761928
Afifos,

Use the query below to move the database files

use Databasename
go
Alter database Databasename modify file (name = Databasenamefilename , filename = 'D:\Foldername\Databasenamefilename.mdf')
go
Alter database Databasename modify file (name = DatabasenameLogname , filename = 'D:\Foldername\DatabasenameLogname.ldf')
go

You will need to replace the names accordingly for it to work.

Hope it helps.

Pthepebble
0
 
LVL 3

Expert Comment

by:Crower
ID: 38761931
detach your databases. move your files. atach the files on the new location.

http://support.microsoft.com/default.aspx?scid=kb;en-us;224071
0
 
LVL 10

Accepted Solution

by:
sqlservr earned 500 total points
ID: 38762418
ALTER DATABASE TempDB MODIFY FILE
(NAME = dbname, FILENAME = 'c:\mssql\dbname.mdf',SIZE = 3792KB )
GO
ALTER DATABASE TempDB MODIFY FILE
(NAME = dbname_log, FILENAME = 'c:\mssql\dbname_1.ldf',SIZE = 1792KB
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 38765720
First, can you tell us if they are user databases or system databases or all?
0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 38765877
Just detach databases

and move mdf/ldf files to new location and attach them again.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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