Shell Script to Migrate our Technical Components during Migration

Shell Script
to migrate all technical components in a single step
The
below query will help us to migrate all the components from one instance to
another instance.
Basically
we need to the below steps before executing the Shell script which is defined
as Reusable component.
  1. Create all the LDT
    Files for the concurrent programs, data definition
  2. Copy the DB
    Objects/LDT Files/Form Personalization or any scripts which we are going
    to migrate in UNIX Server.
  3. Create directory as
    in the shell script in the server so that it will pick the objects and
    execute from the server
  4. Execute the below shell
    script.
  5. It will prompt for
    Custom Schema and Database Schema(APPS)
  6. Once provided it will
    execute all the scripts one by one
#=======================================================================
#                                                                                                                     
#
MODULE NAME : MIG_SCR.sh                                                             
#
DESCRIPTION : This script is used to register DB Objects/Reports Concurrent
Program/Data Definition
#         
#                                                                                                                     
#
Change Record:                                                                              
#
=============                                                                                                   
#
VERSION    DATE             AUTHOR(S)           Remarks                         
#
========   ============     ===============     ============                                 
#                     
#===============================================================================+           
CURRDIR=`’pwd’`
#——————————————————————————-+
#
Database Login Check Function                                                                              |
#——————————————————————————-+
DBLOGINCHECK(){
           
            oradata=`sqlplus -s <<-EOI
                                                $1
                                                set
echo off;
                                                set
feedback off;
                                                set
verify off;
                                                whenever
oserror exit failure;
                                                whenever
sqlerror exit failure;
                                                select
sysdate from dual;
                                                exit;
                                                EOI`
            sqlerr=$?
            if [ $sqlerr -ne 0 ]; then
                        echo “N”
            else
                        if ! [
“$oradata” ]; then
                                    echo
“N”
                        else
                                    echo
“Y”
                        fi
            fi
}
custlogin=”$1″
#——————————————————————————-+
#
Checking the Csutom Schema  Login details
                                                                     |
#——————————————————————————-+
while
[ “$custlogin” = “” -o `DBLOGINCHECK
“$custlogin”` = “N” ]
do
    if [ “$custlogin” = “”
];then
            echo “Enter Custom Schema
Login Userid/Passwd : “
            read custlogin
    else
        echo “XXCUST Login Userid and
Password entered is not CORRECT”
        custlogin=””
    fi
done
echo
“XXCUST Connection Successful”
dblogin=”$1″
#——————————————————————————-+
#
Checking the APPS  Login details                                                               |
#——————————————————————————-+
while
[ “$dblogin” = “” -o `DBLOGINCHECK “$dblogin”` =
“N” ]
do
    if [ “$dblogin” = “”
];then
            echo “Enter APPS Login
Userid/Passwd : c”
            read dblogin
    else
        echo “APPS Login Userid and
Password entered is not CORRECT”
        dblogin=””
    fi
done
echo
“APPS Connection Successful”
#——————————————————————————-+
# DB
Objects Creation            -View                                      |
#——————————————————————————-+
if
sqlplus -s $dblogin @$CURRDIR/View/XX_AP_UNAPP_VIEW.sql $dblogin
then
    echo “XX_AP_UNAPP_VIEW View Creation
is successful ”   
else
    echo “XX_AP_UNAPP_VIEW View Creation
is not successful”
    echo “In the Login id: $dblogin”
    echo “Please check and rerun”
    echo “Aborting……”
    exit 1
fi
#——————————————————————————-+
#
Package Creation                                                     |
#——————————————————————————-+
if
sqlplus -s $custlogin @$CURRDIR/Package/PackageSpecification/XX_FIN_REP_PKG.pks
$custlogin
then
    echo “XX_FIN_REP_PKG.pks Package Spec
Creation is successful ”   
else
    echo “XX_FIN_REP_PKG.pks Package
creation is not successful”
    echo “In the Login id: $dblogin”
    echo “Please check and rerun”
    echo “Aborting……”
    exit 1
fi
if
sqlplus -s $custlogin @$CURRDIR/Package/PackageBody/XX_FIN_REP_PKG.pkb $custlogin
then
    echo “XX_FIN_REP_PKG.pkb Package Body
Creation is successful ”   
else
    echo “XX_FIN_REP_PKG.pkb Package Body
creation is not successful”
    echo “In the Login id: $dblogin”
    echo “Please check and rerun”
    echo “Aborting……”
    exit
1
fi
#——————————————————————————-+
#
Sample Step to create Concurrent program                        
#——————————————————————————-+
echo
“Starting upload of Concurrent definitions for BR Report”
if
FNDLOAD $dblogin 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct
./LDTFiles/Reports/XXBRREP_CP.ldt – WARNING=YES UPLOAD_MODE=REPLACE
CUSTOM_MODE=FORCE 
then
   echo
   echo “Successfully uploaded concurrent
program definition for:  BR Report”
   echo
else
   echo
   echo “Failed while uploading the
concurrent program definition for:  BR
Report”
   echo
fi
#——————————————————————————-+
# Upload
all the Data Definition and Templates                                                         |
#——————————————————————————-+
echo
“Starting upload of Data Definition and Template”
if
FNDLOAD $dblogin 0 Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct
./LDTFiles/DataDefn/XX_CUSTOM_TAXPRNDEF.ldt
then
   echo
   echo “Successfully uploaded Data
Definition and Template for:  Tax  Report “
   echo
else
   echo
   echo “Failed while uploading the Data
Definition and Template for:  Tax
Report”
   echo
fi
#——————————————————————————-+
#
Upload Function                                          |
#——————————————————————————-+
if
sqlplus -s $custlogin @$CURRDIR/Function/XX_AMOUNT_TO_WORDS.fnc $custlogin
then
    echo “Function creation is successful
”   
else
    echo “Function creation is not
successful”
    echo “In the Login id: $dblogin”
    echo “Please check and rerun”
    echo
“Aborting……”
    exit 1
fi
#——————————————————————————-+
#
Execute DB Objects                                     |
#——————————————————————————-+
if
sqlplus -s $custlogin @$CURRDIR/DBObjects/XX_TABLE.sql $custlogin
then
    echo “Table creation is successful
”   
else
    echo “Table creation is not
successful”
    echo “In the Login id: $dblogin”
    echo “Please check and rerun”
    echo “Aborting……”
    exit 1
fi
#——————————————————————————-+
#
Upload Procedure                            |
#——————————————————————————-+
if
sqlplus -s $custlogin @$CURRDIR/Procedure/XX_PROC.prc $custlogin
then
    echo “Procedure creation is successful
”   
else
    echo “Procedure creation is not
successful”
    echo “In the Login id: $dblogin”
    echo “Please check and rerun”
    echo “Aborting……”
    exit 1
fi
#——————————————————————————-+
#
Grants                                                    
                                                     |
#——————————————————————————-+
if
sqlplus -s $custlogin @$CURRDIR/Grants/grants.sql $custlogin
then
    echo “grants is successful ”   
else
    echo “grants is not successful”
    echo “In the Login id: $dblogin”
    echo “Please check and rerun”
    echo “Aborting……”
    exit 1
fi
#——————————————————————————-+
#
Synonyms                                                  
                                                 |
#——————————————————————————-+
if
sqlplus -s $dblogin @$CURRDIR/Synonyms/synonym.sql $dblogin
then
    echo “Synonyms is successful
”   
else
    echo “Synonyms  is not successful”
    echo “In the Login id: $dblogin”
    echo “Please check and rerun”
    echo “Aborting……”
    exit 1

fi
Sheeba Satish
  • October 3, 2016 | 17 views
  • Comments