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 Administration
 Moving a Log File

Author  Topic 

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-10-21 : 10:09:30
I guys,

Just a quick one - I have a development server which we are looking at tidying up at the moment.

I was just wondering if i move a folder called logs (containing the db log files surprise surprise)

and then one called data (again containing the data files )

Into one folder, and then use the properties of each db to redirect the file path - would this work or cause me major problems.

Just thinking it would me quicker that detaching and re-attaching the db as i'm not actually moving the database just the location of the files.

--------------------------
SQL Server MCP & MCTS

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-10-21 : 10:15:01
You need to detach, move files, attach for user databases:
http://support.microsoft.com/kb/224071

And it's different for system databases.

Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-10-21 : 11:23:15
help i keep getting the error

Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "C:\Ted\test2.mdf". Operating system error 2: "2(The system cannot find the file specified.)".

even thought the detached database filename is exactly the same
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-21 : 12:41:26
Neil, did you use detach/attach or the approach that you mention in the first post? Your approach will not work. You must use detach/attach.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-10-22 : 05:20:41
Sorry, I did use the detach and attach method but because it was late in the day (brain drain) - I total forgot to move the files to there new location before trying to re-attach.

I don't know what I thought was going to happen without doing that first.

Thanks anyway Tara
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-22 : 13:22:02
You're welcome.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -