I have a server with two instances running on it (a dev environment) where we use one login to access either instance. I wanted to be able to switch context from one instance to the other without changing my .profile to reference the other instance's db2profile, logging out and back in. I wrote a script (iswap) to allow me to do that. Here's what it looks like:
if [[ $DB2INSTANCE = "instance1" ]] then . /usr/users/instance2/sqllib/db2profile echo "Switched context from instance1 to instance2" elif [[ $DB2INSTANCE = "instance2" ]] then . /usr/users/instance1/sqllib/db2profile echo "Switched context from instance2 to instance1" fi
If I do a "db2 list db directory" after running iswap it shows me the databases in the new instance. If I echo $DB2INSTANCE it reflects the new instance. But, if I do a "db2 list applications" it still shows me the applications connected to the original instance. What am I not changing that I need to add to the script?