Monday, March 26, 2012

Rename or purge my SQL Server 2000 transaction log file

Gurus,
How do I Rename or purge my SQL Server 2000 transaction log file? I have
successfully renamed the database using the ALTER DATABASE. I have
successfully renamed the physical MDF file by detaching the database,
renaming the file, and bringing it back online. However the transaction log
file still has the same old name. No one will be using the database over
the weekend.
Spin> I have successfully renamed the physical MDF file by detaching the
> database, renaming the file, and bringing it back online. However the
> transaction log file still has the same old name.
You can use the same process to rename the transaction log file: detach the
database, rename file(s) as desired and reattach the database specifying
*all* files:
EXEC sp_attach_db 'NewDatabaseName',
'C:\DataFiles\NewDatabaseName.mdf',
'C:\LogFiles\NewDatabaseName_Log.ldf'
When you omit the log file on sp_attach_db, SQL Server reuses the original
log file if it exists.
Hope this helps.
Dan Guzman
SQL Server MVP
"Spin" <Spin@.spin.com> wrote in message
news:4ecfcgF1e15rgU1@.individual.net...
> Gurus,
> How do I Rename or purge my SQL Server 2000 transaction log file? I have
> successfully renamed the database using the ALTER DATABASE. I have
> successfully renamed the physical MDF file by detaching the database,
> renaming the file, and bringing it back online. However the transaction
> log file still has the same old name. No one will be using the database
> over the weekend.
> --
> Spin
>

No comments:

Post a Comment