当前位置: 代码迷 >> DB2 >> list tablespace list containers questions解决思路
  详细解决方案

list tablespace list containers questions解决思路

热度:8339   发布时间:2013-02-26 00:00:00.0
list tablespace list containers questions
OutFile="outFile"HisgestReturnCode=0# List all of the tablespaces so that all of the containers can be identified.#db2 list tablespaces > ${OutFile}.tablespacesReturnCode=$?if [ "$ReturnCode" -gt "$HighestReturnCode" ]thenecho "db2 list tablespaces failed. Return Code = $ReturnCode" | tee -a $OutFileexitfiif [ -f ${OutFile}.containers ]then rm ${OutFile}.containersfi## List all of the tablespace containers so that all of the # paths and files can be identified.#grep "Tablespace ID" ${OutFile}.tablespaces | while read x1 x2 x3 tblspiddodb2 list tablespace containers for $tblspid show detail >> ${OutFile}.containersReturnCode=$?if [ "$ReturnCode" -gt "$HighestReturnCode" ]thenecho "db2 list tablespace containers for $tblspid show detail Return Code = $ReturnCode" | tee -a ${OutFile}exitfidoneReturnCode=$?if [ "$ReturnCode" -gt "$HighestReturnCode" ]thenecho "grep Tablespace ID ${OutFile} failed. Return Code = $ReturnCode" | tee -a $OutFileexitfi
网上找的关于数据库恢复重定向的脚本,然后我从脚本里取了一段修改了一下,保存为test.sh 。用来list containers的。
我先db2 connect to mydb 
然后再执行test.sh
但在list tablespace 时出错,说数据库连接不存在。然后我在脚本前加上 db2 connect to mydb
list tablaspace成功了,但list containers 时又报错说数据库连接不存在。
这到底是怎么回事呢?
网上找的那些脚本是ksh来的,但我保存为test.ksh情况一样。

------解决方案--------------------------------------------------------
看来是每次都需要重新connect,我没有这样写过,每次都是只执行一个功能,一次执行多个脚本。
  相关解决方案