- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: sqlplus ksh strange problem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2010 02:04 PM
тАО08-20-2010 02:04 PM
sqlplus ksh strange problem
I'm doing this:
spout=`$ORACLE_HOME/bin/sqlplus /nolog << EOF
set echo off feedb off
SET PAGESIZE 80
SET LINESIZE 190
connect / as sysdba
/
select version from v$instance;
exit success
EOF`
Now if do
echo $spout
I have this:
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Aug 20 17:53:31 2010 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. SQL> SQL> SQL> SQL> Conne
cted. SQL> SP2-0103: Nothing in SQL buffer to run. SQL> select version from v SR28132.log aa.sql afiedt.buf automation cbarba dje.tmp echin imports li
st_unix_space_gb.ksh mbox mholkar rename_files.sh setup_ede shortcuts.sh smit.log smit.script smit.transaction sqlnet.log sqlplus timezone ERROR at li
ne 1: ORA-00942: table or view does not exist SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With
the Partitioning, Data Mining and Real Application Testing options
!!!
I suppose that some output characters like * are expanded by OS.
Hos to eliminate this bad behaviour ?
Bests Regards
Den
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2010 03:01 PM
тАО08-20-2010 03:01 PM
Re: sqlplus ksh strange problem
I have find a workaround. In fact the $instance (particulary the $) is a problem here.
I have replaced with that:
spout=`$ORACLE_HOME/bin/sqlplus -s /nolog << EOF
set echo off feedb off
SET PAGESIZE 80
SET LINESIZE 190
connect / as sysdba
select property_value from database_properties where property_name ='NLS_RDBMS_VERSION';
exit success
EOF`
Thats's work now but I'm not entirely satisfied.
Have a nice week-end Guys
Den
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2010 03:38 PM
тАО08-20-2010 03:38 PM
Re: sqlplus ksh strange problem
> * are expanded by OS.
Where is the "*"?
> select version from v$instance;
I'd expect the shell (not the OS) to expand
$instance
here, but I don't know what value that might
have. If you were trying to specify a
literal "v$instance" there, then you might
try quoting or escaping "$" appropriately,
like, for example:
select version from v\$instance;
What were you expecting to do there?
Using "bash", for example:
alp$ echo $HOME
/ALP$DKA0/SMS
alp$ cat hd.sh
#!/bin/sh
cat <
\$HOME
EOF
alp$
alp$ ./hd.sh
/ALP$DKA0/SMS
$HOME
alp$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2010 05:18 PM
тАО08-20-2010 05:18 PM
Re: sqlplus ksh strange problem
Yes, here documents are expanded by the shell.
>How to eliminate this bad behaviour?
Besides quoting each "$", etc as Steven mentions, you can quote the EOF word:
spout=`$ORACLE_HOME/bin/sqlplus /nolog <<\EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2010 05:16 AM
тАО08-23-2010 05:16 AM
Re: sqlplus ksh strange problem
If you are using the ksh shell, you can check what gets expanded. You only need to set the shell variables "verbose" and "xtrace".
# set -vx
# echo $0
echo $0 # this line is the command you issued - verbose mode
+ echo -ksh # this line is the command after the shell expansions - xtrace
-ksh # this is the output
#
Regards,
Viktor
Unix operates with beer.