- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Output from the oracle database via shell scripts
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
тАО06-17-2002 10:47 PM
тАО06-17-2002 10:47 PM
On a daily basis i need some data from Oracle database, can i execute a shell script and get the same. As i don't know the format, if any1 can send me the same that will be fine.
eg:
customer table
sr_no, customer_ID, creation_date
Thanks in advance,
Regards,
!!! NAIK !!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2002 11:44 PM
тАО06-17-2002 11:44 PM
Solutionexport ORACLE_HOME=/.../...
export ORACLE_SID=XXX
su oracle -c $ORACLE_HOME/bin/sqlplus /nolog << EOF
connect / as sysdba ;
select sr_no, customer_ID, creation_date from customer_table ;
exit ;
EOF
Of course, you'll need to set ORACLE_HOME and ORACLE_SID correctly, and know the correct names for the tables and columns.
HTH
Duncan
I am an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2002 11:57 PM
тАО06-17-2002 11:57 PM
Re: Output from the oracle database via shell scripts
i need only to type the shell script at the command line. and it gets me the result.
so it means the sql stmt should be written into the shell script. correct me if 'm wrong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2002 12:01 AM
тАО06-18-2002 12:01 AM
Re: Output from the oracle database via shell scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2002 12:04 AM
тАО06-18-2002 12:04 AM
Re: Output from the oracle database via shell scripts
Duncans script seems to be fine. Simply put all these command lines into a text file, chmod u+x script_name after that. Then you call your script and it gives you the desired result.
Normally standard output for the script is your terminal, if desired, redirect the output to a file:
script_name >> /path_to_output_file
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2002 01:46 AM
тАО06-18-2002 01:46 AM
Re: Output from the oracle database via shell scripts
The script works but needed some changes.. which i made.. thanks again and following are the changes :
file : cust.sh
ORACLE_HOME=/u05/oracle/product/8.1.7
ORACLE_SID=testdb
su - oracle -c "$ORACLE_HOME/bin/sqlplus username/password" /nolog << EOF
spool /tmp/test1.log
select sr_no, customer_ID, creation_date
from customer;
spool off
exit;
EOF
Thanks again....
Regards,
!!! NAIK !!!