Solved

Move SQL Server 2005 database files to a new folder location

Posted on 2013-01-09
5
368 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
5 Comments
 
LVL 6

Expert Comment

by:Peter Kiprop
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
First, can you tell us if they are user databases or system databases or all?
0
 
LVL 21

Expert Comment

by:Alpesh Patel
Comment Utility
Just detach databases

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

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Read about achieving the basic levels of HRIS security in the workplace.
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…

762 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

10 Experts available now in Live!

Get 1:1 Help Now