Attach not detached dbs | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Attach not detached dbs

thanks
No if the files are not detached its not possible to attach, BOL clearly states.
Only way is to restore from good known backup. Still you may try attaching. If the database files were not properly detached, ensure that they are located in the original drive letter and data path. If the *.MDF and *.LDF files are in synch, the attachment should work fine. _________
Satya SKJ
Moderator
SQL-Server-Performance.Com

I feel the hot backup and transaction log can be attaches. As satya said, its worth a try. Gaurav
Moderator
Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard

In this case I would like to enlighten a process which is undocumented and not supported by MS, so do it at your own risk :<br /><i><font face="Courier New"><br />- Create another database with same name<br />- Stop SQL Services<br />- Delete the newly created .MDF/.LDF files<br />- Copy old .MDF & .LDF files<br />- Restart SQL services, now you can see the current database in SUSPECT status<br />- sp_configure ‘allow’, 1 <br /> go <br /> reconfigure with override <br />- Keep the DB in EMERGENCY BYPASS (3276<img src=’/community/emoticons/emotion-11.gif’ alt=’8)’ /> by performing <br /> update sysdatabases <br /> set status = 32768 <br /> where dbid=(dbid for created database)<br /> (you can get details from select * from sysdatabases for dbid)<br />- sp_configure ‘allow’, 0 <br /> go <br /> reconfigure with override <br />- Restart SQL services</font id="Courier New"></i><br />HTH<br /><br /><br />_________<br />Satya SKJ<br />Moderator<br />SQL-Server-Performance.Com<br /><br />(Thanks Gaurav)<br />
Satya, shouldn’t there be a step in here to copy the old database files to the new datafiles location? Gaurav
Moderator
Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard

looks like its too long
I have a big number of databases and need to move all of then to different box
Does any one have a scrip for restoring a dbs to different location?
Do i have to create a db first and then restore?
Copy Database Wizard helps you to move/copy databases from one to another server. _________
Satya SKJ
Moderator
SQL-Server-Performance.Com

Also this DBjournal linkhttp://www.databasejournal.com/features/mssql/article.php/2228611 will help to deal with migrating logins. And all the following KBAs to dealwith moving databases :
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q314546
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q240872
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q246133 _________
Satya SKJ
Moderator
SQL-Server-Performance.Com

]]>