July 9, 2003 at 1:33 pm
This originally started because I am trying to shrink a log file that was set to an outrageously large size from the get go. I was going to use DBCC SHRINKFILE but on the database I am working with the logical filename is incorrect--most likely because it was created by doing a restore from a production database backup. Anyone know how I can correct the logical file names for databases? BTW, SQL 7 SP3 on Win2k.
Thanks,
George
July 9, 2003 at 1:57 pm
You need to use this to change the logical names :
ALTER DATABASE DB1
MODIFY FILE (NAME=DB1_Data, NEWNAME=DB2_Data)
ALTER DATABASE DB1
MODIFY FILE (NAME=DB1_Log, NEWNAME=DB2_Log)
.
July 9, 2003 at 2:01 pm
Ooooh, I see. Duh, I knew about the command but was afraid it would interfere with a database with the same logical name. *Smacks self on head..Alter DATABASE..* Thanks for the quick reply.
July 9, 2003 at 2:07 pm
Shoot, is NEWNAME specific to SQL Server 2000? Am getting a syntax error on SQL 7.
July 9, 2003 at 2:10 pm
quote:
BTW, SQL 7 SP3 on Win2k.
It doesn't work on SQL Server 7.0.
Use sp_helpfile to find out the logical name of your database.
Two databases can have same logical name as long as the physical file name either different or in different directories.
Any error messages when you tried to shrink the log file?
July 9, 2003 at 2:14 pm
No NEWNAME Option under MODIFY FILE is introduced in SQL 2000. However MODIFY FILE with less options is supported in SQL 7.0
.
July 9, 2003 at 2:15 pm
OOPS... Sorry Allen... I was typing when you replied.
.
July 9, 2003 at 2:22 pm
I was afraid of that. And sp_helpfile gives me the same logical names as selecting from sysfiles.
Ok, since I can't change this, is there a way to avoid it in the future? It seems that when I back up a production database and restore to a development one, that SQL Server 7 will not allow me to change the logical name. Is this true and I have to live with this behavior or am I missing something? Thanks for everyone's help.
July 9, 2003 at 2:32 pm
quote:
Is this true and I have to live with this behavior
Unless upgrade to SQL Server 2000, You have no options.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply