I am trying to create a script that checks the usage of each disk in an ASMDISK group. I have my script setup on one node in each RAC cluster. It works on several of the servers without issue, but on two of them it is returning the incorrect value.
In this case it is returning a value of 0 versus the expected value of 1.
# export ORACLE_HOME=/u01/app/oracle/product/188.8.131.52/db_1 # export ORACLE_SID=db1 # export PATH=$PATH:$ORACLE_HOME/bin # sqlplus ****/**** SQL*Plus: Release 184.108.40.206.0 Production on Tue Dec 6 18:57:13 2016 SQL> select count(*) from V$asm_disk_stat; COUNT(*) ---------- 0
When I run the exact same SQL from the oracle user account, but still using the same oracle db user, I get the correct result. DB_ENV source file has the exact same exports that were manually entered as the other user.
# su - oracle $ source db_env $ sqlplus ****/**** SQL*Plus: Release 220.127.116.11.0 Production on Tue Dec 6 19:07:18 2016 SQL> select count(*) from V$asm_disk_stat; COUNT(*) ---------- 1
I am not sure why this might be occurring. I have other scripts that use the exact same manner to connect and are able to get correct data from the oracle database.
As per roaima, I am explicitly stating the output:
when running as root:
# echo $PATH /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/dell/srvadmin/bin:/opt/dell/srvadmin/sbin:/etc/opt/emcpower/bin:/root/bin:/u01/app/oracle/product/18.104.22.168/db_1/bin:/u01/app/oracle/product/22.214.171.124/db_1/bin # echo $ORACLE_HOME /u01/app/oracle/product/126.96.36.199/db_1 echo $ORACLE_SID db1
When running as Oracle:
echo $PATH /u01/app/oracle/product/188.8.131.52/db_1/bin:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/dell/srvadmin/bin:/etc/opt/emcpower/bin:/home/oracle/bin echo $ORACLE_HOME /u01/app/oracle/product/184.108.40.206/db_1 echo $ORACLE_SID db1