on tape -c
Posted in 2012
Derrick asked how to automate continuous logical log backups, since docs warn ontape -c can't run unattended (it prompts). Art Kagel advised dropping ontape -c and instead using ALARMPROGRAM event 23 (log complete) with BACKUPLOGS="Y" and BACKUP_CMD="ontape -a -d" (-d suppresses prompts), with LTAPEDEV pointing at a directory (not a file) so each log is written to a uniquely named file; Marcus added wrapper-script/exit-code checking and offsite copying, and Clive suggested 'screen' if ontape -c was still wanted. Derrick confirmed it worked. A follow-up about needing to disable HDR for ontape -s -L 0 -U db_name was resolved: drop the -U db_name (logging-mode change), which isn't allowed under replication.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
New to IDS All documentation says "do not start on tape -c" in background mode as there is no way to suppress prompts. So is the only way run this is via a terminal session? If your server is in a data centre then you would need to login to server with say putty and execute command. Problem with this is that this is now sitting on a PC in IT dept and if PC goes down and no one keeps checking then you end up with a problem QUESTION is what is the preferred method for automating on tape -c each time the db stats. Thanks Derrick Muller
The preferred method is to not use ontape -c but instead to use the
ALARMPROGRAM event code 23 (logical log completed) handler to run ontape -a
instead with LTAPEDEV set to a directory/filesystem (11.xx and later).
Ontape will handle renaming the files each time it is run.
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
other organization with which I am associated either explicitly,
implicitly, or by inference. Neither do those opinions reflect those of
other individuals affiliated with any entity with which I am affiliated nor
those of the entities themselves.
On Sun, Apr 1, 2012 at 10:45 AM, DERRICK MULLER <derrick@xact.co.za> wrote:
> New to IDS
>
> All documentation says "do not start on tape -c" in background mode as
> there
> is no way to suppress prompts.
>
> So is the only way run this is via a terminal session?
>
> If your server is in a data centre then you would need to login to server
> with
> say putty and execute command. Problem with this is that this is now
> sitting
> on a PC in IT dept and if PC goes down and no one keeps checking then you
> end
> up with a problem
>
> QUESTION is what is the preferred method for automating on tape -c each
> time
> the db stats.
>
> Thanks
> Derrick Muller
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--e89a8f3ba75f5f485a04bc9f65f3
Thanks Art for info.
We are running on SLE 11.0
If I understand correctly here's what I have done:
In onconfig:
1.) Set LTAPEDEV = (set to a file in a directory)
2.) These settings for ALARM PROGRAM
ALARMPROGRAM /opt/IBM/informix/etc/alarmprogram.sh
ALRM_ALL_EVENTS 0
STORAGE_FULL_ALARM 600,3
SYSALARMPROGRAM /opt/IBM/informix/etc/evidence.sh
In alarmprogram.sh:
ADMINEMAIL=dev@xact.co.za
PAGEREMAIL=dev@xact.co.za
(What is difference between ADMINEMAIL & PAGEREMAIL
BACKUP_CMD="ontape -a"
And that's it. Is there anything else that need to be set to start alarm
program?
So now when the logs reach 90% full the alarm program will trigger "ontape -a"
and also fire of an email.
By not backing up each log file as it is full, will this not result in delays
for users when alarmprogram triggers a on tape -a and need to backup a large
number of logs.
On a slightly different issue regarding logs. What is your view on having
either less large size log files or more smaller size log files?
Thanks
Hi Derrik,
set LTAPEDEV to a directory
set IFX_ONTAPE_FILE_PREFIX to a name which refers to the instance (if you have
more than one)
we have modified alarmprogram.sh to call a shell script (will get the log no
to save as parameter)
This one calls (ontape -a -d 2>&1) > /var/log/backup_log.out.$1
and then interprets the exit code. If exit code is <> 0, it will send the
admin a mail of the secured output.
That way, a completely unattended log backup to directory is possible.
Each Logfile will have a unique name and you will get an alarm mail whenever
for any reason
log backup fails.
We have a cron job running, which then zips the logfiles and rsyncs them to a
backup server.
Hope this helps.
Marcus
----- Ursprüngliche Mail -----
Von: "DERRICK MULLER" <derrick@xact.co.za>
An: ids@iiug.org
Gesendet: Sonntag, 1. April 2012 19:05:17
Betreff: Re: on tape -c [26630]
Thanks Art for info.
We are running on SLE 11.0
If I understand correctly here's what I have done:
In onconfig:
1.) Set LTAPEDEV = (set to a file in a directory)
2.) These settings for ALARM PROGRAM
ALARMPROGRAM /opt/IBM/informix/etc/alarmprogram.sh
ALRM_ALL_EVENTS 0
STORAGE_FULL_ALARM 600,3
SYSALARMPROGRAM /opt/IBM/informix/etc/evidence.sh
In alarmprogram.sh:
ADMINEMAIL=dev@xact.co.za
PAGEREMAIL=dev@xact.co.za
(What is difference between ADMINEMAIL & PAGEREMAIL
BACKUP_CMD="ontape -a"
And that's it. Is there anything else that need to be set to start alarm
program?
So now when the logs reach 90% full the alarm program will trigger "ontape -a"
and also fire of an email.
By not backing up each log file as it is full, will this not result in delays
for users when alarmprogram triggers a on tape -a and need to backup a large
number of logs.
On a slightly different issue regarding logs. What is your view on having
either less large size log files or more smaller size log files?
Thanks
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
ALmost, see below:
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
other organization with which I am associated either explicitly,
implicitly, or by inference. Neither do those opinions reflect those of
other individuals affiliated with any entity with which I am affiliated nor
those of the entities themselves.
On Sun, Apr 1, 2012 at 1:05 PM, DERRICK MULLER <derrick@xact.co.za> wrote:
> Thanks Art for info.
>
> We are running on SLE 11.0
>
But what Informix version? ;-)
>
> If I understand correctly here's what I have done:
>
> In onconfig:
> 1.) Set LTAPEDEV = (set to a file in a directory)
>
Better to set LTAPEDEV to the directory itself not a file. If you name a
file here then you have to manage renaming the file after ontape
completes. If you use a directory, each time ontape needs to archive a log
file, it will create a new file in that directory named
<hostname>_<servernum>_Log<lognum>
>
> 2.) These settings for ALARM PROGRAM
> ALARMPROGRAM /opt/IBM/informix/etc/alarmprogram.sh
> ALRM_ALL_EVENTS 0
> STORAGE_FULL_ALARM 600,3
> SYSALARMPROGRAM /opt/IBM/informix/etc/evidence.sh>
> In alarmprogram.sh:
> ADMINEMAIL=dev@xact.co.za
> PAGEREMAIL=dev@xact.co.za
> (What is difference between ADMINEMAIL & PAGEREMAIL
>
> BACKUP_CMD="ontape -a"
>
Make this:
BACKUP_CMD="ontape -a -d" #The -d prevents ontape from prompting for
input, it assumes it is being run from a script
>
> And that's it. Is there anything else that need to be set to start alarm
> program?
>
Yes:
BACKUPLOGS="Y"
>
> So now when the logs reach 90% full the alarm program will trigger "ontape
> -a"
> and also fire of an email.
>
No. Each time the engine switches logical log files, "ontape -a -d" will
fire archiving that log and any other logs that complete before ontape
finishes. The script will write a message into the message log but will
only email you if the total logical logs used is over 90% after the archive
completes.
>
> By not backing up each log file as it is full, will this not result in
> delays
> for users when alarmprogram triggers a on tape -a and need to backup a
> large
> number of logs.
>
But it DOES backup each log as it fills by catching the event #23 which is
issued whenever the engine changes logs.
>
> On a slightly different issue regarding logs. What is your view on having
> either less large size log files or more smaller size log files?
>
Bigger logs more data at risk for loss if the machine crashes hard before
you can archive the log files and move a copy offline (BTW I always add
code to alarmprogram to copy the log archive file to another machine after
the archive completes - for safety - Good DBAs are paranoid DBAs!) Smaller
logs more overhead. It's a trade off, like everything else. Err on the
side of safety to my mind.
>
> Thanks
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--90e6ba6e8c0c5668b704bca40a62
And if you don't want to take Art's excellent
advice and really want to use ontape -c do under
'screen'
http://linux.die.net/man/1/screen
--
Clive
On 01/04/2012 16:04, Art Kagel wrote:
> The preferred method is to not use ontape -c but instead to use the
> ALARMPROGRAM event code 23 (logical log completed) handler to run ontape -a
> instead with LTAPEDEV set to a directory/filesystem (11.xx and later).
> Ontape will handle renaming the files each time it is run.
>
> Art
>
> Art S. Kagel
> Advanced DataTools (www.advancedatatools.com)
> Blog: http://informix-myview.blogspot.com/
>
> Disclaimer: Please keep in mind that my own opinions are my own opinions
> and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
> other organization with which I am associated either explicitly,
> implicitly, or by inference. Neither do those opinions reflect those of
> other individuals affiliated with any entity with which I am affiliated nor
> those of the entities themselves.
>
> On Sun, Apr 1, 2012 at 10:45 AM, DERRICK MULLER<derrick@xact.co.za> wrote:
>
>> New to IDS
>>
>> All documentation says "do not start on tape -c" in background mode as
>> there
>> is no way to suppress prompts.
>>
>> So is the only way run this is via a terminal session?
>>
>> If your server is in a data centre then you would need to login to server
>> with
>> say putty and execute command. Problem with this is that this is now
>> sitting
>> on a PC in IT dept and if PC goes down and no one keeps checking then you
>> end
>> up with a problem
>>
>> QUESTION is what is the preferred method for automating on tape -c each
>> time
>> the db stats.
>>
>> Thanks
>> Derrick Muller
>>
>>
>>
>>
>
*******************************************************************************
>> Forum Note: Use "Reply" to post a response in the discussion forum.
>>
>>
>
> --e89a8f3ba75f5f485a04bc9f65f3
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
The mud is clearing and I am seeing the picture. Thanks for great input.
Great help thanks. We are using IDS 11.0 We will test the alarm program out today. Derrick Muller
Hi Art
Got alarm program working great and getting a backup file for each log file as
it if full. Many thanks for this.
On the subject of data backups we are using:
ontape -s -L 0 -U db_name
However we have to switch off HDR to do this type of backup, is this correct
or is there another trick to doing daily db backups.
What are your suggestions.
Thanks
Derrick Muller
The -U is why you are having to disable HDR. That option is used to modify
the logging mode of a database to unbuffered logging and you cannot change
the logging mode of a database while it is being replicated (even though I
suspect that the database is already in that logging mode from previous
archives). Just drop the -U db_name clause and you will no longer have to
disable HDR to perform the archives.
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
other organization with which I am associated either explicitly,
implicitly, or by inference. Neither do those opinions reflect those of
other individuals affiliated with any entity with which I am affiliated nor
those of the entities themselves.
On Mon, Apr 2, 2012 at 10:42 AM, DERRICK MULLER <derrick@xact.co.za> wrote:
> Hi Art
>
> Got alarm program working great and getting a backup file for each log
> file as
> it if full. Many thanks for this.
>
> On the subject of data backups we are using:
> ontape -s -L 0 -U db_name>
> However we have to switch off HDR to do this type of backup, is this
> correct
> or is there another trick to doing daily db backups.
>
> What are your suggestions.
>
> Thanks
> Derrick Muller
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--14dae9340d59cfa75104bcb4e294
On 2 Apr 2012, at 15:42, DERRICK MULLER wrote:
> Hi Art
>
> Got alarm program working great and getting a backup file for each log file
as
> it if full. Many thanks for this.
>
> On the subject of data backups we are using:
> ontape -s -L 0 -U db_name>
> However we have to switch off HDR to do this type of backup, is this correct
> or is there another trick to doing daily db backups.
>
> What are your suggestions.
>
Hi Derrick,
Why not just use
ontape -s -L 0
?
You shouldn't need to switch off HDR for any kind of backup, either.