Installation scripts

Problem


You don't have an automated deployment system and need a script to deploy your code.

Solution


The following script deploys a variety of objects.

!/bin/sh
# $Header: XX206594_INSTALLER.sh 120.00.00 2015/03/30 $
# +===========================================================================+
# | FILENAME 
# |   XX206594_INSTALLER.sh                                             
# | DESCRIPTION                                                                   
# |   This script is used to install XX206594 .
# | USAGE
# |   Type the below command after extracting the zip file
# |   <file_name> <APPS> <APPSPWD> <SERVICE> <HOST> <PORT>
# |   e.g. see below
# |   XX206594_INSTALLER.sh apps apps DEV hostname 1531
# | HISTORY                                                                       
# |   Version    Date       Author              Comments                     
# |
# +===========================================================================+

CEMLI_PREFIX=XX206594
CUR_DIR=`pwd`
XXLOGFILE=$CEMLI_PREFIX"_INSTALLER_"`date +%Y-%m-%d-%H:%M:%S`.log
XX_LOG=`echo $XXLOGFILE`

APPSID=$1
APPSPWD=$2
SERVICE=$3
HOST=$4
PORT=$5

# *****************************************************************************
# FUNCTION: Entry Banner
# *****************************************************************************
function PRINT_ENTRY_BANNER
{
  echo ""                                                                    | tee -a ${XX_LOG}
  echo "*******************************************************************" | tee -a ${XX_LOG}
  echo "Beginning of Installation for "$CEMLI_PREFIX                         | tee -a ${XX_LOG}
  echo "Current System time is" `date "+%d-%b-%Y %H:%M:%S"`                  | tee -a ${XX_LOG}
  echo "*******************************************************************" | tee -a ${XX_LOG}
  echo ""                                                                    | tee -a ${XX_LOG}
}

# *****************************************************************************
# FUNCTION: Exit Banner
# *****************************************************************************
function PRINT_EXIT_BANNER
{
  echo ""                                                                    | tee -a ${XX_LOG}
  echo "*******************************************************************" | tee -a ${XX_LOG}
  echo "End of Installation for "$CEMLI_PREFIX                               | tee -a ${XX_LOG}
  echo "Current System time is" `date "+%d-%b-%Y %H:%M:%S"`                  | tee -a ${XX_LOG}
  echo "*******************************************************************" | tee -a ${XX_LOG}
  echo ""                                                                    | tee -a ${XX_LOG}

  echo "Please check the log file" $XX_LOG "for installation results."
  echo "Please check the FNDLOAD log files for results."
  echo "Files can be found in the directory" $CUR_DIR
}

# *****************************************************************************
# FUNCTION: Exit with error.
# *****************************************************************************
function ERROR_EXIT
{
  echo "Error occurred so aborting ...."                                     | tee -a  ${XX_LOG}
  PRINT_EXIT_BANNER
  exit 1
}

# *****************************************************************************
# FUNCTION: Verify the Login Username and password
# *****************************************************************************
CHKLOGIN(){
    if sqlplus -s /nolog <<! >/dev/null 2>&1
        WHENEVER SQLERROR EXIT 1;
        CONNECT $1 ;
        COLUMN tbl NEW_VALUE tbl_name NOPRINT;
        SELECT  table_name tbl
        FROM    all_tables
        WHERE   table_name = UPPER('$2');
        EXIT;
!
    then
        echo OK
    else
        echo NOK
    fi
}

# *****************************************************************************
# Main start of the program.
# *****************************************************************************
PRINT_ENTRY_BANNER

# *****************************************************************************
# Check number of Arguments is equal to 5 or not.
# *****************************************************************************
if [ $# -ne 5 ];
then
  echo "Please enter 5 parameters <APPS> <APPSPWD> <SERVICE> <HOST> <PORT>"            | tee -a ${XX_LOG}
  echo "Example : sh "$CEMLI_PREFIX"_INSTALLER.sh apps apps DEV hostname 1531" | tee -a ${XX_LOG}
  exit;
fi

# *****************************************************************************
# Check if Apps login details are correct else prompt to get it again
# *****************************************************************************
while [  `CHKLOGIN "$APPSID/$APPSPWD@$SERVICE" "DUAL"` = "NOK"  ]
do
   echo "APPS Login details may NOT BE CORRECT. Please Re-enter"             | tee -a ${XX_LOG}

   # *********************************************************************
   #  Get the APPS Username, Password and SID
   # *********************************************************************

   echo "Enter APPS Username <APPS>: "                                       | tee -a ${XX_LOG}
   read APPSID
   while [ "$APPSID" = ""  ]
   do
      echo "Enter APPS Username <APPS>: "                                    | tee -a ${XX_LOG}
      read APPSID
   done

   echo "Enter APPS Password <APPS>: "                                       | tee -a ${XX_LOG}
   stty -echo
   read APPSPWD
   stty echo
   while [ "$APPSPWD" = ""  ]
   do
      echo "Enter APPS Password <APPS>: "                                    | tee -a ${XX_LOG}
      stty -echo
      read APPSPWD
      stty echo
   done

   echo "Enter the Service Name <SERVICE>: "                                 | tee -a ${XX_LOG}
   read SERVICE
   while [ "$SERVICE" = ""  ]
   do
      echo "Enter the Service Name <SERVICE>: "                              | tee -a ${XX_LOG}
      read SERVICE
   done
done

APPSCONNECT=$APPSID/$APPSPWD@$SERVICE
APPSCONNECTA=$APPSID/$APPSPWD

# ************************************************************************************
#  Installing DB Objects
# ************************************************************************************
echo "Installing DB Objects...."                                   | tee -a  ${XX_LOG}

if sqlplus -s $APPSCONNECT @$CUR_DIR/Create_db_objects.sql
then
  echo "DB Object creation was successful."                                            | tee -a  ${XX_LOG}
else
  echo "DB Object creation was not successful."                                        | tee -a  ${XX_LOG}
  echo "Aborting ...."                                                             | tee -a  ${XX_LOG}
  exit 1
fi

# ************************************************************************************
#  Copying shell scrips and SQL scripts                                           
# ************************************************************************************
echo "Copying shell scrips and SQL scripts...."                     | tee -a  ${XX_LOG}

cp XX_LOAD_CONC.prog $_TOP/bin
chmod 755 $_TOP/bin/XX_LOAD_CONC.prog
ln -s $FND_TOP/bin/fndcpesr/ $_TOP/bin/XX_LOAD_CONC
cp XX_LOAD_CONC_COPY.sql $_TOP/sql
chmod 755 $_TOP/sql/XX_LOAD_CONC_COPY.sql
cp XX_LOAD_CONC_LOAD.sql $_TOP/sql
chmod 755 $_TOP/sql/XX_LOAD_CONC_LOAD.sql

# ************************************************************************************
#  Installing package XX_LOAD_CONC_PKG
# ************************************************************************************
echo "Installing package XX_LOAD_CONC_PKG...."                                   | tee -a  ${XX_LOG}

if sqlplus -s $APPSCONNECT @$CUR_DIR/xx_load_conc_pkg.pkg
then
  echo "Installing package XX_LOAD_CONC_PKG was successful."                         | tee -a  ${XX_LOG}
else
  echo "Installing package XX_LOAD_CONC_PKG was not successful."                     | tee -a  ${XX_LOG}
  echo "Aborting ...."                                                           | tee -a  ${XX_LOG}
  exit 1
fi

# ************************************************************************************
#  Installing package XX_AR_ARXSUPST_PKG
# ************************************************************************************
echo "Installing package XX_AR_ARXSUPST_PKG...."                                   | tee -a  ${XX_LOG}

if sqlplus -s $APPSCONNECT @$CUR_DIR/XX_AR_ARXSUPST_PKG.pkg
then
  echo "Installing package XX_AR_ARXSUPST_PKG was successful."                         | tee -a  ${XX_LOG}
else
  echo "Installing package XX_AR_ARXSUPST_PKG was not successful."                     | tee -a  ${XX_LOG}
  echo "Aborting ...."                                                           | tee -a  ${XX_LOG}
  exit 1
fi

# ************************************************************************************
#  Installing Profile Option: XX_LOAD_CONC_DESTINATION
# ************************************************************************************
echo "Installing profile option XX_LOAD_CONC_DESTINATION ...."                        | tee -a  ${XX_LOG}
if FNDLOAD $APPSCONNECTA 0 Y UPLOAD $FND_TOP/patch/115/import/afscprof.lct $CUR_DIR/XX_LOAD_CONC_DESTINATION_PF.ldt - CUSTOM_MODE=FORCE
then
    echo "Installation of profile option successful."                                 | tee -a  ${XX_LOG}
else
    echo "Installation of profile option not successful."                             | tee -a  ${XX_LOG}
    ERROR_EXIT
fi

# ************************************************************************************
#  Installing Form Function: XX_AR_ARXSUPST
# ************************************************************************************
echo "Installing Form Function XX_AR_ARXSUPST ...."                        | tee -a  ${XX_LOG}
if FNDLOAD $APPSCONNECTA 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct $CUR_DIR/XX_AR_ARXSUPST_FF.ldt - CUSTOM_MODE=FORCE
then
    echo "Installation of Form Function successful."                                 | tee -a  ${XX_LOG}
else
    echo "Installation of Form Function not successful."                             | tee -a  ${XX_LOG}
    ERROR_EXIT
fi

# ************************************************************************************
#  Installing Concurrent Program: XX_LOAD_CONC
# ************************************************************************************
echo "Registering Concurrent Program XX_LOAD_CONC ...."                      | tee -a  ${XX_LOG}
if FNDLOAD $APPSCONNECTA 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct $CUR_DIR/XX_LOAD_CONC_US_CP.ldt - CUSTOM_MODE=FORCE
then
    echo "Registration of Concurrent Program was successful."                       | tee -a  ${XX_LOG}
else
    echo "Registration of Concurrent Program was not successful."                   | tee -a  ${XX_LOG}
    ERROR_EXIT
fi

# ************************************************************************************
#  Installing Concurrent Program: XX_ARXCGP
# ************************************************************************************
echo "Registering Concurrent Program XX_ARXCGP ...."                      | tee -a  ${XX_LOG}
if FNDLOAD $APPSCONNECTA 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct $CUR_DIR/XX_ARXCGP_US_CP.ldt - CUSTOM_MODE=FORCE
then
    echo "Registration of Concurrent Program was successful."                       | tee -a  ${XX_LOG}
else
    echo "Registration of Concurrent Program was not successful."                   | tee -a  ${XX_LOG}
    ERROR_EXIT
fi

# ************************************************************************************
#  Creating Forms Perso for AR_ARXSUPST
# ************************************************************************************
echo "  Creating Forms Perso for AR_ARXSUPST...."                      | tee -a  ${XX_LOG}

if FNDLOAD $APPSCONNECTA 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct XX_AR_ARXSUPST_US_FP_SEQ.ldt - CUSTOM_MODE=FORCE
then
    echo "Forms perso setup was successful."                       | tee -a  ${XX_LOG}
else
    echo "Forms perso setup was not successful."                   | tee -a  ${XX_LOG}
    ERROR_EXIT
fi

# ************************************************************************************
#  Creating XML Publisher setup for XX_ARXCGP
# ************************************************************************************
echo "  Creating XML Publisher setup for XX_ARXCGP...."                      | tee -a  ${XX_LOG}

if FNDLOAD $1/$2 0 Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct XX_ARXCGP_DD.ldt - CUSTOM_MODE=FORCE
then
    echo "XML Publisher setup was successful."                       | tee -a  ${XX_LOG}
else
    echo "XML Publisher setup was not successful."                   | tee -a  ${XX_LOG}
    ERROR_EXIT
fi

cp ABS_AU_STATEMENT19_7.rtf /ora/bovdev/appl/BOVDEVcomn/temp_PLSQL
chmod 755 /ora/bovdev/appl/BOVDEVcomn/temp_PLSQL/ABS_AU_STATEMENT19_7.rtf

java oracle.apps.xdo.oa.util.XDOLoader UPLOAD \
-DB_USERNAME $1 \
-DB_PASSWORD $2 \
-JDBC_CONNECTION $4:$5:$3 \
-LOB_TYPE TEMPLATE \
-APPS_SHORT_NAME  \
-LOB_CODE XX_ARXCGP_AU \
-LANGUAGE en \
-TERRITORY US \
-XDO_FILE_TYPE RTF \
-FILE_NAME ABS_AU_STATEMENT19_7.rtf \
-OWNER APPS \
-CUSTOM_MODE FORCE

java oracle.apps.xdo.oa.util.XDOLoader UPLOAD \
-DB_USERNAME $1 \
-DB_PASSWORD $2 \
-JDBC_CONNECTION $4:$5:$3 \
-LOB_TYPE BURSTING_FILE \
-APPS_SHORT_NAME  \
-LOB_CODE XX_ARXCGP \
-LANGUAGE en \
-TERRITORY 00 \
-NLS_LANG American_America\.WE8ISO8859P1 \
-XDO_FILE_TYPE XML-BURSTING-FILE \
-FILE_NAME XX_ARXCGP_BCF.xml

# ************************************************************************************
#  Installing Concurrent Program: XX_SCH_CUST_CHARGES_RPT
# ************************************************************************************
echo "Registering Concurrent Program XX_SCH_CUST_CHARGES_RPT ...."                      | tee -a  ${XX_LOG}
if FNDLOAD $APPSCONNECTA 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct $CUR_DIR/XX_SCH_CUST_CHARGES_RPT_US_CP.ldt - CUSTOM_MODE=FORCE
then
    echo "Registration of Concurrent Program was successful."                       | tee -a  ${XX_LOG}
else
    echo "Registration of Concurrent Program was not successful."                   | tee -a  ${XX_LOG}
    ERROR_EXIT
fi

# ************************************************************************************
#  Creating XML Publisher setup for XX_SCH_CUST_CHARGES_RPT
# ************************************************************************************
echo "  Creating XML Publisher setup for XX_SCH_CUST_CHARGES_RPT...."                      | tee -a  ${XX_LOG}

if FNDLOAD $1/$2 0 Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct XX_SCH_CUST_CHARGES_RPT_DD.ldt - CUSTOM_MODE=FORCE
then
    echo "XML Publisher setup was successful."                       | tee -a  ${XX_LOG}
else
    echo "XML Publisher setup was not successful."                   | tee -a  ${XX_LOG}
    ERROR_EXIT
fi

java oracle.apps.xdo.oa.util.XDOLoader UPLOAD \
-DB_USERNAME $1 \
-DB_PASSWORD $2 \
-JDBC_CONNECTION $4:$5:$3 \
-LOB_TYPE TEMPLATE \
-APPS_SHORT_NAME  \
-LOB_CODE XX_SCH_CUST_CHARGES_RPT \
-LANGUAGE en \
-TERRITORY US \
-XDO_FILE_TYPE RTF \
-FILE_NAME XX_SCH_CUST_CHARGES_RPT.rtf \
-OWNER APPS \
-CUSTOM_MODE FORCE

java oracle.apps.xdo.oa.util.XDOLoader UPLOAD \
-DB_USERNAME $1 \
-DB_PASSWORD $2 \
-JDBC_CONNECTION $4:$5:$3 \
-LOB_TYPE DATA_TEMPLATE \
-APPS_SHORT_NAME  \
-LOB_CODE XX_SCH_CUST_CHARGES_RPT \
-LANGUAGE en \
-TERRITORY 00 \
-NLS_LANG American_America\.WE8ISO8859P1 \
-XDO_FILE_TYPE XML-DATA-TEMPLATE \
-FILE_CONTENT_TYPE 'text/xml' \
-FILE_NAME XX_SCH_CUST_CHARGES_RPT.xml

# *****************************************************************************
# End of program if there is no errors.
# *****************************************************************************
PRINT_EXIT_BANNER

# *****************************************************************************
#  End of Script
# *****************************************************************************

Acknowledgements

http://appswork.blogspot.co.uk/2009/10/xml-publisher-templatessamplecontrol.html

Comments