Hi Frank,

here's a snippet of our backup-script:

---8<---
    [...]

    call_dbmcli -c "autolog_show" | grep -i "AUTO.* IS ON" &>/dev/null
    if [ $? -eq 0 ]; then   
        case "$DB_VERSION" in 
            7.6.*)
                FILLING_DEGREE="$( 
                    call_dbmcli -c "sql_execute select USEDSIZEPERCENTAGE
from LOGSTATISTICS" |\
                    grep '^[0-9]*$' )"
            ;;
            7.*)
                FILLING_DEGREE="$( 
                    call_dbmcli -c "sql_execute select \"Used Size (%)\"
from DOMAIN.INFO_LOG_STATE" |\
                    grep '^[0-9]*$' )"
            ;;
        esac    

        if [ ! -z $FILLING_DEGREE -a $FILLING_DEGREE -gt 0 ]; then
            info "filling degree of log is ${FILLING_DEGREE}%"

            info "checking whether autolog is currently running"
            if [ "$(call_dbmcli -c backup_state |\
                        grep -i "Medianame" | cut -f 2 |\
                        tr '[:upper:]' '[:lower:]')" =  \
                 "$(echo -n "$MEDIA" | tr '[:upper:]' '[:lower:]')" ]; then
                info "a backup is currently running - won't proceed now"
                exit 0
            fi       
                        
            info "autolog is on - turning it off"
            call_dbmcli -c "autolog_off" &>/dev/null
            if [ $? -ne 0 ]; then
                error "could not disable AutoLog - won't start backup"
                exit 1
            fi      
        else
            [...]
---8<---

Notes:
        - it's a bash-script
        - $MEDIA contains the media-name for the backup
        - 'info' and 'error' are functions which log the given messages
        - call_dbmcli is a function which calls dbmcli with the correct
authentication-information and the given command line parameters
        - you can use USEDSIZE... (don't remember the right column name,
have a look for it) instead of USEDSIZEPERCENTAGE to have a better trigger;
but the log is backed upped only if it has a certain amount of pages 

One usage is to have at a given time (e.g. at 12:00) a complete recoverable
version of a database with all transactions in case of a major incidence
(assuming the backups are on tape or something similar - not located on the
db server).


bye
Chris


> -----Original Message-----
> From: Frank [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 29, 2007 6:26 PM
> To: maxdb@lists.mysql.com
> Subject: Re: using archive_stage und archive_stage_repeat in scripts
> 
> 
> Hello Tilo,
> 
> I have another question regarding backup.
> 
> if I do a logbackup in the following way, I get an error if no
> log-pages available for backup. How can I avoid an Error-Message.
> 
> 
> Skript:
> --------
> dbmcli -d $SID -u control,control autolog_off
> dbmcli -d $SID -u control,control -uUTL -c backup_start $LOG_MEDIUM
> LOG
> dbmcli -d $SID -u control,control autolog_on $LOG_MEDIUM
> 
> Error:
> --------
> ERR
> -24988,ERR_SQL: sql error
> -123,No more log to save
> 
> 
> best regards Frank
> 
> 
> 
> 
> 
> On Mon, 11 Jun 2007 13:44:41 +0200, [EMAIL PROTECTED] ("Heinrich,
> Tilo") wrote:
> 
> >Hello Frank,
> >
> >Of course you are right, the second archive_stage should 
> have been an archive_stage_repeat.
> >
> >Best regards,
> >Tilo Heinrich
> >Senior Developer
> >MaxDB&liveCache
> >SAP AG
> >http://www.sap.com <http://www.sap.com/> 
> >
> >Sitz der Gesellschaft/Registered Office: Walldorf, Germany
> >Vorstand/SAP Executive Board: Henning Kagermann 
> (Sprecher/CEO), Shai Agassi, Léo Apotheker, Werner Brandt, 
> Claus Heinrich, Gerhard Oswald, Peter Zencke
> >Vorsitzender des Aufsichtsrats/Chairperson of the SAP 
> Supervisory Board: Hasso Plattner
> >Registergericht/Commercial Register Mannheim No HRB 350269
> >
> >Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder 
> sonstige vertrauliche Informationen enthalten. Sollten Sie 
> diese E-Mail irrtümlich erhalten haben, ist Ihnen eine 
> Kenntnisnahme des Inhalts, eine Vervielfältigung oder 
> Weitergabe der E-Mail ausdrücklich untersagt. Bitte 
> benachrichtigen Sie uns und vernichten Sie die empfangene 
> E-Mail. Vielen Dank.
> >
> >This e-mail may contain trade secrets or privileged, 
> undisclosed, or otherwise confidential information. If you 
> have received this e-mail in error, you are hereby notified 
> that any review, copying, or distribution of it is strictly 
> prohibited. Please inform us immediately and destroy the 
> original transmittal. Thank you for your cooperation.
> >
> >
> >-----Original Message-----
> >From: Frank
> >Sent: Freitag, 8. Juni 2007 22:36
> >To: maxdb@lists.mysql.com
> >Subject: Re: using archive_stage und archive_stage_repeat in scripts
> >
> >Hi Tilo,
> >
> >thanks for the support. Just for my information: Shouldn't be the
> >second archive_stage-call a archive_stage_repeat. Maybe I missed
> >something.
> >
> >Thanks in advance.
> >Frank
> >
> >
> >On Tue, 5 Jun 2007 13:48:53 +0200, [EMAIL PROTECTED] ("Heinrich,
> >Tilo") wrote:
> >
> >>Hello Frank,
> >>
> >>You can A) write the archive_stage command and the 
> archive_stage_repeat command to an input file for the dbmcli 
> call ("dbmcli ... <inputfile") or use the inline input data 
> facility of your shell:
> >>
> >>dbmcli -u control,control -d $SID -uUTL -c <<EOF
> >>archive_stage $ARCHIVE_MEDIUM $LOG_MEDIUM NOVERIFY KEEP
> >>archive_stage $ARCHIVE_MEDIUM2 $LOG_MEDIUM VERIFY
> >>EOF
> >>
> >>Best regards,
> >>Tilo Heinrich
> >>Senior Developer
> >>MaxDB&liveCache
> >>SAP AG
> >>http://www.sap.com <http://www.sap.com/> 
> >>
> >>Sitz der Gesellschaft/Registered Office: Walldorf, Germany
> >>Vorstand/SAP Executive Board: Henning Kagermann 
> (Sprecher/CEO), Shai Agassi, Léo Apotheker, Werner Brandt, 
> Claus Heinrich, Gerhard Oswald, Peter Zencke
> >>Vorsitzender des Aufsichtsrats/Chairperson of the SAP 
> Supervisory Board: Hasso Plattner
> >>Registergericht/Commercial Register Mannheim No HRB 350269
> >>
> >>Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder 
> sonstige vertrauliche Informationen enthalten. Sollten Sie 
> diese E-Mail irrtümlich erhalten haben, ist Ihnen eine 
> Kenntnisnahme des Inhalts, eine Vervielfältigung oder 
> Weitergabe der E-Mail ausdrücklich untersagt. Bitte 
> benachrichtigen Sie uns und vernichten Sie die empfangene 
> E-Mail. Vielen Dank.
> >>
> >>This e-mail may contain trade secrets or privileged, 
> undisclosed, or otherwise confidential information. If you 
> have received this e-mail in error, you are hereby notified 
> that any review, copying, or distribution of it is strictly 
> prohibited. Please inform us immediately and destroy the 
> original transmittal. Thank you for your cooperation.
> >>
> >>-----Original Message-----
> >>From: Frank
> >>Sent: Freitag, 1. Juni 2007 14:34
> >>To: maxdb@lists.mysql.com
> >>Subject: using archive_stage und archive_stage_repeat in scripts
> >>
> >>Hallo,
> >>
> >>regarding maxdb-documentation I have to use archive_stage und
> >>archive_stage_repeat in one utility-session.
> >>
> >> In addition to that we want to  use environmentvariables in the
> >>archivingscript.
> >>Our script looks like:
> >>
> >>#/bin/sh
> >>export SID=ALT
> >>export LOG_MEDIUM=$SID'_LOG'
> >>export ARCHIVE_MEDIUM=BACKUP_LOG_PIPE
> >>
> >>dbmcli -u control,control -d $SID -uUTL -c archive_stage
> >>$ARCHIVE_MEDIUM $LOG_MEDIUM NOVERIFY KEEP
> >>
> >>How can I add the archive_stage_repeat-step in the script and make
> >>shure both steps run in the same utility-session
> >>
> >>with Regards Frank
> >>
> >>
> >>
> 
> -- 
> MaxDB Discussion Mailing List
> For list archives: http://lists.mysql.com/maxdb
> To unsubscribe:    
> http://lists.mysql.com/[EMAIL PROTECTED]
> 

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to