The C-API call NSFIsNewBackupNeeded(..) has only very limited use-cases in circular/linear and in archive translog mode.
It doesn't give you what you would expect from the name of the call, when you look into the details.
Also it doesn't work for in place compact -- even if the DBIID is changed in this case (only the LSN is checked).
There are internal header fields which are filled correctly with last backup start time. And if successful last backup end date! And they are reset as soon a new DBIID is created.
Having those fields available in the C-API SDK would be important for multiple use-cases:
- Figure out if database was backed-up at all
--> New database or database with new DBIID (after compact, fixup etc).
- Calculate time the backup took
- Check if the backup did finish (if end is after start)
- Figure out the last backup time
It's not clear how backup vendors implement incremental backups in archive mode. Maybe they are checking the DBIID and comparing them with their backups or checking the time in the DBIID in some way.
But clearly this isn't the right way. It would make sense to have those two fields available to check if a backup is needed in archive translog mode. And also compare the last backup time against the data and design last change time!
I got the confirmation from the database team that the information is not available and NSFIsNewBackupNeeded(..) doesn't do what I would expect from the name of the call.
There is no way in the C-API SDK to access them and there is no internal C-API call. You can only dump the fields from the database header.
The call could look like this. And it would just need to get the two TIMEDATES from the database header.
STATUS LNPUBLIC NSFBackupInfo(
const char far *dbName,
TIMEDATE far *LastBackupStart,
TIMEDATE far *LastBackupEnd);
[ Daniel Nashed / http://blog.nashcom.de ]