May 18, 2012 at 6:43 am
I'm trying to add a secondary data file to temp to help with performance but it's coming with an error:
The file 'X:\xxxx\xxxxx.ndf' cannot be overwritten. It is being used by database 'tempdb'.
Is there some cleanup that needs to be done somewhere or do I HAVE to create the .ndf under a different name?
May 18, 2012 at 6:58 am
Can you post the command(s) you are sending to accomplish this, please? First thoughts are that you are specifying the existing .ndf and if the DB is attached to the instance, you won't be able to overwrite this. For a new ndf ensure you are specifying a different filename.
---
Note to developers:Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.
May 18, 2012 at 7:13 am
Trying to do a DR test. The file did exist but got deleted. I'm trying to recreate it.
GO
ALTER DATABASE tempdb
ADD FILE
(
NAME = tempdb_data_04,
FILENAME = 'x:\xxx\xxxx.ndf',
SIZE = 2MB,
FILEGROWTH = 1MB
);
GO
May 18, 2012 at 7:21 am
acorrei1 (5/18/2012)
Trying to do a DR test. The file did exist but got deleted. I'm trying to recreate it.GO
ALTER DATABASE tempdb
ADD FILE
(
NAME = tempdb_data_04,
FILENAME = 'x:\xxx\xxxx.ndf',
SIZE = 2MB,
FILEGROWTH = 1MB
);
GO
but if you stop and restart tempdb it automatically re-creates the deleted files - as soon as you start sql it will re-create , thefore you're just trying to re-add a file that has already been added
MVDBA
May 18, 2012 at 7:26 am
michael vessey (5/18/2012)
acorrei1 (5/18/2012)
Trying to do a DR test. The file did exist but got deleted. I'm trying to recreate it.GO
ALTER DATABASE tempdb
ADD FILE
(
NAME = tempdb_data_04,
FILENAME = 'x:\xxx\xxxx.ndf',
SIZE = 2MB,
FILEGROWTH = 1MB
);
GO
but if you stop and restart tempdb it automatically re-creates the deleted files - as soon as you start sql it will re-create , thefore you're just trying to re-add a file that has already been added
When you say stop and start tempdb. Do you mean stop and start sqlserver?
May 18, 2012 at 7:29 am
yes - sorry - a typo on my part
MVDBA
May 18, 2012 at 2:06 pm
Yes, it will need a different file name.
logical file name tempdb_data1, physical file name T:\tempdb_data1.ndf
logical file name tempdb_data2, physical file name T:\tempdb_data2.ndf
etc...
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply