Wednesday, March 21, 2012

How can I move tempdb database files out of C drive?

Hello,
Does anyone know how I can successfully move the tempdb database to a
different drive besides C? I tried detaching and re-attaching it but you
can't do that with system databases.
FYI, I am using SQL Server 2005.
Thanks!
JohnnyCheck out the Alter Database in BOL. For Tempdb you can specify a move
option for the files and it will take effect after a restart.
--
Andrew J. Kelly SQL MVP
"Johnny" <Johnny@.discussions.microsoft.com> wrote in message
news:19307F29-9AF5-4499-8AC6-2A5E82040E6D@.microsoft.com...
> Hello,
> Does anyone know how I can successfully move the tempdb database to a
> different drive besides C? I tried detaching and re-attaching it but you
> can't do that with system databases.
> FYI, I am using SQL Server 2005.
> Thanks!
> Johnny|||How to Move TEMPDB from one location to another
--­--
USE master
go
ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME ='E:\tempdb.mdf')
go
ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME ='E:\templog.ldf')
go
where NAME refers to the logical name of the tempdb database and log files,
and where FILENAME refers to the new location of the
tempdb files. Once this command has run, you must restart the mssqlserver
service before it takes affect.
Thanks
Hari
SQL Server MVP
"Johnny" <Johnny@.discussions.microsoft.com> wrote in message
news:19307F29-9AF5-4499-8AC6-2A5E82040E6D@.microsoft.com...
> Hello,
> Does anyone know how I can successfully move the tempdb database to a
> different drive besides C? I tried detaching and re-attaching it but you
> can't do that with system databases.
> FYI, I am using SQL Server 2005.
> Thanks!
> Johnny|||Perfect. Thanks guys!
"Hari Prasad" wrote:
> How to Move TEMPDB from one location to another
> --­--
> USE master
> go
>
> ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME => 'E:\tempdb.mdf')
> go
> ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME => 'E:\templog.ldf')
> go
> where NAME refers to the logical name of the tempdb database and log files,
> and where FILENAME refers to the new location of the
> tempdb files. Once this command has run, you must restart the mssqlserver
> service before it takes affect.
> Thanks
> Hari
> SQL Server MVP
> "Johnny" <Johnny@.discussions.microsoft.com> wrote in message
> news:19307F29-9AF5-4499-8AC6-2A5E82040E6D@.microsoft.com...
> > Hello,
> >
> > Does anyone know how I can successfully move the tempdb database to a
> > different drive besides C? I tried detaching and re-attaching it but you
> > can't do that with system databases.
> >
> > FYI, I am using SQL Server 2005.
> >
> > Thanks!
> > Johnny
>
>sql

No comments:

Post a Comment