Hello,
I'm using Derby 10.3.2.1, I should regularly create online backup with log
archiving, so I created the following method:
private void createBackup(String dbName, Connection
connection)throws Exception{
try {
SimpleDateFormat todaysDate = new
java.text.SimpleDateFormat("yyyy-MM-dd-hh-mm.ss");
String backupdirectory = "backup/" + dbName +
"/" + todaysDate.format((java.util.Calendar.getInstance()).getTime());
LOG.trace("Trying to backup the DB " + dbName
+ " at " + new Date());
CallableStatement cs =
connection.prepareCall("CALL
SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(? , 0)");
cs.setString(1, backupdirectory);
cs.execute();
cs.close();
LOG.trace("Done at " + new Date());
} catch (Exception e) {
LOG.error("Unable to backup the database "
+dbName , e );
}
}
Note:
I have 3 databases running on embedded mode.
This method is called everyday night, I have a huge historical data being
saved all the times.
But after couple of days I checked the log, the backup failed to create a
new backup & the database got corrupted!!!
Did I do anything wrong? Or miss something,
Kindly advice
Best regards
Bassel