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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Detach/attach

Author  Topic 

pmccann1
Posting Yak Master

107 Posts

Posted - 2006-10-06 : 05:58:47
We have a databse that has grown too big for the drive its on. it is a system another company supports. i was told to detach it and reattch it to another drive which is grand no probs with that, however they said to me to reattach the the mdf but create a new ldf however i cant seem to do this, can it be done and how do you do it

Kristen
Test

22859 Posts

Posted - 2006-10-06 : 06:21:22
Make sure you have a backup first!

Detaching the database will "detach" both files - the MDF and LDF.

Copy the MDF to the new location, don't bother with the LDF.

I suggest you rename both the original MDF and LDF (so they don't accidentally get reattached!)

The ATTACH should then create you a new LDF file.

"they said to me to reattach the the mdf but create a new ldf"

This is only a marginally good idea! The system will have to create a new LDF file, it will probably create a small file and then increase it bit by bit until it reaches a size where it stays in equilibrium. So it will probably be fragmented.

Whereas if you copy over your existing file Windows will try to allocate it in one single block (AFAIK).

So unless for some reason your existing LDF file is unnecessarily BIG I would copy that over too.

Once you've successfully got it re-attached you can delete the original, now-renamed, files.

Kristen
Go to Top of Page

pmccann1
Posting Yak Master

107 Posts

Posted - 2006-10-06 : 06:47:08
i have tried this and it doesn create a new ldf
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-10-06 : 07:13:07
Sorry my mistake, you need to use the single file attach process:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=single%20file%20attach,sp_attach_single_file_db

But if the size of your LDF file is up to 120% of your MDF I would use it.

Kristen
Go to Top of Page
   

- Advertisement -