New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update table just before/after backup [CORE3230] #3603
Comments
Commented by: Sean Leyne (seanleyne) Please explain what you need the "trigger" for. |
Commented by: Paweł Przybyła (pprzybyla) I need create mechanizm which execute procedure to set some values on one of tables (value - after_backup = 'Y'). |
Commented by: Paweł Przybyła (pprzybyla) I just need to know that the database was restore from backup when I connect to it first time after restore. If I update field in one of table (after_backup = Y) that be enough. But I don't know how to set it when I backuping Database or when I restoring ... |
Commented by: Paweł Przybyła (pprzybyla) BTW MON$ATTACHMENTS shows not enought information because like I wrote the backup is creating for many ways for examlple : GBak, Ibexpert, my application - so I don't if the backup was make. |
Commented by: @asfernandes I think you should better make your own backup program (which may use the FB tools / API) to put your needed logic. There are different kind of backups... GBAK from client or server, nbackup and even directly file copy with the database closed. I don't think a trigger for backup could be generally useful. |
Commented by: @dyemanov In your case, I'd check for CURRENT_CONNECTION inside the ON CONNECT trigger and if it's < 5 (for example) then it means the database has just been restored. |
Commented by: Paweł Przybyła (pprzybyla) Thanks for help. Thats all I need. CREATE OR ALTER trigger after_backup if (CURRENT_CONNECTION = 3) then END Do you know why my first connection after restore has ID = 3 ? Where's first and second connection ? First I gues is for restore and second... ??? |
Commented by: Sean Leyne (seanleyne) You realize that it is very possible for a any connection to get ID = 3, right? As such you should check that AFTER_BACKUP <> 'Y' prior to executing "update syncT". |
Commented by: Paweł Przybyła (pprzybyla) I restore backup for 3 ways (no more possible in my case): IBExpert, Consol+gback, myApplication. After that I connect to database and check current_connection that always was 3. I don't care what connection gets 3. For me was enought that I know that connection (3) was first connection to database after restore. My column after_backup has wrong name it shoud be 'after_restor' :) |
Commented by: @dyemanov The backup/restore code does two connections to the database during the restore process, hence IDs 1 and 2. |
Commented by: Paweł Przybyła (pprzybyla) Thats all I need . Thank You. |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Paweł Przybyła (pprzybyla)
Hi.
Is it possible to execute procedure just before (or just after) backup database ?
I need somethink like trigger (before or after) on backup.
The text was updated successfully, but these errors were encountered: