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.
| Author |
Topic |
|
tocroi72
Yak Posting Veteran
89 Posts |
Posted - 2004-07-13 : 18:01:48
|
| I run this query: update sysfiles set name='Production_Log' where fileid=2and i got this message: Object 'sysfiles' cannot be modified.Is there anyway that i can modify the name of this log file? somehow when i created it, the name 'Production_log ' was inserted into the sysfiles table . As you see , the name have the blank space at the end. when i run DBCC Shrinkfile(production_log,2) it return an error message 'Could not locate file production_log in sysfilesI have to run a select statement in sysfiles table to copy the exact name which is 'Production_log ' , then it will find the log file. That's the reason i want to update the name of the log file.Any idea would be appreciated.Thanks |
|
|
gwhiz
Yak Posting Veteran
78 Posts |
Posted - 2004-07-13 : 18:12:07
|
| Well this is not recommended but in the server properties you can turn on adhoc updates to system tables. I believe this will allow you to make the change, just be sure to turn this off when done. It can be really dangerous to change system tables. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-14 : 02:22:35
|
| Maybe:ALTER DATABASE MyDatabase MODIFY FILE (NAME = 'NameWithSpace', NEWNAME = 'NameWithoutSpace')Kristen |
 |
|
|
tocroi72
Yak Posting Veteran
89 Posts |
Posted - 2004-07-14 : 14:01:15
|
| Thank you so much, the allow update doesn't allow to update the sysfiles then i tried ALTER DATABASE MyDatabase MODIFY FILE (NAME = 'NameWithSpace', NEWNAME = 'NameWithoutSpace')it works. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-14 : 14:05:18
|
| Glad to be of help, and "Thanks for the Thanks" - many people passing through here don't bother with the Thanks but its always appreciatedKristen |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-07-14 : 23:32:43
|
| You can only use ALTER DATABASE MyDatabase MODIFY FILE with tempdb. The easiest thing to do is set the database in single user mode, backup the database, restore the database from backup with different filenames. Pain in the arse isn't it. :)MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-15 : 09:10:01
|
| Are you sure? or is it different circumsances?I do the ALTER DATABASE MyDatabase MODIFY FILE thingie all the time (its the final step generated by my RESTORE SProc that renames the FILEs, after restore, to match the database name they have been restored to)Kristen |
 |
|
|
|
|
|
|
|