copy database locally

Post Reply
tboyer
Posts: 68
Joined: Mon Aug 28, 2006 4:43 pm

copy database locally

Post by tboyer »

Hi all,

I'd like to make a mirror of our production database, but on the same server, in the same partition. Can I use cpdb to do this? I get "address already in use" when I try it cpdb -d /existing /new.

Also, reading comments from Kai and John, does this copy have to be done at a time when there could be no table updating going on? Or does cpdb handle that?

Thanks guys.

Tom
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

copy database locally

Post by John »

cpdb is designed to communicate over the network, so you will need to start one instance of cpdb as a server, and the other as a client, and specify -h localhost as well as both -r and -d for the two databases. E.g.

cpdb # Start Server
cpdb -d /existing -h localhost -r /new

Cpdb will take care of the locking to avoid any corruption caused by reading the file when it is being written to, although the update may or may not be copied depending on when it happens in relation to the copy. You will need to recreate the indexes after the tables are copied.

If you used file level copy commands then you would need to make sure no updates were happening, e.g. with the lockandrun program.
John Turnbull
Thunderstone Software
tboyer
Posts: 68
Joined: Mon Aug 28, 2006 4:43 pm

copy database locally

Post by tboyer »

Thanks John. That's what I was hoping, that cpdb would take care of the locking issue.
Post Reply