Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 move logs on production db

Author  Topic 

lindlerc
Starting Member

4 Posts

Posted - 2007-11-26 : 21:39:11
I'm totally new to SQL. I have a SQL 2005 server with 3 sets of mirrors - 1 for the OS, 1 for the logs and 1 for the DB. SQL had already been installed and DB's put into production before I knew the logs and DB's were all on 1 mirrored set. I need to move the logs to their own drive. How do I accomplish this?

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-27 : 01:28:13
Detach db, copy log file to another disk array then reattach the db.
Go to Top of Page

lindlerc
Starting Member

4 Posts

Posted - 2007-11-27 : 08:11:36
That's it? That sounds really simple! One question though - When I reattach the DB how will it know were the logs are since they will not be in the original location?
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2007-11-27 : 08:21:48
Use WITH MOVE
Go to Top of Page

lindlerc
Starting Member

4 Posts

Posted - 2007-11-27 : 09:03:01
Use WITH MOVE?? Sorry, I know nothing about SQL. Can you be a little more specific or is there a MS article on this somewhere?
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2007-11-27 : 10:08:35
Sorry, look up CREATE DATABASE FOR ATTACH in Books Online.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-28 : 01:50:45
Specify file path in sp_attach_db.
Go to Top of Page

lindlerc
Starting Member

4 Posts

Posted - 2007-11-28 : 09:21:25
This seemed to work as a test:
I created a test DB with the log and db in the default location (c:\..). I then detached the test db, manually moved the ldf file to another drive and then attached the db. Since it couldn’t find the ldf it allowed me to browse for it so I selected it from the new location and it attached successfully.
Does this sound like the proper way to relocate the ldf file for the db?
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-29 : 01:34:59
You can do it that way in gui.
Go to Top of Page
   

- Advertisement -