Move SQL Server 2005 database files to a new folder location

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
LVL 1
AFIF JABADOAsked:
Who is Participating?
 
Ramesh Babu VavillaConnect With a Mentor Commented:
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
 
Peter KipropCommented:
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
 
CrowerCommented:
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
 
Anthony PerkinsCommented:
First, can you tell us if they are user databases or system databases or all?
0
 
Alpesh PatelAssistant ConsultantCommented:
Just detach databases

and move mdf/ldf files to new location and attach them again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.