Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Deattach or take offline the DB to copy


Deattach or take offline the DB to copy

Author
Message
Anamika
Anamika
Old Hand
Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)

Group: General Forum Members
Points: 348 Visits: 1026
Hi,

Do I have to Deattach or take offline the DB to copy the .mdf and .ldf files to other machine.

I can't do a back up and restore as the server doesn't have enough space to do it.

--
Regards,
Viji
Suresh B.
Suresh B.
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1128 Visits: 5326
>>Do I have to Deattach or take offline the DB to copy the .mdf and .ldf files to other machine.
Yes. Without detach/offline files cannot be copied.

>> I can't do a back up and restore as the server doesn't have enough space to do it.
You can take backup to a network share. Or use a third party backup tool which does file compression.
luckysql.kinda
luckysql.kinda
Old Hand
Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)

Group: General Forum Members
Points: 314 Visits: 659
You want to copy .mdf and .ldf then make it offline
luckysql.kinda
luckysql.kinda
Old Hand
Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)

Group: General Forum Members
Points: 314 Visits: 659
I am not sure but I read somewhere that we can make some change in the database property and then .mdf and .ldf can be copied without taking DB offline. Anyone know about this? Cool
Anamika
Anamika
Old Hand
Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)

Group: General Forum Members
Points: 348 Visits: 1026
Hi All,
Thanks for your suggestions,
I've done with it. Steps I've followed are

1. KILL the processes which is active / suspended / sleeping etc on the database :-D
2. Take the Database OFFLINE
3. Now copy the .mdf and .ldf to other machine.

and my whole requiement was deleting the current .mdf and .ldf files
restore new set of .mdf and .ldf files
connect those to the same database. w00t

after the above 3 steps, i

4. deleted .mdf and .ldf files
5. deleted database
5. copied new .mdf and .ldf files into the location.
6. created new database with the same name.

and it works welllllllll

Thanks,
Regards,
Viji
Suresh B.
Suresh B.
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1128 Visits: 5326
Glad to know that it works well.
But, I have concerns Sad
Is it a production server? One should be carefull while issuing KILL command on a production server.
Do you have proper backups, in case required?
VaibhavChoubey@SQL
VaibhavChoubey@SQL
SSC Veteran
SSC Veteran (297 reputation)SSC Veteran (297 reputation)SSC Veteran (297 reputation)SSC Veteran (297 reputation)SSC Veteran (297 reputation)SSC Veteran (297 reputation)SSC Veteran (297 reputation)SSC Veteran (297 reputation)

Group: General Forum Members
Points: 297 Visits: 109
Not a good way buddy, you should have tooka backup to a network location and then drop database and restore the new one , i dont see any profit in your approch.
Anamika
Anamika
Old Hand
Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)

Group: General Forum Members
Points: 348 Visits: 1026
hi,


first itz not a production database
2nd i hv proper back up
3rd look into my 3rd point in the previous post.
"copy the .ldf and .mdf to other machine"


so @SQL i've done with your idea.

i can't get into problems just like that..
i know you people are there to educate me.

thanks,
regards
viji
ps.
ps.
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2259 Visits: 3668
viji (7/23/2009)

1. KILL the processes which is active / suspended / sleeping etc on the database :-D

Instead of killing all active sessions, you can fire this simple statement to terminate all sessions and bring the db offline
 alter database mydb set offline with rollback immediate





Pradeep Singh
Anamika
Anamika
Old Hand
Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)

Group: General Forum Members
Points: 348 Visits: 1026
thanks,

is there any other command just to close all the connections??

regards
viji
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search