|
I
don't know if anyone will find this useful or not but this is the code that we
put in place
in our
database administrator application that registers a shutdown hook for the
database...
// add a shutdown
hook thread that attempts to stop the
server correctly even // if the computer is shut down
without stopping the server first Thread shutdown = new
Thread(new Runnable() { public
void run() { try
{ //
Connect to the database and issue
SHUTDOWN
Connection con = DriverManager.getConnection(url, user,
password);
Statement st =
con.createStatement();
st.executeUpdate("SHUTDOWN");
} catch (Exception ex)
{ //
System.out.println(ex);
//
ex.printStackTrace();
}
} }
);
Runtime.getRuntime().addShutdownHook(shutdown);
I'm
not positive that it actually always works correctly but I guess it can't
hurt.
...
Krick
This is discussed in hsqlRecovery.html in the /doc folder of
the distribution. Recovery should happen automatically.
There may be a bug though, so could you please state if
there had been a proper shutdown or a checkpoint since the tables were created
and filled.
In general, checkpointing reduces the amount of work to
be done in recovery and ensures a larger percentage of data is safely stored
in closed files that would not normally get corrupted due to abnormal
termination.
Also, for linux servers you can use the scripts provided for
startup and shutdown and add them to the rc.d list to ensure a normal
shutdown.
Fred
----- Original Message -----
Sent: 13 January 2004 14:23
Subject: [Hsqldb-user] HSQL's handling
of accidental machine shutdown
Hi, We recently had a machine running Linux 8.0 OS,
with HSQL 1.7.2 installed, rebooted while the DB was still running. We were
unable to access the existing cached tables via database manager on bringing
up the DB.
We would be delighted if our
following doubts could be answered,
a. Is it imperative to bring
down HSQL DB gracefully prior to machine reboots ? b. How does HSQL DB handle catastrophic
failures, so that the existing database is not adversely affected ?
Thanks for your help,
Ambarish
|
|
|