Re: Why doesn't output display SQL statement when using sqlplus in bash script?

  • From: Raza Siddiqui <raza.siddiqui@xxxxxxxxxx>
  • To: "xiaonan830818@xxxxxxxxx" <xiaonan830818@xxxxxxxxx>
  • Date: Mon, 7 Mar 2016 05:49:56 -0800

Try SET TERM ON

Raza

On Mar 7, 2016, at 0:41, Nan Xiao <xiaonan830818@xxxxxxxxx> wrote:

Hi Hermant,

I modify my script as this:  

#!/bin/bash

sqlplus / as sysdba <<EOF
set echo on;
select group#,members,bytes/1024/1024,status from v\$log;
exit
EOF

But it still doesn't output the SQL statement, just more "SQL>":

$ ./test.sh

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 7 03:35:46 2016

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing 
options

SQL> SQL>
    GROUP#    MEMBERS BYTES/1024/1024 STATUS
---------- ---------- --------------- ----------------
         1          1          102400 CURRENT
         3          1          102400 UNUSED
         2          1          102400 INACTIVE

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 
12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing 
options



Best Regards
Nan Xiao

On Mon, Mar 7, 2016 at 4:21 PM, Chitale, Hemant K <Hemant-K.Chitale@xxxxxx> 
wrote:
When using a script (instead of interactive SQLPlus session) you must add SET 
ECHO ON at the beginning.

 

Hemant K Chitale

 

 

From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On ;
Behalf Of Nan Xiao
Sent: Monday, March 07, 2016 4:08 PM
To: oracle-l@xxxxxxxxxxxxx
Subject: Why doesn't output display SQL statement when using sqlplus in bash 
script?

 

Hi all,

 

I am writing a Bash script which using sqlplus to connect Oracle database:  

 

#!/bin/bash

 

sqlplus / as sysdba <<EOF

select group#,members,bytes/1024/1024,status from v\$log;

exit

EOF

 

Executing it, the output is:  

 

$ ./test.sh

 

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 7 02:57:57 2016

 

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

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing 
options

 

SQL>

    GROUP#    MEMBERS BYTES/1024/1024 STATUS

---------- ---------- --------------- ----------------

         1          1          102400 CURRENT

         3          1          102400 UNUSED

         2          1          102400 INACTIVE

 

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 
12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing 
options

 

The SQL statement runs successfully. But I am curious about why the statement 
doesn't display in output: There

is empty after `SQL> `.

 

Best Regards

Nan Xiao


This email and any attachments are confidential and may also be privileged. 
If you are not the intended recipient, please delete all copies and notify 
the sender immediately. You may wish to refer to the incorporation details of 
Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at 
https://www.sc.com/en/incorporation-details.html

Other related posts: