I'm just trying to figure out whether I could use a system event of type "BackupEnd" to do some clean-up of older backups. However, that would need to distinguish between full vs. log-only backups. The event seems to be called for both kinds of backus.

I have not found an EVENT_PARAMETER or the like that would show a difference. Have I missed such a function or property?

(The idea to use an event instead of doing the clean-up as part of the backup itself is that backups can be taken in different forms (DBBACKUP, BACKUP statement, ...) and it seems helpful if the clean-up is centralized.)

asked 11 Jan '16, 03:20

Volker%20Barth's gravatar image

Volker Barth
30.8k308456665
accept rate: 32%

edited 11 Jan '16, 03:21


You could possibly use the LAST_BACKUP records in the SYS.SYSHISTORY system view to help differentiate between full and incremental.

Another possibility would be to use Maintenance Plans and add your custom logic to the Event Handlers EVENT_PARAMETER generated by those. Or something equivalant in your own design using with your own Events.

As far as clean up actions you might want to be a little more specific about what you are looking for there.

Directory Access may also be of some benefit to determining the state of the target or offline directories, and for some clean up actions.

permanent link

answered 11 Jan '16, 09:08

Nick%20Elson%20SAP%20SQL%20Anywhere's gravatar image

Nick Elson S...
7.3k35107
accept rate: 31%

converted 12 Jan '16, 02:44

Volker%20Barth's gravatar image

Volker Barth
30.8k308456665

Ah, the pointer to SYSHISTORY might help here, although I'm not sure whether the "details" values are meant for users - the values of SYSHISTORY.details are not documented en detail in the docs, instead it's stated "This information is for use by technical support.". Here's what they tell for a log-only backup in my case:

BU=Type:LGFO 'Imag';

"LGFO" meaning "log-file only", I guess...

As to the clean-up: When doing a full backup, that may include deleting the "n-th last full backup" and any older incremental log files. For incremental log file backups, no clean-up is planned.

and add your custom logic to the Event Handlers EVENT_PARAMETER generated by those.

We are partly using Maintenance Plans. I do not really understand your cited statement, however, incorporating such logic into a Maintenance Plan (or a user-defined backup event) would certainly be doable but would exclude full backups done via BACKUP STATEMENT or DBBACKUP from making use of that.


As said, I'm just trying to figure out whether I could centralize such logic (and was thinking that "BackupEnd" would be focussed on such use cases). If it is not, I still could put the logic within a STP and call it explicitly.

(11 Jan '16, 09:37) Volker Barth

Yes indeed ... It was a UN2PT (U'll Need 2 Play w\This) type of a suggestion but it seems you getting the hang of it.

As to your 'clean-up' approach, good plan.
No archive/off-site copies though? Usually the process that is archiving files is the one to implement that logic. {just an observation}

(11 Jan '16, 12:35) Nick Elson S...
Replies hidden

No archive/off-site copies though? Usually the process that is archiving files is the one to implement that logic.

Yes, the archive process is the one doing that currently. I was just thinking whether I could somewhat combine both. We'll see:)

(12 Jan '16, 02:43) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×72
×61
×35

question asked: 11 Jan '16, 03:20

question was seen: 347 times

last updated: 12 Jan '16, 02:43