- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to get std output from sqlplus ?
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
тАО04-02-2003 11:07 PM
тАО04-02-2003 11:07 PM
it doesn't print anything on the std output
Any ideas on how can i achive this ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-02-2003 11:20 PM
тАО04-02-2003 11:20 PM
Solution1. The way that you are doing it should send out something. I tried it for 9i on HP-UX 11.0 and it worked the way that I would expect
2. Something like the following:
echo "select * from user_tables;
exit;" > temp.sql
sqlplus scott/tiger @temp.sql
3. Something like the following:
sqlplus scott/tiger <
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-02-2003 11:42 PM
тАО04-02-2003 11:42 PM
Re: how to get std output from sqlplus ?
I was forgotten about sqlplus scott/tiger @script.sql
Something without creating any script file ( tee is something platform dependent )?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2003 12:32 AM
тАО04-03-2003 12:32 AM
Re: how to get std output from sqlplus ?
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2003 01:01 AM
тАО04-03-2003 01:01 AM
Re: how to get std output from sqlplus ?
sqlplus scott/tiger@sid @sql
and i need to fill this sql file with the proper command that i want to execute.
This wil work on any platform that Oracle Client sqlplus is instaled
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2003 05:36 AM
тАО04-04-2003 05:36 AM
Re: how to get std output from sqlplus ?
sqlplus -s scott/tiger @foo.sql >myStdOutput.txt
The -s is for silent and surpresses the boring version and other information that you may not care to have in your output file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2003 11:51 PM
тАО04-04-2003 11:51 PM
Re: how to get std output from sqlplus ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2003 12:41 AM
тАО04-05-2003 12:41 AM
Re: how to get std output from sqlplus ?
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2003 12:47 AM
тАО04-15-2003 12:47 AM
Re: how to get std output from sqlplus ?
Use the EOF.
The following example is a script I use to connect to the database, spool a file then run the file. It is executed by cron.
------------------------------
#set environment variables
ORACLE_HOME=/oracle/product/8.1.7; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH; export PATH
USERID=XXX
PASSWORD=YYY
SID=ZZZ
# logon to oracle
$ORACLE_HOME/bin/sqlplus $USERID/$PASSWORD@$SID << EOF
set head off
set line 200
set pagesize 1000
set arraysize 1
SELECT 'alter tablespace '||tablespace_name||' BEGIN BACKUP;'
FROM dba_tablespaces
spool /tmp/BEGIN_BACKUP.sql
/
spool off
spool /tmp/BEGIN_BACKUP.log
@/tmp/BEGIN_BACKUP.sql
spool off
EOF
#after the oracle stuff then the shell script continues
lp -dPrinter /tmp/BEGIN_BACKUP.log
# and then maybe more oracle stuff
$ORACLE_HOME/bin/sqlplus $USERID/$PASSWORD@$SID << EOF
set head off
set line 200
set pagesize 1000
set arraysize 1
SELECT 'alter tablespace '||tablespace_name||' END BACKUP;'
FROM dba_tablespaces
spool /tmp/END_BACKUP.sql
/
spool off
spool /tmp/END_BACKUP.log
@/tmp/END_BACKUP.sql
spool off
EOF
# etc etc etc
------------------------------
Notice the use of "EOF". This will cause a return to the shell script. Using this format keeps everything in one shell script and visible, not in multiple seperate .sql files. Also the .sql files produced are completely temporary.
Rod
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2003 08:41 AM
тАО04-16-2003 08:41 AM
Re: how to get std output from sqlplus ?
SQLTASK=`select (your complete select statement including ; and all`
DOIT=$(echo ${SQLTASK} | sqlplus uname/passwd@wheteve.com)
echo ${DOIT} | tee -a $OUTFILE