Cancel attached backup service
My software has to make database backups and one of the expected features is that this backup can be canceled.
As I can think of, I have three options:
- Use a component, such as TIBBackupService
- Programmatically call gbak using ShellExecute or so
- Programmatically call to the service using GDS32.dll API
I tried the first one and e开发者_运维问答ven if I cancel it the service keeps running (the backup file is built until the end and all resoureces keep unchanged).
The second option smells to me and I don´t think I´ll be able to abort the operation as well.
The third option will cost some hours and so I´d like to know:
- Is there a way to abort the backup operation using the first option?
- The third option is viable? If yes, the operation will be abortable?
- Is Firebird backup operation cancelable at all?
Thanks
PS: You didn't mention the Firebird version you are using.
1) gbak is "normal" application that connects to database, read all information, and write it to backup file. Restore process is the inverse.
2) When you use ServicesAPI to do backup (option 1 and 3, in your example), Firebird will start an "internal" version of gbak to do the job.
For any of the options, if you are using Firebird 2.1, you can run a "delete from mon$statements where mon$attachment_id = " from a different connection. This will stop the backup process. With FB 2.5, you can even drop the gbak connection, doing a "delete from mon$attachments where...".
You can find what is the gbak attachment id looking the mon$remote_process in mon$attachments table.
精彩评论