January 20, 2018 at 1:46 pm
Comments posted to this topic are about the item Changing Extensions
January 20, 2018 at 2:06 pm
The most correct answer is actually missing a step.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 22, 2018 at 2:49 am
Setting the database offline as the first step and bringing it back online at the end would be a good idea!
Have a nice day,Christoph
January 22, 2018 at 2:57 am
Yes, I chose option 4 for that reason. It's correct, and although it entails more steps, it's less disruptive since you don't have to take the database offline.
John
January 22, 2018 at 3:47 am
The question isn't "What is the easiest way" but "what should I do". And adding an extra file and migrating the data works.
January 22, 2018 at 5:20 am
You can also argue that the first option is also correct if you take the database Offline.
Steps would be:
1- Take the DB Offline
2- Rename the file in the OS with SQL Server stopped. Use an UPDATE statement to alter sys.database_files.physical_name.
3- Bring the DB back Online.
January 22, 2018 at 5:44 am
ildjarn.is.dead - Monday, January 22, 2018 3:47 AMThe question isn't "What is the easiest way" but "what should I do". And adding an extra file and migrating the data works.
Try your solution with a 2TB database file. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
January 22, 2018 at 6:15 am
ferasdeeb - Monday, January 22, 2018 5:20 AMYou can also argue that the first option is also correct if you take the database Offline.
Steps would be:
1- Take the DB Offline
2- Rename the file in the OS with SQL Server stopped. Use an UPDATE statement to alter sys.database_files.physical_name.
3- Bring the DB back Online.
I don't think you can update the system catalogs directly - not since 2000, anyway. That's why I discounted that option.
John
January 22, 2018 at 6:48 am
Jeff Moden - Monday, January 22, 2018 5:44 AMildjarn.is.dead - Monday, January 22, 2018 3:47 AMThe question isn't "What is the easiest way" but "what should I do". And adding an extra file and migrating the data works.Try your solution with a 2TB database file. 😉
Does that make the answer less correct? Again: Nowhere in the question is 'easiest' mentioned. Answer 4 is a valid answer, although most of the times not the smartest. But answer 3 (the 'correct' answer) is definitely incomplete (you need to offline the database before renaming the datafile), so it's actually less correct than answer #4.
January 22, 2018 at 7:00 am
ildjarn.is.dead - Monday, January 22, 2018 6:48 AMJeff Moden - Monday, January 22, 2018 5:44 AMildjarn.is.dead - Monday, January 22, 2018 3:47 AMThe question isn't "What is the easiest way" but "what should I do". And adding an extra file and migrating the data works.Try your solution with a 2TB database file. 😉
Does that make the answer less correct? Again: Nowhere in the question is 'easiest' mentioned. Answer 4 is a valid answer, although most of the times not the smartest. But answer 3 (the 'correct' answer) is definitely incomplete (you need to offline the database before renaming the datafile), so it's actually less correct than answer #4.
Possibly. What are you using to do the migration of the data to the new file?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 22, 2018 at 7:59 am
ildjarn.is.dead - Monday, January 22, 2018 6:48 AMDoes that make the answer less correct? Again: Nowhere in the question is 'easiest' mentioned. Answer 4 is a valid answer, although most of the times not the smartest. But answer 3 (the 'correct' answer) is definitely incomplete (you need to offline the database before renaming the datafile), so it's actually less correct than answer #4.
+1
I fully agree that answer #4 is also correct. Sometimes may be the use of migration more practical, see e.g.in "Move Database Files Without Taking the Database Offline".
January 22, 2018 at 8:15 am
George Vobr - Monday, January 22, 2018 7:59 AMildjarn.is.dead - Monday, January 22, 2018 6:48 AMDoes that make the answer less correct? Again: Nowhere in the question is 'easiest' mentioned. Answer 4 is a valid answer, although most of the times not the smartest. But answer 3 (the 'correct' answer) is definitely incomplete (you need to offline the database before renaming the datafile), so it's actually less correct than answer #4.+1
I fully agree that answer #4 is also correct. Sometimes may be the use of migration more practical, see e.g.in "Move Database Files Without Taking the Database Offline".
I'll fully agree that "It Depends" on the method used to do the migration. If you use DBCC SHRINKFILE with the "empty" option to do the migration, then you're in deep Kimchie when it's done, especially if the file is of any size that could be considered "large".
.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 22, 2018 at 8:50 am
Christoph Muthmann - Monday, January 22, 2018 2:49 AMSetting the database offline as the first step and bringing it back online at the end would be a good idea!
Although it is true that you need to set the database offline at certain point to remove the lock SQL Server holds on the database files, the steps to minimise downtime are
- ALTER DATABASE MODIFY FILE to change the file name
- SET DATABASE OFFLINE --> this is actually missing in the "correct answer"
- Change the actual file --> only possible if the db is offline
- SET DATABASE ONLINE
Obviously you can set offline first, but you are adding down time, it possibly is negligible for a single file, specially if you have everything scripted out, but I'd say its better practice have the database offline as less as possible.
Cheers.
January 22, 2018 at 9:17 am
I would argue that this sentence, "What should I do to rename this file?", means adding a new file is incorrect.
I didn't add the verbiage for offline/online, or detach/attach as it makes a cumbersome set of answers here.
You cannot update the system tables anymore.
January 22, 2018 at 10:16 am
Item 4 was my choice, which IS correct whether you think so or not, and the best way to perform this operation. Why would you consider this incorrect? It is the most correct of your options available.
Viewing 15 posts - 1 through 15 (of 28 total)
You must be logged in to reply to this topic. Login to reply