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

From: Raza Siddiqui <raza.siddiqui_at_oracle.com>
Date: Mon, 7 Mar 2016 05:49:56 -0800
Message-Id: <980B44D7-A608-4CE5-9F85-9905067B3DD5_at_oracle.com>



Try SET TERM ON

Raza

On Mar 7, 2016, at 0:41, Nan Xiao <xiaonan830818_at_gmail.com> 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_at_sc.com> 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_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Nan Xiao
> Sent: Monday, March 07, 2016 4:08 PM
> To: oracle-l_at_freelists.org
> 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
>

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Mar 07 2016 - 14:49:56 CET

Original text of this message