Wednesday, March 28, 2012

Log files - Location

Does the log file have to be on the same drive as the data file?
I know how to detach the database, move location of database files, and atta
ch database pointing to new location. But, I can't get it to work if the log
file is on a drive different than the data file.
Is there another way to do this?
Thanks!No, the log files do not have to be on the same drive as the data files. =
In fact, it is generally recommended that these be located on different =
drives.
Why can't you get it working? What errors do you have?
Another option to sp_detach_db and sp_attach_db is to perform a RESTORE =
DATABASE...WITH MOVE. WITH MOVE allows you to move the data and or log =
file(s) to different disk locations. Documentation and examples can be =
found within Books Online (within the SQL Server program group).
--=20
Keith
"Ysandre" <ysandre@.hotmail.com> wrote in message =
news:6CC23DA7-8294-43DB-AA26-C6A5C1D2FA4C@.microsoft.com...
> Does the log file have to be on the same drive as the data file?
>=20
> I know how to detach the database, move location of database files, =
and attach database pointing to new location. But, I can't get it to =
work if the log file is on a drive different than the data file.
>=20
> Is there another way to do this?
>=20
> Thanks!|||Hi,
Putting Log file in a different drive is always recommended for better
performance.
How to do:-
(Clear all the users connected to the database using ( ALTER database
<dbname> set single_user with rollback immediate )
sp_detach_db <dbname>
Move the LDF file to new drive using explorer
sp_attach_db
<dbname> ,'physical_mdf_file_with_path','Physical
_LDF_file_with_new_path'
Thanks
Hari
MCDBA
"Ysandre" <ysandre@.hotmail.com> wrote in message
news:6CC23DA7-8294-43DB-AA26-C6A5C1D2FA4C@.microsoft.com...
> Does the log file have to be on the same drive as the data file?
> I know how to detach the database, move location of database files, and
attach database pointing to new location. But, I can't get it to work if the
log file is on a drive different than the data file.
> Is there another way to do this?
> Thanks!

No comments:

Post a Comment