2016-03-02 79 views
0

我有一個shell腳本,我正在執行它來部署PL/SQL對象。在環境中的包/表腳本。在shell腳本中觸發UNIX序列

現在雖然insert_fields.sql之後執行sh XX_OBJECT.sh膩子執行我得到順序輸出一樣,當我執行sh XX_OBJECT.sh

#!/usr/bin/sh 
# Parameters to be accepted from command prompt 
# Parameter 1 = Apps username/Password 
# Parameter 2 = BOLINF username/Password 
# Parameter 3 = Host name for the instance 
# Parameter 4 = Port Number for the instance 
# Parameter 5 = DB Name for the instance 


#APPS_USER="$1" 
#BOLINF_USER="$2" 
#HOST_NAME="$3" 
#PORT_NUMBER="$4" 
#DB_NAME="$5" 

LOGFILE=XXHCM_STAG`date +%Y-%m-%d-%H:%M:%S`.log 
LOG_PATH=`echo $CUR_DIR/$LOG_FILE` 

#APPS_USERNAME=$(echo $APPS_USER|cut -f "1" -d /) 
#APPS_PWD=$(echo $APPS_USER|cut -f "2" -d /) 

#- 
#- reading program parameters 
#- 

echo "Enter APPS User: " 

read APPS 

echo "Enter APPS Password: " 

stty -echo 

read APPS_PWD 

stty echo 


echo "Enter Install Server (SID): " 

read SID 



APPS_USER="$APPS/[email protected]$SID" 


APPS_USERNAME=$(echo $APPS_USER|cut -f "1" -d /) 

APPS_PWD=$(echo $APPS_USER|cut -f "2" -d /) 


echo "Starting installation of XXHCM_OBJECTS - XXHCM_OBJECTS ..." 
echo "Starting installation of XXHCM_OBJECTS - XXHCM_OBJECTS ..." "">>$LOGFILE 
echo "">>$LOGFILE 

echo "">>$LOGFILE 
echo "Copying Files To Appropriate Directories ..." 
echo "Copying Files To Appropriate Directories ..." "">>$LOGFILE 
echo "">>$LOGFILE 

cp *.ldt $XXHCM_TOP/install 

cp *.sql $XXHCM_TOP/sql 

cp *.pks $XXHCM_TOP/sql 

cp *.pkb $XXHCM_TOP/sql 

cp *.ctl $XXHCM_TOP/bin 

cp *.prog $XXHCM_TOP/bin 

echo "">>$LOGFILE 


echo "">>$LOGFILE 
echo "Files copied successfully !!! " 
echo "Files copied successfully !!! " "">>$LOGFILE 
echo "">>$LOGFILE 

echo "Changing permissions ... "  "">>$LOGFILE 
chmod 777 *.* 
echo "Changed permissions ... "  "">>$LOGFILE 

echo "">>$LOGFILE 
echo "Creating Custom Package, Synonyms and Grants..." "">>$LOGFILE 
echo "Creating Custom Package, Synonyms and Grants..." 
echo "">>$LOGFILE 

if sqlplus $APPS_USER @I_table_creation.sql 
then 
    echo "Custom itables created successfully in APPS schema"  "">>$LOGFILE 
    echo "Custom itables created successfully in APPS schema" 
else 
    echo "Error in creating custom itables in APPS schema"  "">>$LOGFILE 
    echo "Error in creating Custom itables in APPS schema" 
fi 

if sqlplus $APPS_USER @insert_entities.sql 
then 
    echo "Insert data into entities table in APPS schema"  "">>$LOGFILE 
    echo "Insert data into entities table in APPS schema" 
else 
    echo "Error in Insert data into entities table in APPS schema"  "">>$LOGFILE 
    echo "Error in Insert data into entities table in APPS schema" 
fi 

if sqlplus $APPS_USER @insert_fields.sql 
then 
    echo "Insert data into insert_fields table in APPS schema"  "">>$LOGFILE 
    echo "Insert data into insert_fields table in APPS schema" 
else 
    echo "Error in Insert data into insert_fields table in APPS schema"  "">>$LOGFILE 
    echo "Error in Insert data into insert_fields table in APPS schema" 
fi 


if sqlplus $APPS_USER @xx_cmp_thread.pks 
then 
    echo "Package specification for package xx_cmp_thread created in APPS schema"  "">>$LOGFILE 
    echo "Package specification for package xx_cmp_thread created in APPS schema" 
else 
    echo "Error in creating Package specification"  "">>$LOGFILE 
    echo "Error in creating Package specification" 
fi 

if sqlplus $APPS_USER @xx_cmp_thread.pkb 
then 
    echo "Package specification for package xx_cmp_thread created in APPS schema"  "">>$LOGFILE 
    echo "Package specification for package xx_cmp_thread created in APPS schema" 
else 
    echo "Error in creating Package specification"  "">>$LOGFILE 
    echo "Error in creating Package specification" 
fi 
echo "">>$LOGFILE 
echo "Package, Synonyms,grants and Tables created successfully" "">>$LOGFILE 
echo "Package, Synonyms,grants and Tables created successfully" 
echo "">>$LOGFILE 


echo "Installation completed for XXHCM_OBJECTS - XXHCM_OBJECTS" 
echo "Installation completed for XXHCM_OBJECTS - XXHCM_OBJECTS"  "">>$LOGFILE 
# ***************************************************************************** 
# End of Script 
# ***************************************************************************** 

29 
30 
31 
32 
34 

不知道爲什麼是序列越來越無所適從

+0

那麼,它必須是來自insert_entities.sql或insert_fields.sql的東西。這些是什麼樣的? –

+0

@ JeffY-這些是改變腳本。我刪除了這些仍然得到這個序列 –

回答

1

我以前見過類似的東西,當你不離開你的時候SQL腳本正確。我相信他們是輸出sqlplus.You最有可能想確保你在你的腳本的末尾正確的退出聲明,看起來像只是行號:

exit 
/
+0

謝謝!這絕對有效! :) –