On Mon, Aug 02, 2010 at 04:00:41AM -0700, vadali wrote:
> 
> Hello,
> 
> I have a few tables (with FK), that i need to save and restore. 
> My original plan was to save the entire directory of the database on one
> machine, then reload it on another machine.
> 
> The problem is that i might want to only save a portion of that db (say only
> lines in tables that are newer then a certain date - i do keep the date for
> each line).
> 

Hi Vadali,

What are your requirements for uptime on the primary db?
Do you have to use online backup, or can you block update transactions
for a while?

> whats my best method? 
> 
> I thought about manually coping all the interesting lines from one db to
> another one (lets name it backupdb), but that could be slow.. 
> another option i thought, would be to copy the entire db to backupdb, then
> removing all the lines i dont need, but when i tried that, the size of the
> backupdb directory was even larger then the original...

This is probably because Derby isn't releasing unused space to the OS
before it is told to do so. You should run the compress routines on the
tables from which you deleted a large number of rows.
The extra space may be log records, which will be deleted after a checkpoint / 
clean shutdown.

> 
> Do you have any better options?

Seems to me you have to decide if you want to filter the data up front
or after you have created the backup.
In the former case you could write your own "database copy" using SQL to
filter the data (or maybe write a VTI), in the latter case you would
have to account for the time spent deleting unwanted data and then
compressing the tables to save space.

It might also help people to come up with better answers if you tell us
roughly how large you expect your database to be.


Regards,
-- 
Kristian

> 
> best regards,
> vadali
> -- 
> View this message in context: 
> http://old.nabble.com/backing-up-the-DB-tp29324036p29324036.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
> 

Reply via email to