June 29, 2018 at 2:26 am
Good Morning Experts,
As per our DBA guidelines, tempdb data files are stored in G drive, and user database data files are stored in J drive. A junior dba added data file in G drive for a user database instead of J drive. Management does not want database to be taken offline or instance recycled. Could you please share on how to rectify this.
June 29, 2018 at 3:32 am
coolchaitu - Friday, June 29, 2018 2:26 AMGood Morning Experts,
As per our DBA guidelines, tempdb data files are stored in G drive, and user database data files are stored in J drive. A junior dba added data file in G drive for a user database instead of J drive. Management does not want database to be taken offline or instance recycled. Could you please share on how to rectify this.
Add a file on the correct drive, then use shrink file with empty file to move the content to the new file and finally delete the file.
😎
You can do this through the SSMS or ping back here if you need help with the syntax.
June 29, 2018 at 3:53 am
Eirikur Eiriksson - Friday, June 29, 2018 3:32 AMcoolchaitu - Friday, June 29, 2018 2:26 AMGood Morning Experts,
As per our DBA guidelines, tempdb data files are stored in G drive, and user database data files are stored in J drive. A junior dba added data file in G drive for a user database instead of J drive. Management does not want database to be taken offline or instance recycled. Could you please share on how to rectify this.
Add a file on the correct drive, then use shrink file with empty file to move the content to the new file and finally delete the file.
😎You can do this through the SSMS or ping back here if you need help with the syntax.
Could you please help me with syntax
June 29, 2018 at 4:56 am
coolchaitu - Friday, June 29, 2018 3:53 AMEirikur Eiriksson - Friday, June 29, 2018 3:32 AMcoolchaitu - Friday, June 29, 2018 2:26 AMGood Morning Experts,
As per our DBA guidelines, tempdb data files are stored in G drive, and user database data files are stored in J drive. A junior dba added data file in G drive for a user database instead of J drive. Management does not want database to be taken offline or instance recycled. Could you please share on how to rectify this.
Add a file on the correct drive, then use shrink file with empty file to move the content to the new file and finally delete the file.
😎You can do this through the SSMS or ping back here if you need help with the syntax.
Could you please help me with syntax
This should get you there
😎
GO
USE [master]
GO
-- ADD THE NEW FILE
ALTER DATABASE [DB NAME] ADD FILE ( NAME = N'[LOGICAL NAME]', FILENAME = N'[FULL PATH AND FILE NAME]' , SIZE = 262144KB , FILEGROWTH = 65536KB ) TO FILEGROUP [PRIMARY]
GO
USE [DB NAME]
GO
-- MOVE THE CONTENT TO THE OTHER FILES IN THE FILEGROUP
DBCC SHRINKFILE (N'[LOGICAL NAME]' , EMPTYFILE)
GO
-- REMOVE THE FILE
ALTER DATABASE [DB NAME] REMOVE FILE [LOGICAL NAME]
GO
July 1, 2018 at 1:00 am
Did you manage to do this?
😎
July 1, 2018 at 2:30 am
Eirikur Eiriksson - Sunday, July 1, 2018 1:00 AMDid you manage to do this?
😎
Yes sir
July 1, 2018 at 2:51 am
coolchaitu - Sunday, July 1, 2018 2:30 AMEirikur Eiriksson - Sunday, July 1, 2018 1:00 AMDid you manage to do this?
😎Yes sir
Good stuff!
😎
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply