I have a script to activate all DB2 databases under db2inst1 and db2inst2 profiles

The script:

source rmdb/db2inst2/sqllib/db2profile


for d in "${DB[@]}"
rmdb/db2inst2/sqllib/bin/db2 activate db "$d"


libdb/db2inst2/sqllib/bin/db2 activate db ICMNLSDB

The script is placed under the /rmdb/db2inst2 path and it's working fine for all the databases under db2inst2 while for the database under db2inst1 it gives the below error:

SQL1092N "DB2INST2" does not have the authority to perform the requested command or operation.


Although you could solve the problem by making sure that the db2inst2 ID has sufficient privileges for the db2inst1 instance, it would be less confusing to use a different script for each instance and run the script as each instance owner.


Following what Ian tells you, a dynamic script could be more interesting:


source ~${INST_USER}/sqllib/db2profile
for i in $(db2 list db directory | awk '/Database name/ {print $4}') ; do
  db2 activate db to $i

You call this script by issuing the following, from a user session that has privileges in both instances (sysmaint, sysctrl or sysadm):

activateDBs db2inst1
activateDBs db2inst2


Activate - https://www.ibm.com/support/knowledgecenter/es/SSEPGG_11.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0002038.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.