"whenever sqlerror exit 1" does not work on Linux


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting "whenever sqlerror exit 1" does not work on Linux
# 1  
Old 09-22-2005
"whenever sqlerror exit 1" does not work on Linux

Hi folks,

I have the following functions in my Installation script:
Code:
create_roles()
{
export rollback=yes
echo "\nCreating roles ..." >> $installLog

    errMsg="ERROR: Failed to create roles!\nCheck the details in ${logDir}/create_roles.log"
    validMsg="-> VALID: roles were created."

${PLUS} -s sys/${SYS_PASS}@${CONNECT_STRING} as sysdba << EOF 
spool ${logDir}/create_roles.log
@${InstallObjDir}/CORE.roles ${SCHEMA_NAME}
spool off
EOF
confirm_return
}
#------------------------------------------------------------------------
confirm_return()
{
if [[ $? -ne 0 ]] ; then
  $stars | tee -a $installLog
  echo $errMsg | tee -a $installLog
  echo "EXITING: Please fix and rerun ${InstallDir}/Install_RiGHTv.ksh\n" | tee -a $installLog
  clean_up
  exit 1
else
  echo $validMsg >> $installLog
fi
}
#------------------------------------------------------------------------
clean_up()
{
${cdromPath}/cleanup.ksh
}
#-----------------------------------------------------------------------

If sqlerror is detected ,the script cleanup.ksh will be run (rollback process).

When I ran the Installation,I forgot to clean some roles from the database ,and I've got the following error:
Code:
Creating role PLATOR81_BO_ROLE ...
old   1: create role &SCHEMA_NAME._BO_ROLE
new   1: create role PLATOR81_BO_ROLE
create role PLATOR81_BO_ROLE
            *
ERROR at line 1:
ORA-01921: role name 'PLATOR81_BO_ROLE' conflicts with another user or role name

The installation was suppose to get status 1 and run cleanup.ksh script.
The current situation is that the installation was stuck and doing nothing!
This problem occurs only on Linux platform. On Solaris and HP-UX I haven't encountered with this problem.
Our Linux version is Red Hat 2.1

Any advises will be gratefully accepted.

Thanks in advance,
Nir
# 2  
Old 09-22-2005
Check Oracle's metalink support site.
# 3  
Old 09-22-2005
Thanks,I'll do it.

Nir
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question

Featured Tech Videos