Background documentationEvent-Controlled Copying of Automatically Created Log Backups Locate this document in the navigation structure

 

If automatic log backup is switched on, the database system automatically backs up the redo log entries of the database instance from the log area to files. For security reasons, we recommend that you immediately copy these files to a second location.

Scenario

Event dispatcher is switched on.

Automatic log backup is switched on.

According to the default value of the system, DEMODB always saves the log area as soon as a log segment is full. You have created the backup template DemoFileLog under the relative path Backups 2005\Data with file name logBackup for automatic log backup. However, to link the event to the executing program, you must specify the absolute path for the backup template in the command.

For security reasons, you want the system to immediately copy every newly created backup file to a second hard drive (D:) on the current computer. To do so, the system must execute the copy command in the command prompt and copy the respective file to D:\Stage.

Create a link between the cmd.exe program and the event that is output by the database kernel when a log file is saved.

Use the documentation or the output of the DBM command event_list_categories to determine that event category ThrowAutoLogBackupEvent is the correct event category and that the events of this category have the name AutoLogBackup, as well as to determine the values that the database kernel returns for an event of this category. You use these values to formulate the execution command when you create the link.

Prerequisites

  • Event dispatcher is switched on (see event_dispatcher).

  • Automatic log backup is switched on (see autolog_on).

  • The file dbm_whitelist.cfg exists in the run directory of the database and is owned by an administrator of the current computer.

For more prerequisites, see Database Manager CLI, event_dispatcher

Procedure

In the following example, explanations of the output are in bold and marked as comments with the number sign (#).

  1. Call the Database Manager CLI in session mode, log on as DBM operator OLEG with the password MONDAY, and connect to the database instance DEMODB:

    >dbmcli -u OLEG,MONDAY -d DEMODB

    dbmcli on DEMODB>

  2. Display the available event categories:

    dbmcli on DEMODB>event_list_categories

    OK

    ThrowDBFillingAboveLimitEvent

    ThrowDBFillingBelowLimitEvent

    ThrowLogAboveLimitEvent

    ThrowDataCacheAboveLimitEvent

    ThrowDataCacheBelowLimitEvent

    ThrowAutoLogBackupEvent

    ...

    ...

  3. Display the values returned by the database for event category ThrowAutoLogBackupEvent:

    dbmcli on DEMODB>event_list_categories ThrowAutoLogBackupEvent

    OK

    ...

    ThrowAutoLogBackupEvent

    AutoLogBackup events give information about ....

    ...

    An actual event of category AutoLogBackup contains usable information within the following data fields:

    PRIORITY:

    This data field contains the priority of the event. The following value can occur: LOW

    VALUE1:

    This data field contains the reason that triggered the event. The following values can occur:

    0, The automatic log backup task has been started.

    1, The automatic log backup task has been stopped.

    2, Automatic log backup has been enabled.

    3, Automatic log backup has been disabled.

    4, A log backup was successfully finished.

    # Value 4 for field VALUE1 is the value for which the link of event ThrowAutoLogBackupEvent and program cmd.exe should take effect.

    TEXT:

    If data field VALUE1 has the value 1 or 4, data field TEXT contains the file name of the log backup medium that is used by the automatic log backup. Otherwise data field TEXT contains no information.

    # If VALUE1 = 4, field TEXT contains the file name with the attached sequence number for the created backup file to be copied using the link.

  4. Enter the program to be linked with the event in file dbm_whitelist.cfg:

  5. Create the link according to the above scenario:

event_dispatcher ADD Name == AutoLogBackup Value1 == 4 Command == "C:\WINDOWS\System32\cmd.exe /C copy \"C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\$EVTEXT$\" D:\Stage"

OK

Result

The event definition has been saved. Every time the function for automatic log backup creates a new file in the backup directory defined in the backup template, the database generates an event called AutoLogBackup. As a result of the generated link between such an event and program cmd.exe,each of the generated files is immediately copied with operating system commands and saved in directory D:\Stage.