August 18, 2017 at 2:48 am
Hi all,
I have accidentally added 2 directories for TempDB data files (D:\ and E:\) now i have duplicate files in both drives. How can i remove either one of the drive and just keeping one drive? These are new setup hence files has no data. Thanks in advance!
August 18, 2017 at 2:57 am
What is the configuration of your TempDB now? Are all of the files from sys.database_files shown in D or E or a mixture?
If they are all in one specific directory the other isn't used and can be removed without issue.
If they are mixed between D and E you will need to modify the filelocation and restart the instance to take effect then you can remove the unneeded location.
August 18, 2017 at 3:14 am
Thanks Anthony! It is mixed between D & E. You mean i need to modify the file location to my desire drive first (E:\) and remove unwanted files in D:\ Would it cause any error?
August 18, 2017 at 3:17 am
oceanics8 - Friday, August 18, 2017 3:14 AMThanks Anthony! It is mixed between D & E. You mean i need to modify the file location to my desire drive first (E:\) and remove unwanted files in D:\ Would it cause any error?
Run your alter database modify file commands to modify all files which are on D and modify them so they are on E. Stop the SQL service, start the SQL service, upon starting it will create the missing files on the E drive.
Once SQL has started ok, you can remove everything in D.
August 18, 2017 at 3:22 am
Thanks Anthony! Hope there is no error after removing files! TGIF enjoy...
August 20, 2017 at 11:26 am
Riic - Friday, August 18, 2017 3:22 AMThanks Anthony! Hope there is no error after removing files! TGIF enjoy...
You could always just rename them until you are sure.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 20, 2017 at 11:32 am
Riic - Friday, August 18, 2017 3:22 AMThanks Anthony! Hope there is no error after removing files! TGIF enjoy...
Run the alter database, then restart SQL. Once SQL's up, then, and only then, try to delete the files. If you can delete them, then they're not in use and it's safe to do so as they're no longer in use.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply