This discussion is archived
6 Replies Latest reply: Nov 29, 2012 5:09 PM by 862343 RSS

problem about backup use rman

862343 Newbie
Currently Being Moderated
i find when i use script to run rman ,the date of rman is not the date when script run,why?
    =============*Thu Nov 29 09:15:01 CST 2012 begin backup* ============

    RUN
    {
            backup incremental level 1 cumulative tag 'olel_121129' skip inaccessible database;
            sql 'alter system archive log current';
            backup archivelog all delete input tag 'arch_121129';
    }
    crosscheck backupset;
    delete noprompt expired backupset;
    report obsolete;
    delete noprompt obsolete;
    exit;

    *Recovery Manager: Release 11.2.0.1.0 - Production on Mon Nov 26 10:22:47 2012*

    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

    RMAN>
  • 1. Re: problem about backup use rman
    Niket Kumar Pro
    Currently Being Moderated
    check system date with date command.



    looks like it is hard coded date.post you whole script.

    =============*Thu Nov 29 09:15:01 CST 2012 begin backup* ============
  • 2. Re: problem about backup use rman
    moreajays Pro
    Currently Being Moderated
    Hi,

    Check the OS TZ format for the osuser from which script is executed
    give us below o/p from os prompt & also provide part of the script capturing the date in the head of script

    date

    Thank,
    Ajay More
  • 3. Re: problem about backup use rman
    862343 Newbie
    Currently Being Moderated
    the output produce by date command ,not hard coded~
  • 4. Re: problem about backup use rman
    862343 Newbie
    Currently Being Moderated
    time zone
    # date +%z
    +0800

    and content of script


    #!/bin/bash
    
    RMAN_LOG=/home/oracle/scripts/rman.log
    BAK_LOG=/home/oracle/scripts/bak.log
    
    DAY=`date +%u`;
    if [ $DAY != 7 ];then
    LEV=1;
    else
    LEV=0;
    fi
    
    if [ $LEV = 1 ];then
    TAG='olel_'`date +%y%m%d`;
    else
    TAG='zlel_'`date +%y%m%d`;
    fi
    
    ARCHTAG='arch_'`date +%y%m%d`;
    
    echo "=============`date` begin backup ============" >> ${BAK_LOG}
    cat > /tmp/rmanrt.$$<<!
    
    RUN
    {
            backup incremental level $LEV cumulative tag '$TAG' skip inaccessible da                                                                                                 tabase;
            sql 'alter system archive log current';
            backup archivelog all delete input tag '$ARCHTAG';
    }
    crosscheck backupset;
    delete noprompt expired backupset;
    report obsolete;
    delete noprompt obsolete;
    exit;
    !
    
    $ORACLE_HOME/bin/rman target / cmdfile=/tmp/rmanrt.$$ log=${RMAN_LOG}
    
    cat /tmp/rmanrt.$$ >> ${BAK_LOG}
    \rm /tmp/rmanrt.$$
    cat ${RMAN_LOG} >> ${BAK_LOG}
    
    echo "=============`date` end backup ============" >> ${BAK_LOG}
    execute from cmdline
    [oracle@DBtest scripts]$ ./bak.rmn
    RMAN> RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> [oracle@DBtest scripts]$
    
    =============Thu Nov 29 16:46:12 CST 2012 begin backup ============
    
    RUN
    {
            backup incremental level 1 cumulative tag 'olel_121129' skip inaccessible database;
            sql 'alter system archive log current';
            backup archivelog all delete input tag 'arch_121129';
    }
    crosscheck backupset;
    delete noprompt expired backupset;
    report obsolete;
    delete noprompt obsolete;
    exit;
    
    Recovery Manager: Release 11.2.0.1.0 - Production on Thu Nov 29 16:46:12 2012
    
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    
    connected to target database: TESTDB (DBID=2581033720)
    
    RMAN>
    RMAN> RUN
    2> {
    3>      backup incremental level 1 cumulative tag 'olel_121129' skip inaccessible database;
    4>      sql 'alter system archive log current';
    5>      backup archivelog all delete input tag 'arch_121129';
    6> }
    7> crosscheck backupset;
    8> delete noprompt expired backupset;
    9> report obsolete;
    10> delete noprompt obsolete;
    11> exit;
    Starting backup at 29-NOV-12
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=152 device type=DISK
    channel ORA_DISK_1: starting incremental level 1 datafile backup set
    channel ORA_DISK_1: specifying datafile(s) in backup set
    input datafile file number=00002 name=+BMDATA/testdb/datafile/sysaux.257.797705505
    input datafile file number=00001 name=+BMDATA/testdb/datafile/system.256.797705505
    input datafile file number=00003 name=+BMDATA/testdb/datafile/undotbs1.258.797705505
    input datafile file number=00004 name=+BMDATA/testdb/datafile/users.259.797705505
    channel ORA_DISK_1: starting piece 1 at 29-NOV-12
    channel ORA_DISK_1: finished piece 1 at 29-NOV-12
    piece handle=+BMFRA/testdb/backupset/2012_11_29/nnndn1_olel_121129_0.315.800642775 tag=OLEL_121129 comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
    channel ORA_DISK_1: starting incremental level 1 datafile backup set
    Edited by: 859340 on 2012-11-29 上午12:45
  • 5. Re: problem about backup use rman
    moreajays Pro
    Currently Being Moderated
    can u give complet o/p of date ?
    &

    env | grep -i TZ

    from os prompt

    Edited by: moreajays on Nov 29, 2012 3:00 PM
  • 6. Re: problem about backup use rman
    862343 Newbie
    Currently Being Moderated
    here is all env output
    [oracle@DBtest scripts]$ env
    HOSTNAME=DBtest
    SHELL=/bin/bash
    TERM=screen
    HISTSIZE=1000
    TMPDIR=/opt/tmp
    USER=oracle
    LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
    ORACLE_SID=testdb
    ORACLE_BASE=/opt/app/oracle
    ORACLE_HOSTNAME=ZF004DBtest
    MAIL=/var/spool/mail/oracle
    PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/opt/app/oracle/product/11.2.0/dbhome_1/bin
    INPUTRC=/etc/inputrc
    PWD=/home/oracle/scripts
    EDITOR=vi
    LANG=en_US.UTF-8
    SHLVL=1
    HOME=/home/oracle
    TMP=/opt/tmp
    LOGNAME=oracle
    LESSOPEN=|/usr/bin/lesspipe.sh %s
    ORACLE_HOME=/opt/app/oracle/product/11.2.0/dbhome_1
    G_BROKEN_FILENAMES=1
    _=/bin/env
    OLDPWD=/home/oracle

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points