且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

db2上的Bash脚本

更新时间:2022-12-08 14:34:26

让我们假设你的实例是db2inst1,然后你需要调用:

Let's suppose your instance is db2inst1, then you need to call:

. ~db2inst1/sqllib/db2profile

装入db2profile后,可以看到DB2INSTANCE环境的值变量。

Once the db2profile is loaded, you can see the value of the DB2INSTANCE environment variable.

检查环境是否正确加载的一种方法是检查是否设置了DB2INSTANCE。

One way to check if the environment is correctly loaded is to check if the DB2INSTANCE is set.

if [[ -z ${DB2INSTANCE} ]] ; then
   echo "ERROR"
   exit 1
fi

,1390是这个错误:

BTW, the 1390 is this error:

SQL1390C环境变量DB2INSTANCE未定义或
无效。

SQL1390C The environment variable DB2INSTANCE is not defined or is invalid.