Hi, What about using the BACKUP function? It should do his automatically and cleanly -- see http://www.h2database.com/html/grammar.html#backup
Your suggested idea actually works too though, from personal experience. I tend to zip up my larger DBs with 7Zip for compact offline storage, and I've accidentally zipped a running DB a couple times. Nothing says "good times" quite like a 700 MB DB compressing to 100 MB or less! Remember, like any good DBMS, H2 is durable against power outage, so being suddenly cut off (by writing to ZIP intermediately) cannot leave the DB in an inconsistent or destructive state. You will lose the current transaction and have to rebuild the index though, and may lose *some* of the data, including modifications within the WRITE_DELAY time interval. Those are why I don't suggest it. Cheers, Bob McGee On Jul 31, 1:35 am, "M. A. Sridhar" <[email protected]> wrote: > Hello, > > I use h2 in embedded mode. I'm wondering if I can simply zip up the > files in its directory as a backup, while the application is running. > The intent is that I can simply unzip the files to restore from the > backup. The problem I'm worried about is if the embedded database's > state is cached by the currently running application, in which case > the zip file's contents can be inconsistent and therefore unusable. > > Of course I can perform the zip operation after shutting down the > application, but I want to avoid that if possible, because it is a > running web app. > > Thanks in advance for your advice. > > Regards, > Sridhar --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/h2-database?hl=en -~----------~----~----~----~------~----~------~--~---
