cancel
Showing results for 
Search instead for 
Did you mean: 

Rman backup is failing with EC 6

Kumar_Amit
Level 3

Hi Everyone,

I have one issue in Rman backups that the Scheduled Automatic backup job is failing with EC 6 whereas all User Directed
Application jobs completing Successfully.
I have checked and found that Automatic backup failing with EC 6 is has owner= root
and Application backup job has Owner = orap

Please suggest.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Marianne
Level 6
Partner    VIP    Accredited Certified

Scheduled backups will always run as root.
Have a look at one of the sample scripts in /usr/openv/netbackup/ext/db_ext/oracle/samples/rman.
You will see that it tests user name. If root, it will 'su - <oracle-user>' .

Modify your script to do the same.

View solution in original post

3 REPLIES 3

Marianne
Level 6
Partner    VIP    Accredited Certified

Scheduled backups will always run as root.
Have a look at one of the sample scripts in /usr/openv/netbackup/ext/db_ext/oracle/samples/rman.
You will see that it tests user name. If root, it will 'su - <oracle-user>' .

Modify your script to do the same.

Kumar_Amit
Level 3

Hi Marianne,

Should I ask DBA to modify script if root,it will 'su - <root>' or it will 'su - <oracle-user>'.Please confirm

 

Marianne
Level 6
Partner    VIP    Accredited Certified

Scheduled backups are run as root, but root does not have any Oracle rights. This is why your scheduled backup is failing.

The script needs to be modified so that 'current' user is determined - if root, the script must 'su - <oracle-user>'.

Please ask dba to check samples in folder mentioned above.

Herewith extract from the sample hot_database_backup.sh script in this folder: 

# Replace ora102, below, with the Oracle DBA user id (account).
# ---------------------------------------------------------------------------
ORACLE_USER=ora102
....


# Determine the user which is executing this script.
# ---------------------------------------------------------------------------
CUSER=`id |cut -d"(" -f2 | cut -d ")" -f1`
........
CMD_STR="
ORACLE_HOME=$ORACLE_HOME
export ORACLE_HOME
ORACLE_SID=$ORACLE_SID
export ORACLE_SID
$RMAN target $TARGET_CONNECT_STR nocatalog msglog $RMAN_LOG_FILE append << EOF
RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
    $BACKUP_TYPE
    SKIP INACCESSIBLE
    TAG hot_db_bk_level0
    FILESPERSET 5
    # recommended format
    FORMAT 'bk_%s_%p_%t'
    DATABASE;
    sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
# backup all archive logs
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
   filesperset 20
   FORMAT 'al_%s_%p_%t'
   ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
......
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
BACKUP
    # recommended format
    FORMAT 'cntrl_%s_%p_%t'
    CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
EOF
"
# Initiate the command string

 

if [ "$CUSER" = "root" ]
then
    su - $ORACLE_USER -c "$CMD_STR" >> $RMAN_LOG_FILE
    RSTAT=$?
else
    /usr/bin/sh -c "$CMD_STR" >> $RMAN_LOG_FILE
    RSTAT=$?
fi
 
Hope this helps!