Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 SQL Server Administration (2012)
 Moving tempdb

Author  Topic 

yaron2311
Starting Member

2 Posts

Posted - 2013-02-09 : 11:29:44
Hi

I'm trying to change the location of tempdb.mdf and tempdb.ldf files.

i'm using the following query in order to set the new location of the files:

ALTER DATABASE tempdb
MODIFY FILE (NAME=N'tempdb',FILENAME='c:\Program Files (x86)\Microsoft SQL Server\MSSYARONTEMP\tempdb.mdf')

and i'm getting the following error:

Msg 5041, Level 16, State 1, Line 1
MODIFY FILE failed. File 'tempdb' does not exist.

The files are located in this path.

Did someone faced this issue before?

thanks for the help

Yaron



Yaron

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-02-09 : 11:39:25
Check what value you have placed next to the NAME= .

Use this query to identify the correct NAME:

use tempdb
go
select fileid,name,[filename] from sys.sysfiles

--the output is something like
--fileid name filename
--1 tempdev G:\MSSQLSERVER\MSSQL$INST1\Data\tempdb.mdf
--2 templog F:\MSSQLSERVER\MSSQL$INST1\Data\templog.ldf
--3 tempdev1 E:\MSSQLSERVER\MSSQL$INST1\Data\tempdev1.ndf

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

yaron2311
Starting Member

2 Posts

Posted - 2013-02-09 : 12:05:49
Thanks for the help

I made the changes according to the name that the query retrieved but now after stoping and starting the Data Base again i'm geting the following error:

"unable to start service MSSQLSERVER on server USER-PC"



I copied the mdf and ldf files to the new path.

do you know why this problem happened?

thanks

Yaron
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-02-10 : 01:51:12
Could you post the error message from Event Viewer Event Log related to this error?. There is normally some detail in the error message

Does the service account have sufficient permissions on the folder?

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2013-02-11 : 17:17:17
quote:
Originally posted by yaron2311

Thanks for the help

I made the changes according to the name that the query retrieved but now after stoping and starting the Data Base again i'm geting the following error:

"unable to start service MSSQLSERVER on server USER-PC"



I copied the mdf and ldf files to the new path.

do you know why this problem happened?

thanks

Yaron



Happened to me not along ago and it was a permissions problem. SQL could not create the tempdb files in the location I specified.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-02-12 : 01:42:07
As well as a common issue of explicit permissions on folder- I've noticed the problem suddenly appear if there are AD group changes. It's still the same ultimate effect - i.e permissions on the folder.
So it's worth exploring a few different avenues for root cause

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -