SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Detach a remote database from a server


Detach a remote database from a server

Author
Message
lijusmail
lijusmail
SSC-Enthusiastic
SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)

Group: General Forum Members
Points: 106 Visits: 193
I am in an urgent need of some help

I have a database named timetable on server1(domain 1) and have the same database timetable on server 2(domain2).
Every Day i want to copy from server1 to server 2.

These are the steps that i would like to follow unless someone could help me in an easier way.I want to write scripts on server 1 for everything.

1. Detach database on server 1 and server 2
2. Do a copy from server 1 to 2.
3. Attach the database on Server 1 and server 2.

I have done the following things
1. Detach database on server 1.
2. Did a copy of mdf file and ldf file to server 2(using xp_cmdshell and xcopy - but i had to use "net use command" to share)
3. attach the database & ldf on server 1.

Problem i am having is to detach database on server 2 because when i copy i get sharing violation. SO how can i detach the database on Server 2 from Server 1(Remotely).

Thanks
Liju
Ramesh Saive
Ramesh Saive
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3454 Visits: 2643
There are many ways to transfer a database from one server to another...

1. Backup/Restore Method (recommended)
2. Transfer Database Task in SSIS
3. Copy Database Wizard
4. Using SMO Objects

I personally don't like using detach...attach method, 'cause you have to take the database offline and you have to do a few more steps than the backup/restore method.


Problem i am having is to detach database on server 2 because when i copy i get sharing violation. SO how can i detach the database on Server 2 from Server 1(Remotely).

Using SSMS, you can manage all the SQL Servers from your desktop. To detach, you have to do "Right Click on Database to Detach > Tasks > Detach".

--Ramesh


Cath Trimble
Cath Trimble
SSC Eights!
SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)

Group: General Forum Members
Points: 937 Visits: 1196
Hi,

Have you considered log shipping from Server A to Server B? You could schedule that to run in the early hours of the morning when things are quiet - much easier than having to detach/attach every day.

Cath

Regards,
Cath

"Hang on lads, I've got a great idea. "
Michael Caine (Charlie Croker) The Italian Job
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