【DB2學習】db2profile的指令碼
[root@yang sqllib]# cat db2profile
#############################################################################
#
# Licensed Materials - Property of IBM
#
# (C) COPYRIGHT International Business Machines Corp. 2009
#
# All Rights Reserved.
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
#############################################################################
#
# NAME: db2profile
#
# FUNCTION: This script. sets up a default database environment for
# Bourne shell or Korn shell users.
#
# USAGE: . db2profile
# This script. can either be invoked directly as above or
# it can be added to the user's .profile file so that the
# database environment is established during login.
#
# #### DO NOT EDIT THIS FILE ####
#
#############################################################################
DB2DIR=/opt/ibm/db2/V9.5
# Remember the current DB2INSTANCE environment variable
CUR_INSTNAME=${DB2INSTANCE:=""}
#-----------------------------------------------------------------------
# DB2INSTANCE [Default null, values: Any valid instance name]
# Specifies the instance that is active by default.
#-----------------------------------------------------------------------
DB2INSTANCE=db2inst1
export DB2INSTANCE
INSTHOME=/home/db2inst1
# Function to add or remove certain path to or from the specified
# environment variable.
AddRemoveString()
{
if [ $# -ne 3 ]; then
return 0
fi
var=$1 #The enviornment variable to be processed
addrm_str=$2 #The new path to be used
action=$3 #Action: a -> add, r -> remove
if [ "X${action?}" != "Xa" -a "X${action?}" != "Xr" ]; then
return 0 # return without doing anything
fi
awkval='$1 != "'${addrm_str?}'"{print $0}'
newval=`eval echo :-""} | awk '{for (i=1; i<= NF; ++i) \
if( $i != VAR && length($i) > 0 ) print $i":"}' FS=":" VAR=${addrm_str?}`
newval=`echo ${newval?} | sed 's/\: /\:/g'`
if [ "X${action?}" = "Xa" ]; then
newval=${newval?}"${addrm_str?}"
else
newval=`echo ${newval?} | sed 's/:$//'`
fi
eval $var=\"${newval?}\"
unset var addrm_str awkval newval
}
#----------------------------------------------------------------------------
# If DB2 instance environment is being switched from one instances to another,
# the entries for old DB2 instance in the original instance enviornment
# are cleaned up.
#----------------------------------------------------------------------------
if [ -n "${CUR_INSTNAME?}" ]; then
CUR_INSTHOME=`${INSTHOME?}/sqllib/bin/db2usrinf -d ${CUR_INSTNAME?}`
path_list="bin adm misc db2tss/bin"
class_list="java/db2java.zip java/db2jcc.jar java/sqlj.zip function \
java/db2jcc_license_cisuz.jar java/db2jcc_license_cu.jar \
java/runtime.zip"
for tmp_entry in ${path_list?}; do
AddRemoveString PATH ${CUR_INSTHOME?}/sqllib/${tmp_entry?} r
done
for tmp_entry in ${class_list?}; do
AddRemoveString CLASSPATH ${CUR_INSTHOME?}/sqllib/${tmp_entry?} r
done
for path_name in LD_LIBRARY_PATH LIBPATH SHLIB_PATH LD_LIBRARY_PATH_32 \
LD_LIBRARY_PATH_64; do
for tmp_path in lib lib32 lib64; do
AddRemoveString ${path_name?} ${CUR_INSTHOME?}/sqllib/${tmp_path?} r
done
done
for path_name in PATH CLASSPATH LD_LIBRARY_PATH LIBPATH SHLIB_PATH \
LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64; do
eval path_value=\$$path_name
if [ "X${path_value}" = "X" ]; then
unset ${path_name?}
else
export ${path_name?}
fi
done
unset CUR_INSTNAME path_list class_list tmp_entry path_name path_value
fi
#-----------------------------------------------------------------------------
# In DB2 instance environment, the DAS environment needs to be cleaned up.
#-----------------------------------------------------------------------------
DASWORKDIR=${DASWORKDIR:=""}
if [ "X${DASWORKDIR}" != "X" ]; then
AddRemoveString PATH ${DASWORKDIR?}/bin r
AddRemoveString PATH ${DASWORKDIR?}/adm r
for path_name in LIBPATH SHLIB_PATH LD_LIBRARY_PATH; do
for tmp_path in lib function; do
AddRemoveString ${path_name?} ${DASWORKDIR?}/${tmp_path?} r
done
done
for path_name in PATH LIBPATH SHLIB_PATH LD_LIBRARY_PATH; do
if [ "X${path_name}" = "X" ]; then
unset ${path_name?}
else
export ${path_name?}
fi
done
fi
#-----------------------------------------------------------------------------
for tmp_path in bin adm misc; do
AddRemoveString PATH ${INSTHOME?}/sqllib/${tmp_path?} a
done
if [ -d ${INSTHOME}/sqllib/db2tss/bin ]; then
AddRemoveString PATH ${INSTHOME}/sqllib/db2tss/bin a
fi
export PATH
unset tmp_path
#-----------------------------------------------------------------------
# UDB Extender initialization
#-----------------------------------------------------------------------
if [ -f ${INSTHOME}/dmb/dmbprofile ]; then
. ${INSTHOME}/dmb/dmbprofile
fi
#-----------------------------------------------------------------------
# The following variables are used for JDBC support
#-----------------------------------------------------------------------
CLASSPATH=${CLASSPATH:-""}
if [ -f ${INSTHOME?}/sqllib/java/db2java.zip ]; then
AddRemoveString CLASSPATH ${INSTHOME?}/sqllib/java/db2java.zip a
fi
if [ -f ${INSTHOME?}/sqllib/java/db2jcc.jar ]; then
AddRemoveString CLASSPATH ${INSTHOME?}/sqllib/java/db2jcc.jar a
fi
if [ -f ${INSTHOME?}/sqllib/java/sqlj.zip ]; then
AddRemoveString CLASSPATH ${INSTHOME?}/sqllib/java/sqlj.zip a
fi
if [ -d ${INSTHOME?}/sqllib/function ]; then
AddRemoveString CLASSPATH ${INSTHOME?}/sqllib/function a
fi
if [ -f ${INSTHOME?}/sqllib/java/db2jcc_license_cisuz.jar ]; then
AddRemoveString CLASSPATH ${INSTHOME?}/sqllib/java/db2jcc_license_cisuz.jar a
fi
if [ -f ${INSTHOME?}/sqllib/java/db2jcc_license_cu.jar ]; then
AddRemoveString CLASSPATH ${INSTHOME?}/sqllib/java/db2jcc_license_cu.jar a
fi
AddRemoveString CLASSPATH . a
export CLASSPATH
LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-""}
AddRemoveString LD_LIBRARY_PATH ${INSTHOME?}/sqllib/lib32 a
export LD_LIBRARY_PATH
#--------------------------------------------------------------------------
# Any user changes to the environment goes into userprofile. Modifications
# to db2profile may be overwritten in fixpaks.
#--------------------------------------------------------------------------
if [ -f ${INSTHOME?}/sqllib/userprofile ]; then
. ${INSTHOME?}/sqllib/userprofile
fi
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-672269/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 指令碼學習指令碼
- Per指令碼學習指令碼
- ASM 學習 指令碼ASM指令碼
- 常用指令碼學習手冊——Bat指令碼指令碼BAT
- 《Shell指令碼學習指南》學習筆記指令碼筆記
- db2巡檢小指令碼DB2指令碼
- DB2多次抓取快照指令碼DB2指令碼
- Shell指令碼學習筆記指令碼筆記
- 學習Ant編譯指令碼編譯指令碼
- awk指令碼學習小結指令碼
- DB2的一些管理用指令碼DB2指令碼
- shell指令碼學習筆記-1指令碼筆記
- redis命令之-script指令碼學習Redis指令碼
- shell和bash指令碼命令學習指令碼
- db2 如何模擬indobt transactions 用到的指令碼DB2指令碼
- DB2日常監控指令碼DB2指令碼
- 監控DB2資料庫指令碼DB2資料庫指令碼
- db2學習筆記DB2筆記
- db2入門學習DB2
- Linux命令和shell指令碼學習Linux指令碼
- Elsa V3學習之指令碼指令碼
- 學習-【前端】-伺服器指令碼書寫前端伺服器指令碼
- jmeter學習指南之最佳化指令碼JMeter指令碼
- 【學習】Linux Shell指令碼程式設計Linux指令碼程式設計
- Linux學習之路(三)Shell指令碼初探Linux指令碼
- 【黑客基礎】Windows PowerShell 指令碼學習(上)黑客Windows指令碼
- 官方遊戲--學習筆記二(英雄指令碼)遊戲筆記指令碼
- python學習-判斷閏年指令碼Python指令碼
- DB2資料提取轉化的一個指令碼KCDB2指令碼
- DB2批量執行SQL指令碼的實現DB2SQL指令碼
- 【DB2學習】使用reorgchk 收集表的資訊DB2GC
- Bootstrap 之 Metronic 模板的學習之路 – (4)原始碼分析之指令碼部分boot原始碼指令碼
- ass109.awk指令碼學習使用指令碼
- linux學習day3——shell指令碼上Linux指令碼
- linux學習day4——shell指令碼中Linux指令碼
- 初學指令碼指令碼
- JSP指令學習JS
- Oauth的學習以及開發自助上課簽到指令碼OAuth指令碼