- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- HP-UX script hangs when SQLPLUS login to Oracle fa...
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
Forums
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
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
тАО11-21-2003 03:13 AM
тАО11-21-2003 03:13 AM
HP-UX script hangs when SQLPLUS login to Oracle fails
In my unix scripts I use SQL*Plus to do some activities in Oracle. If the login in Oracle fails (wrong password, instance not available, ...) SQL*Plus waits for you to enter a valid login. In batch this means that the unix-script waits indefinite.
System HP-UX 11.0 and Oracle 8.1.7.4
Statement:
sqlplus -S user/wrongpasswd@instance @some.sql
I would like SQL*Plus to exit after a wrong login with a returncode<>0. As the SQL*Plus manual states in Chapter 6.
Who knows a solution.
THX,
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2003 03:20 AM
тАО11-21-2003 03:20 AM
Re: HP-UX script hangs when SQLPLUS login to Oracle fails
"sleep 10 && kill $$ &"
And then just after your sql command
"kill $!"
I'm sure there's a neater way but this is more fun!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2003 08:28 AM
тАО11-21-2003 08:28 AM
Re: HP-UX script hangs when SQLPLUS login to Oracle fails
There is no straight way to do this unless the database is 9.2, where sqlplus -L does exactly what you asked for.
In 8.1.7.x, perhaps you can first connect to sqlplus like sqlplus /nolog (this doesn't require any username or password), then from idle prompt try connecting to the database with username/password@connectstring. If that fails, exit which is easy to trap.
-
hth,
-Stan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-23-2003 07:42 PM
тАО11-23-2003 07:42 PM
Re: HP-UX script hangs when SQLPLUS login to Oracle fails
Combine this with whenever sqlerror to achieve your desired effect.
Here is a fragment from my session:
--
# sqlplus /nolog
SQL*Plus: Release 9.2.0.4.0 - Production on Mon Nov 24 08:38:04 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> whenever sqlerror exit 99
SQL> conn ice/xxx
ERROR:
ORA-01017: invalid username/password; logon denied
sedling:/home/u263478> echo $?
99
--
And by the way, sqlplus user/pass on the same line is very insecure, because anyone running "ps -ef|grep sqlplus" will see the full command line including the password.
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-23-2003 09:00 PM
тАО11-23-2003 09:00 PM
Re: HP-UX script hangs when SQLPLUS login to Oracle fails
#!/bin/sh
cat <
select * from cat;
exit
EOF
echo With correct pwd
sqlplus -S <
@/tmp/1.sql
EOF
echo Error:$?
echo With wrong pwd
sqlplus -S <
@/tmp/1.sql
EOF
echo Error:$?
It doesn't hang, because the lines in 1.sql are used for the 2 and 3 login if a wrong pwd was given.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-06-2008 02:51 AM
тАО05-06-2008 02:51 AM