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 2005 Forums
 SQL Server Administration (2005)
 Detach and Attach

Author  Topic 

prodigy2006
Yak Posting Veteran

66 Posts

Posted - 2009-11-09 : 18:20:05
I'm going to move the log file of a DB to a different drive. For this I'm going to detach and attach the files.
My question is that the DB has many secondary files, while attaching do I've to mention even the secondary files or will it be fine if I attach with only mdf and ldf files?
Ex:Exec sp_attach_db @dbaname ='Advenworks'
@filename1 = N'I:\SQLData\Advenworks.mdf',
@filename2 = N'I:\SQLLog\Advenworks.ldf'

May be a retarded question but I'd like to know how long will this process take for a 30 Gig DB?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-09 : 18:37:55
All database files need to be mentioned in the attach. For a 30GB database, it'll be very quick. We recently did a 500GB database in just a few seconds.

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

lenovo27
Starting Member

15 Posts

Posted - 2009-11-09 : 18:47:26
quote:
Originally posted by prodigy2006

I'm going to move the log file of a DB to a different drive. For this I'm going to detach and attach the files.
My question is that the DB has many secondary files, while attaching do I've to mention even the secondary files or will it be fine if I attach with only mdf and ldf files?
Ex:Exec sp_attach_db @dbaname ='Advenworks'
@filename1 = N'I:\SQLData\Advenworks.mdf',
@filename2 = N'I:\SQLLog\Advenworks.ldf'

May be a retarded question but I'd like to know how long will this process take for a 30 Gig DB?




I have copied the ldf and mdf files and attached them to another server fine in the past.
Go to Top of Page
   

- Advertisement -