- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Shell Script
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
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
тАО05-19-2003 12:29 PM
тАО05-19-2003 12:29 PM
Shell Script
Oracle script
.
.
Sqlplus <..> @mysql.sql
How can i check whther this SQL statement has been executed successfully ?
Inside my .sql file i have given "Whenever SQL error
Rollback and EXIT".
How can i know whether the SQL statement was successfull or rollbacked due to some SQL error?
if [ $? = 0 ]
Will this work for SQL Statements ?
Help !!!
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-19-2003 12:34 PM
тАО05-19-2003 12:34 PM
Re: Shell Script
test 'your commands'.
I.E.
if [ test 'mystuff.sh' ] ; then
echo "It worked"
else
echo "it failed ;("
fi
you can also use the return value from the command.
ls /tmp
RETVAL=$?
if the return value is 0, then the command succeeded, if non 0, it failed..
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-19-2003 12:44 PM
тАО05-19-2003 12:44 PM
Re: Shell Script
You really have to do much more to get meaningful error codes. The typical approach is to add a spool filexxx command and then use grep/awk/perl to examine the spool file after sqlplus has completed. Moreover, because the same command might be run more than once at the same time, the better method is to have your shell script build your SQL script "on the fly" and create PID dependent temporary spool file names to avoid pathname collisions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-19-2003 12:45 PM
тАО05-19-2003 12:45 PM
Re: Shell Script
I have a shell script from which i'm calling a
Oracle script
.
.
Sqlplus <..> @mysql.sql
How can i check whther this SQL statement has been executed successfully ?
Inside my .sql file i have given "Whenever SQL error
Rollback and EXIT".
How can i know whether the SQL statement was successfull or rollbacked due to some SQL error?
if [ $? = 0 ]
This works fine for Unix commands , but Will this work for SQL Statements also ?
Help !!!
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-19-2003 04:16 PM
тАО05-19-2003 04:16 PM
Re: Shell Script
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-20-2003 12:16 AM
тАО05-20-2003 12:16 AM
Re: Shell Script
Another option that might work for you would be to redirect sqlplus's output.
Like:
#!/bin/ksh
sqlplus -s scott/tiger <
@test
exit
STOP
then do a grep looking for errors!
grep -i "ora" test.lst |mailx
or analyze the file using any method you want.
Hope this helps!
regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-20-2003 01:42 AM
тАО05-20-2003 01:42 AM
Re: Shell Script
another hint is to change the sql,
from
whenever sql error rollback and exit ;
to whenever sql error goto do_something;
and the procedure
do_something:
- signal the error
- rollback
- exit
HTH, Massimo