不显示 SQLPLUS 提示

Not to display SQLPLUS prompt

我正在尝试使用 bash 脚本连接 sqlplus。当我执行下面的脚本时,显示了 SQLPLUS 横幅。

脚本下方:

$ORACLE_HOME/bin/sqlplus "/ as sysdba" <<EOF
  set echo off
  set heading off
  spool bind.txt
  select * from DBMS_LOCK_ALLOCATED where name = '$uservar';
  spool off
  exit
EOF

脚本输出

oracle@DMOTA01:~/script> ./before_bind.sh

SQL*Plus: Release 11.2.0.3.0 Production on Wed Nov 27 11:54:01 2019

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SQL>   2    3    4  Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@DMOTA01:~/script>

我不想显示 "SQL*Plus: Release 11............. Real Application Testing options" 行。我该怎么做?

您需要将-S添加到sqlplus以将其切换为静音模式:

$ORACLE_HOME/bin/sqlplus -S "/ as sysdba" <<EOF
  set echo off
  set heading off
  spool bind.txt
  select * from DBMS_LOCK_ALLOCATED where name = '$uservar';
  spool off
  exit
EOF