Oracle

如何在 bash 腳本中引用 SQL*Plus 標識符?

  • July 3, 2020

無論我如何嘗試在以下命令中引用標識符,我都會得到 “ORA-00904: “MEMORY_TARGET”: invalid identifier”:

MEMORY_TARGET=$(su - orat01 -c " echo 'select VALUE from V\$PARAMETER where name = 'memory_target';'| sqlplus / as sysdba ")

任何關於如何做到這一點的想法將不勝感激。

[root@o73 ~]# SGA_TARGET=$(su - oracle -c "export ORACLE_SID=RYMIN19; export ORAENV_ASK=NO; . oraenv >/dev/null; echo \"set pages 0
select value from v\\\$parameter where name = 'sga_target';\" | sqlplus -s / as sysdba")
[root@o73 ~]# echo $SGA_TARGET
2147483648
[root@o73 ~]#

引用自:https://dba.stackexchange.com/questions/270307