cancel
Showing results for 
Search instead for 
Did you mean: 

Logbackups with events

Former Member
0 Kudos

Hi is it possible to create a event, that when the log file to 80 % full the maxdb make a logbackup

Greets

Martin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Lars,

I have create the configfile and start the event dispatcher

eventlog.cfg

000000000.((Name == "LOGABOVELIMIT") && (Priority == 3) && (Value1 == 94))=dbmcli -U c autolog_on DA2_Autolog

FILEVERSION=7.6.00.35

dbmevtdisp start /home/da2adm/eventlog.cfg -l /home/da2adm/eventlog.log -U c -d DA2 &

eventlog

008-02-27 04:35:04 0x00002666 INF 4 DBMEd using configuration file /home/da2adm/eventlog.cfg

2008-02-27 04:35:04 0x00002666 INF 6 DBMEd event with name DISPINFO:DISPSTART not dispatched (count 0)

2008-02-27 04:39:45 0x00002666 INF 6 DBMEd event with name LOGABOVELIMIT not dispatched (count 86)

2008-02-27 04:40:15 0x00002666 INF 6 DBMEd event with name LOGABOVELIMIT not dispatched (count 87)

2008-02-27 04:40:46 0x00002666 INF 6 DBMEd event with name LOGABOVELIMIT not dispatched (count 88)

2008-02-27 04:41:21 0x00002666 INF 6 DBMEd event with name LOGABOVELIMIT not dispatched (count 89)

2008-02-27 04:41:41 0x00002666 INF 6 DBMEd event with name LOGABOVELIMIT not dispatched (count 90)

2008-02-27 04:41:51 0x00002666 INF 6 DBMEd event with name LOGABOVELIMIT not dispatched (count 91)

2008-02-27 04:41:56 0x00002666 INF 6 DBMEd event with name LOGABOVELIMIT not dispatched (count 92)

2008-02-27 04:42:02 0x00002666 INF 6 DBMEd event with name LOGABOVELIMIT not dispatched (count 93)

2008-02-27 04:42:17 0x00002666 INF 6 DBMEd event with name LOGABOVELIMIT not dispatched (count 94)

I must start a manual logbackup

What is my failure?

Greets

Martin

Edited by: Martin vom Bruch on Feb 27, 2008 10:46 AM

lbreddemann
Active Contributor
0 Kudos

Hi Martin,

wow - with that description ... no problem, I know the solution...

Honestly: what do you expect from such a description?

What does not work? The usage of the event? The logon via XUSER?

Has there been any error message?

Which one?

no information - no help - sorry.

Lars

Former Member
0 Kudos

Hi Lars,

sorry my issue. The usage of the event doesn't work.

KG

Martin

lbreddemann
Active Contributor
0 Kudos

Hi Martin,

not sure why it did not work.

Perhabs the database never actually hit the event of passing 94% log area filled but "jumped" directly from 90% - 96% - 99% - 100% LOGFULL...

What worked on my testmachine was this


dbmevtdisp add c:\testconfig.cfg Name == LOGFULL Command == "dbmcli -U c autolog_on"

As the event LOGFULL will definitively be hit as soon as the log was full, the event dispatcher had a event to work with.

Hmm... perhabs you can make the LOGABOVELIMIT work, if you use something like this:


dbmevtdisp add c:\testconfig.cfg Name == LOGABOVELIMIT Value1 >= 50 Command == "dbmcli -U c autolog_on"

I had some trouble to actually run this command in the shell. So I first created the condition as "Value1 == 50" and changed it afterwards in the config-file to >=.

Worked quite nice on my machine.

KR Lars

Former Member
0 Kudos

Moin Moin,

I am so sad It doesn't work. In the eventlog following appears

0x00004eb8 INF 6 DBMEd event with name DISPWARN:UNKNOWN not dispatched (count 1)

2008-02-29 08:23:34 0x00004eb8 ERR -24755 DBMCli ERR_SESSIONLIMIT: No session of type 'Event' available

0x00004eb8 ERR -24994 DBMCli ERR_RTE: Runtime environment error

0x00004eb8 ERR 2 DBMCli task limit

2008-02-29 08:23:53 0x00004eb8 INF 6 DBMEd event with name DISPWARN:UNKNOWN not dispatched (count 2)

I am not sure what this means

Greets

Martin

lbreddemann
Active Contributor
0 Kudos

Hi Martin,

this means there had not been any taks available for event-handling.

Please check to which value the db parameter _MAXEVENTTASKS currently is set to.

On my testsystem it is set to 2.

How many event-dispatcher have you started?

KR Lars

BTW: you may also give points for questions that are already answered...

Former Member
0 Kudos

Hi lars,

I give you some Points for your very helpful service. It is set on 2 but i have change it to 10 but without restart the database. Only one Eventdispatcher run

KG

Martin

lbreddemann
Active Contributor
0 Kudos

HI Martin,

thanks

Hmm... it does still not work?

Please repost your current dispatcher configfile and (if there's anything interesting in there) the knldiag file.

KR Lars

Former Member
0 Kudos

Hi Lars

0000000000.((Name == LOGABOVELIMIT) && (Priority == 3) && (Value1 >= 66))=dbmcli -U c autolog_on DA2_Autolog

In the kerneldiag is nothing out of the ordinary

Greets

Martin

lbreddemann
Active Contributor
0 Kudos

HI Martin,

the problem seems to be that the parameterfile is not yet correct.

My one looks like this:


0000000000.((Name == "LOGABOVELIMIT") && (Value1 >= 66))=dbmcli -U c autolog_on db760log
FILEVERSION=7.6.04.07

The major difference here is that the eventname needs to be in quotation marks " " and that I don't use the priority attribute.

In fact currently I've no idea what the priority attribute changes in the the way the events are handled. Therefore I just omitted it here.

KR Lars

Former Member
0 Kudos

Hi Lars,

now it works, but this is not the result what I want. The next Logbackup doesn't work because the Automatic Logbackup is on. Automatic Logbackup is a good thing but in most of the cases the Logarea is only 20% full.That means we have upto 6 weeks no Logbackup.

KG

Martin

lbreddemann
Active Contributor
0 Kudos

Hi Martin,

and exactly this was the reason why I told you to use the DB13 scheduler - switch off Autolog to perform your daily log backup and switch it on again to be on the safe side if unusual load comes in.

You may also make use of the autolog backup based on time. With the current MaxDB releases you can start autolog with a interval parameter:


autolog_on [<medium_name>] [INTERVAL <value>]

The interval is measured in seconds.

I would still prefer the "DB13-method" (and you can do the same by any other scheduler for non-SAP DBs if you like to), because it's just easy to use and brings all the nice logs and protocols for free.

I guess that's it about this topic - now you've to make a choice

Best regards and a nice weekend,

Lars

former_member229109
Active Contributor
0 Kudos

Hi Martin,

1)

You wrote at the beginning:

"is it possible to create a event, that when the log file to 80 % full the maxdb make a logbackup"

&& now, I wrote that the problem is :

"Automatic Logbackup is a good thing but in most of the cases the Logarea is only 20% full.

That means we have upto 6 weeks no Logbackup."

==> For the last reported problem ::

May be the log area in the database is oversized or you have no activities in your database at all

or database parameter LOG_SEGMENT_SIZE could be reduced.

As you know with activated Automatic Log Backup the database triggers a log backup whenever

a log segment is full. Please check how did you configure the size of the log segment - value of

database parameter LOG_SEGMENT_SIZE.

Please provide the following information:

-> Do you have the database activities daily?

-> What is the version of the database?

-> How often the LOG backup are written in your database?

-> Update with output of the dbm commands 'param_getvolsall' & 'param_directget LOG_SEGMENT_SIZE'

2)

"when the log file to 80 % full the maxdb make a logbackup"

If the log area is 80 % full, you need to check if the autolog backup was switched on or not.

For example, the reason of the log area to the 80% could be also with autolog on,

when you didn't archive the log backups & file system, where you are writing backups, is

full. There are another reasons & the case need to be checked first in your database.

And if the FS where you are writing the databackup is full, you need to archive the log backups first,

then switch the autolog backup on.

==> Could you please therefore describe the problem you have in the database & what

goal you would like to reach, then we could recommend you the database tool for

your project.

3)

… you could create the database event to create the database backup, when the log

area is filling up to 80% and the auto log is switched off < or you need additional

afforts with script … >. And anyway you have to think about failed log backup option

& what to do with that, but it's another question.

Simple test & NOT recommended on the PROD system.

You added the event to run the log backup command with log area is filling up to 30%

& you switched the autolog off.

-> You created the log backup medium LOGBACKUP & tested ones that you are able

to run the log backup using this medium without problems.

Run on the database server::

< MAXDB2 - the name of my database;

control,control - dbm-user,pwd in my database >

dbmcli -d MAXDB2 -u control,control -uUTL control,control backup_start LOGBACKUP log

<OK>

-> After that you added the event to run the command when the log area is filling up to 80%

&& the event config file is looking like::

testconfig.cfg ::

000000000.((Name == "LOGABOVELIMIT") && (Priority == 3) && (Value1 >= 80))=dbmcli -d MAXDB2 -u control,control -uUTL control,control backup_start LOGBACKUP log

FILEVERSION=7.6.03.08

<empty>

-> Run ... :

dbmcli on MAXDB2>autolog_show

OK

AUTOSAVE IS OFF

dbmcli on MAXDB2>event_set LOGABOVELIMIT HIGH 80

OK

<exit >

&& start the event dispatcher::

dbmevtdisp start C:\temp\testconfig.cfg -l C:\temp\eventlog.log -d MAXDB2 -u control,control

Start the loading to the database & after the database log are will be filling up to 80% the log backup will be created.

But this project has no sense, because if the autolog is set on & the configuration of LOG_SEGMENT_SIZE checked,

there are no database or OS problems, … the a log backup when a log segment is full will be created.

***

If you are SAP customer, please review the SAP Note No. 869267 .

Thank you and best regards, Natalia Khlopina

Edited by: Natalia Khlopina on Mar 1, 2008 11:11 PM

Former Member
0 Kudos

Hi Natalie and Lars,

I have done with Lars offer. First Automatic Logbackup deactivated then logbackup and the Automatic Logbackup activated.

KG

Martin

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

Hi Martin,

sure, it's possible.

To create the event (works the same in 7.6):

dbmcli on db77>event_list OK Name Priority Value Description / ... other events .../LOGABOVELIMIT LOW 50 Filling of the log area exceeds the given percentage LOGABOVELIMIT LOW 75 Filling of the log area exceeds the given percentage LOGABOVELIMIT MEDIUM 90 Filling of the log area exceeds the given percentage LOGABOVELIMIT MEDIUM 95 Filling of the log area exceeds the given percentage LOGABOVELIMIT HIGH 96 Filling of the log area exceeds the given percentage LOGABOVELIMIT HIGH 97 Filling of the log area exceeds the given percentage LOGABOVELIMIT HIGH 98 Filling of the log area exceeds the given percentage LOGABOVELIMIT HIGH 99 Filling of the log area exceeds the given percentage / ... other events .../ --- dbmcli on db77>event_set LOGABOVELIMIT MEDIUM 80 OK --- dbmcli on db77>event_list OK Name Priority Value Description / ... other events .../ LOGABOVELIMIT LOW 50 Filling of the log area exceeds the given percentage LOGABOVELIMIT LOW 75 Filling of the log area exceeds the given percentage LOGABOVELIMIT MEDIUM 80 Filling of the log area exceeds the given percentage LOGABOVELIMIT MEDIUM 90 Filling of the log area exceeds the given percentage LOGABOVELIMIT MEDIUM 95 Filling of the log area exceeds the given percentage LOGABOVELIMIT HIGH 96 Filling of the log area exceeds the given percentage LOGABOVELIMIT HIGH 97 Filling of the log area exceeds the given percentage LOGABOVELIMIT HIGH 98 Filling of the log area exceeds the given percentage LOGABOVELIMIT HIGH 99 Filling of the log area exceeds the given percentage / ... other events .../ --- dbmcli on db77>

To setup automatic log backup when the event is triggered, take a look into the documentation:

[Automatic Log Backup After Event LOGABOVELIMIT|http://maxdb.sap.com/doc/7_6/43/6796fd4c355f6ce10000000a1553f6/content.htm]

So after I showed you how to do it, please, WHY do you need to set it up at 80% filling level?

For heavy used databases the old fashioned "backup-whenever-a-log-segment-is-full" method is really a good choice. In the mean this triggers a log backup whenever one third of the log area has been filled.

For not so heavy used databases, the time-triggered automatic-logbackup is the good alternative.

So where is the advantage of waiting for the log area to get filled up to 80% before performing a log backup?

regards,

Lars

Former Member
0 Kudos

Hi Lars,

and thanks for your answer. As I understand, when the Database is filled to 80 percent the event trigger change the database in autolog mode? I have a customer who make daily log backups. (It is a developer SAP System) In some case he import many datas. When this happens often the SAP System stand still by reason of the Logfile is full. Is it possible to create the disp

dbmevtdisp add C:\test\testconfig.cfg Name == LOGABOVELIMIT Priority == HIGH Value1 == 80 Command == "dbmcli -u $DBMUSERPW$ -d $DBNAME$ –n $SERVERNAME$ backup_start DemoFileLog LOG AUTOIGNORE"

This may be the perfect solution for me.

Greets

Martin

lbreddemann
Active Contributor
0 Kudos

Hi Martin,

an easier approach would be to use automatic logbackup depending on filled up logsegments for most of the time.

In addition to that you can setup a manual logbackup from the db13 planning calender.

You would schedule the deactivation of automatic logbackup, the manual logbackup itself and the reactivation of the automatic logbackup there together.

This way you don't need to setup the database event and the database is still protected from a logfull situation by the automatic logbackup.

And by scheduling the manual logbackup once or twice a day you still make sure that you have logbackups taken, even if not so much data has been changed.

This is the approach many customers take and live quite happy with it.

KR Lars

Former Member
0 Kudos

Hi Lars,

automatic logbackup is not possible for us. We need daily log backups to have a consist database. Every 3 upto 6 weeks we have a high database load. And when this happens we need a logbackup. I the other times is a daily backup better for us.

Is this possible?

Greets

Martin

lbreddemann
Active Contributor
0 Kudos

Hi Martin,

as I said, you can have both the automatic logbackup and the daily logbackup (see my last reply).

But what do you mean by

We need daily log backups to have a consist database.

??

Whenever you make a data backup of your database, you get a consistent backup. Everytime. In fact, you cannot create a inconsistent backup with MaxDB.

E.g. when you create your backups nightly, all changes of the past day will be in your data backup.

You can do the switching of automatic log backup if you like to via the event mechanism, but it's not necessary.

KR Lars

Former Member
0 Kudos

Hi Lars,

sorry for my diction. I guess that is not possible to have both, automatic log und daily backup. In DB13 appears

    • SAVE/RESTORE result:

ERR

-24988,ERR_SQL: SQL error

-7071,AUTOSAVE LOG must be stopped

      • SAVE/RESTORE request:

SAVE LOG CANCEL

      • SAVE/RESTORE request accepted:

OK

      • SAVE/RESTORE result:

ERR

-24988,ERR_SQL: SQL error

-104,DBM command impossible at this time

      • DBA Action ends:

Timestamp: 20080225084518 State: Failure

How can i activate the auto_log when I have daily backups?

KG

Martin

lbreddemann
Active Contributor
0 Kudos

Hi Martin,

just read one of my last answers:

>In addition to that you can setup a manual logbackup from the db13 planning calender.

>You would schedule the deactivation of automatic logbackup, the manual logbackup itself and the >reactivation of the automatic logbackup there together.

It's true, as long as autolog is enabled, no manual backup is possible.

Therefore schedule the following in DB13:

  • Disable automatic log backup

  • Log backup

  • Enable automatic log backup

With this schedule you can have actually both, manual and automatic logbackup.

KR Lars

Former Member
0 Kudos

Hi Lars,

sorry, who can read is in advanced

I make the change how you said.

KG

Martin

Former Member
0 Kudos

Hi Lars,

now its started but I have question about the security. When I create the config file I must write the user and password in cleartype in this config file. The same is when I start the dbmeventdisp. I must started with username and password in cleartype. If there another possibilities?

KG

Martin

lbreddemann
Active Contributor
0 Kudos

Hi Martin,

still following the event-based-approach are you? Fine with me

If you want to avoid the use of cleartext logon data, then - avoid them )

Instead use the XUSER-data.

[XUser Documentation|http://maxdb.sap.com/doc/7_6/28/873e4045796913e10000000a1550b0/content.htm].

A complete XUser-dataset includes name of the database, servername, password, sqlmode, isolationlevel and timeout setup. The data is stored encrypted and needs to be setup for each user/computer you want to use them.

With correctly setup XUser-data in place you can call dbmcli like this


dbmcli -U c

Note that instead of "-u" it's "-U" (capital U) now.

The "c" in my example is just the name of a logon data set. It could basically be any name, but as "c" is one of the standard XUser-entries in SAP environments, I just used it here as well.

I've also a blog writen about it [Mind the gap...|/people/lars.breddemann/blog/2007/12/06/mind-the-gap]

Using XUser-data is highly recommended instead of using cleartext logon data.

Hope that is what you were looking for.

KR Lars