on 2012 Feb 14 12:15 PM
Hello,
we have webinterface to manage our different client installations and also copy over whole databases via the dbbackup command.
The serverside is all written in java (And vaadin) Sometimes we have very lengthy backup processes (500MB databases over 20MBit/sec Lines) and wish to show a progres bar.
Is there a way to use dbtools from java to get some sort of progress informations ? (As on the commandline of dbbackup for example)
Or is there another way to make backups across the wire and show some progress?
André
Request clarification before answering.
As DBTools is a C-based API, I guess a usage from Java will require some kind of JNI interface or the like - can't tell more, haven't done that...
Another approach with a looser coupling might be to make use of the MESSAGE statement to pass messages to other connections. ODBC apps can process such messages by using a particular callback - that works well IMHO. SA 11 JDBC clients seems to be able to read them as well, but I don't have a sample at hands.
The basic idea would be to
extern short _callback MessageRtn(char * messagestr)
{
if (messagestr != NULL)
{
// build message string from messagestr, such as
// sqlstr = "MESSAGE messagestr + " TO CLIENT FOR CONNECTION " + MyConnId + " IMMEDIATE"
// use ODBC or whatever C DB APO to execute that SQL statement
}
return (0);
}
So the DBTools DLL could "send" the progress messages of the backup to the JDBC connection.
Apparently, one could also make the DBTools API DLL to write messages to a file or send them via some IPC mechanism, and make the JDBC app read them...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, that would be a way to go, but it looks like a long way and a stony one (ASA wersion dependent etc.)
I think we will take a simpler track: - Ask the asa server for the size of the .db and .log files - Start a server side backup - Via java remoting (which we already have) poll on the backup file sizes - Then transfer the backupfiles via sftp or java remoting back to the management server
Since we already have the java remoting file transfer in place, it will not require that much changes.
Thanks
André
Be aware that the size of the backed up transaction log / database may not exactly match the size of the database prior to the backup. (e.g. the database size can change depending on the 'CHECKPOINT LOG COPY' options, and the transaction log grows while the backup is taking place on the database file).
I did now still do a remote dbbackup (From remote to local) First I ask the dbserver for the size of the DB file and then watch it grow as it is copied to the local system. (Apparently dbbackup does not preallocate the space)
With these two I can detect the current DB file size:
SELECT PropName, PropDescription, Value FROM sa_db_properties() where propname='FileSize'
and
SELECT PropName, PropDescription, Value FROM sa_db_properties() where propname='PageSize'
Is there a similar possibility to ask teh DB server for the size of the transaction log file ?
select DB_EXTENDED_PROPERTY('FileSize', 'translog')
The PROGRESS connection property can give you this information. This property was introduced in version 12.0.0.
FWIW: In order to get such messages, the according progress_messages database option must have been set to Raw or Formatted.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
15 | |
12 | |
7 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.