Subject Re: [Firebird-Java] Database backup mode
Author Mark Rotteveel
On 2016-04-28 9:46, 'Thomas Steinmaurer' ts@...
[Firebird-Java] wrote:
>> On 2016-04-28 8:10, 'Steffen Heil (Mailinglisten)'
>> lists@... [Firebird-Java] wrote:
>>> Hi
>>>
>>>
>>> I can enable and disable database backup mode using:
>>> ALTER DATABASE BEGIN BACKUP
>>> and
>>> ALTER DATABASE END BACKUP
>>>
>>> This works though a usual Jaybird SQL connection.
>>> But is there a way to query the database if it is in backup mode or
>>> not?
>>>
>>> My problem is that I need to be sure that the database is in backup
>>> mode to copy the database file but executing the first statement
>>> above
>>> will result in an sql exception if the database already is in
>>> backup
>>> mode. So I cannot tell if the exception is about a generic sql
>>> error
>>> (maybe the connection failed) or if the exception is about the
>>> database already being in backup mode.
>>> So I would like to check the state just after executing that
>>> statement (and ignoring sql exception).
>>> But how can I check that?
>>
>> I don't know for sure, I'd need to check that; I assume there is
>> some
>> service call that provides this info.
>
> I'm not sure how the enums of MON$DATABASE.MON$BACKUP_STATE map to
> Steffen's requirements?
>
> http://www.firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref-appx05-mondb.html

Ah, right; forgot about that. Stalled (1) means that the database is
inbackup mode, merge (2) means that backup mode is being ended. That is:
END BACKUP has been called, but Firebird is still working on integrating
the difference file. Normal (0) means that the database is not in backup
mode.

Mark