RE: Trying to write a short script

From: Newman, Christopher <cjnewman_at_uillinois.edu>
Date: Thu, 22 Sep 2011 16:00:10 -0500
Message-ID: <3A3138F2D3E329459121B953867EE8ED0265BE236D45_at_ADMINMAIL12.ui.uillinois.edu>



Something like this?

#!/bin/ksh

export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=$1
export ORACLE_HOME=`/bin/grep $ORACLE_SID /var/opt/oracle/oratab|cut -f2 -d":"| head -1`
$ORACLE_HOME/bin/sqlplus -s / <<!
set heading off;
spool myfile.txt
select * from V\$VERSION;
exit;
!

Produces something like this:

Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Solaris: Version 11.1.0.7.0 - Production NLSRTL Version 11.1.0.7.0 - Production

-----Original Message-----

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Laurent, Vincent Sent: Thursday, September 22, 2011 3:43 PM To: oracle-l_at_freelists.org
Subject: Trying to write a short script

I am currently using Oracle 11.2.0.2 on HP-UX 11.31 I have a script that does this:

  # Get the path to the trace files
  DUMP=`/oracle/$ORACLE_SID/112_64/bin/sqlplus -s / as sysdba <<EOF   set head off
  set feedback off
  select * from v\\$version;
  exit
  EOF`
  echo $DUMP

but the output comes back like this (all wrapped as one line):

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production CORE 11.2.0.2.0 Production TNS for HPUX: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production

Instead of like this (each product it's own line):

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production CORE 11.2.0.2.0 Production
TNS for HPUX: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production

Ideas to fix?

Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
--

http://www.freelists.org/webpage/oracle-l

--

http://www.freelists.org/webpage/oracle-l Received on Thu Sep 22 2011 - 16:00:10 CDT

Original text of this message