Monday, February 20, 2012

Moving Log Files

A database has been created on our SQL 2000 server but
the log file has been created on the wrong drive.
There is only one log file for this database. I have
tried using the following command which I have used to
successfully move tempdb but it says do not specify a
physical name.
ALTER DATABASE nimbusslm modify file
(name='nibusslm_log',filename='e:\logs\tempdb.mdf')
Any ideas?
Thanks
DanielleIf that doesn't work, you might try to move the file in
the restore like this:
restore database blah from disk = 'e:\dbbackups\blah.bak'
with replace,
move 'blah_data' to 'e:\sql_data\blah.mdf',
move 'blah_log' to 'e:\sql_log\blah.ldf'
HTH
Ray Higdon MCSE, MCDBA, CCNA
>--Original Message--
>A database has been created on our SQL 2000 server but
>the log file has been created on the wrong drive.
>There is only one log file for this database. I have
>tried using the following command which I have used to
>successfully move tempdb but it says do not specify a
>physical name.
>ALTER DATABASE nimbusslm modify file
>(name='nibusslm_log',filename='e:\logs\tempdb.mdf')
>Any ideas?
>Thanks
>Danielle
>.
>|||Moving transaction log
You can do it with the help of sp_detach_db and
sp_attach_db. first use the sp_detach_db command to detach
the database.
Eg
sp_detach_db 'pubs'
copy pubs_log.ldf files to the destination drive.
after copying the files, you can use the sp_attach_db
stored procedure to reattach the data and log files with
the new location
See more help on this in BOL.
- Vishal|||Many thanks I give it a whirl
Danielle
>--Original Message--
>Moving transaction log
>You can do it with the help of sp_detach_db and
>sp_attach_db. first use the sp_detach_db command to
detach
>the database.
>Eg
>sp_detach_db 'pubs'
>copy pubs_log.ldf files to the destination drive.
>after copying the files, you can use the sp_attach_db
>stored procedure to reattach the data and log files with
>the new location
>See more help on this in BOL.
>- Vishal
>.
>

No comments:

Post a Comment