I am facing one issue on Redhat 9.3.
When I run the commands via su -c, I am not able to see the expected result. It works fine after switching to the user directly.
[root@testbox07 tmp]# su - devusr1 -c "db2 connect to SPIKEDB; db2 UPDATE DB CFG USING MAXAPPLS AUTOMATIC;"
Database Connection Information
Database server = DB2/LINUXX8664 11.5.9.0
SQL authorization ID = DEVUSR1
Local database alias = SPIKEDB
SQL1024N A database connection does not exist. SQLSTATE=08003
[root@testbox07 tmp]#
[root@testbox07 tmp]# su - devusr1
Last login: Mon Jul 1 08:27:06 MDT 2024 on pts/0
[devusr1@testbox07 ~]$ db2 connect to SPIKEDB; db2 UPDATE DB CFG USING MAXAPPLS AUTOMATIC;
Database Connection Information
Database server = DB2/LINUXX8664 11.5.9.0
SQL authorization ID = DEVUSR1
Local database alias = SPIKEDB
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
[devusr1@testbox07 ~]$
I tried the same scenarios works fine on my Redhat 7 and 8 hosts.
[root@testbox05 tmp]# su - devusr1 -c "db2 connect to SPIKEDB; db2 UPDATE DB CFG USING MAXAPPLS AUTOMATIC;"
Database Connection Information
Database server = DB2/LINUXX8664 11.5.4.0
SQL authorization ID = DEVUSR1
Local database alias = SPIKEDB
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
[root@testbox05 tmp]#
This makes me confused about what happened to the su -c command on that Redhat 9.3 host.
Kindly advise.
Thanks
Boyka