May 2, 2002 at 10:44 am
currently my data file and log are in the same physical location. i would like to move the log to a different physical location. i tried using the move database wizard and the sp_attach_file_db command, but they do not seem to be able to move ONLY the log. any suggestions? thanks
Elizabeth
Elizabeth
May 2, 2002 at 10:47 am
Hey Elizabeth,
You could run sp_detatch_db and then sp_attatch_db and specify the mdf and ldf locations to seperate drives.
Clive
Clive Strong
May 2, 2002 at 10:49 am
Try sp_detach_db to detach both and then sp_attach_db where you can set the path of both files when reattaching to the server.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
May 2, 2002 at 11:07 am
ok...maybe i am just not seeing it...i can detach with out a prob. when i reattach how do i specify where the new location will be? In this syntax the path seems to be where the files are located. is that correct? how do i specify a new location for the file?
thanks
EXEC sp_detach_db 'pubs'
EXEC sp_attach_db @dbname = N'pubs',
@filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
@filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'
Elizabeth
Elizabeth
May 2, 2002 at 11:13 am
Move the file thru Windows Explorer then just alter the @filename path associated with it to match.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
May 3, 2002 at 3:34 am
Hi Elizabeth,
You just need to modify the @filnameX parameters. For Example...
EXEC sp_detach_db 'pubs'
GO
EXEC sp_attach_db @dbname = N'pubs',
@filename1 = N'e:\MSSQL7\Data\pubs.mdf',
@filename2 = N'l:\MSSQL\Logs\pubs_log.ldf'
GO
In this instance, after you detatch the pubs db, move the data file to the E drive and the log file to the L drive and then reattatch the file as above (using your own drive & path specifications!!).
Hope that helps!
Clive
Clive Strong
May 6, 2002 at 3:46 am
make sure you have move the files to the location where you want them to be before you attach.
The sp attach can be simple as this
sp_attach_db 'pubs','C:\newlocation\pubs.mdf','D:\newlocation\pubs.ldf'
Jesus My Saviour
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy