- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Running sqlplus from a unix shell script, how do I...
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
тАО04-29-2002 02:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 02:14 PM
тАО04-29-2002 02:14 PM
SolutionS1=/tmp/cmds${$}.sql
# simply list all users and exit
cat << !EOF >> ${S1}
select * from all_users;
exit;
!EOF!
sqlplus username/topsecret < ${S1}
rm -f ${S1}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 02:15 PM
тАО04-29-2002 02:15 PM
Re: Running sqlplus from a unix shell script, how do I handle passwords?
Would be handled by sending a string @ login like
username/password@ORACLESID
or something like that - depends on the type of DB accessed.
Any way it needs the string you'll have to deal with the fact that the PW will be in plain text in the script.
Only option would be to use 3rd-party SW to encrypt/decrypt the PW on either end.
Search the forum for "ecnrypted passwords" for ways others have done this.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 05:40 PM
тАО04-29-2002 05:40 PM
Re: Running sqlplus from a unix shell script, how do I handle passwords?
echo "Enter the User Name for the DB"
read user
stty -echo
echo "Enter the Password for $user"
read pass
stty echo
sqlplus $user/$pass ......

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 08:44 PM
тАО04-29-2002 08:44 PM
Re: Running sqlplus from a unix shell script, how do I handle passwords?
1. You have it change it in a number of places when your password changes.
2. It is a security risk if you forget to change the permissions on the script so no other user can read it.
Two alternatives are:
1. Use other forms of authentication: Oracle OS Authentication or Network authentication. Take a look at the Admin Guide for more info on these.
2. Store the password in a file and read it in every script:
PWD=$(cat /home/admin/passwd.txt)
Make sure the permissions on this file don't allow others to read it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 12:16 AM
тАО04-30-2002 12:16 AM
Re: Running sqlplus from a unix shell script, how do I handle passwords?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 03:59 AM
тАО04-30-2002 03:59 AM
Re: Running sqlplus from a unix shell script, how do I handle passwords?
sqlplus -s username/password @report_something.sql
Doug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 04:20 AM
тАО04-30-2002 04:20 AM
Re: Running sqlplus from a unix shell script, how do I handle passwords?
I strongly agree with Mark Seaman! Storing Oracle passwords in shell scripts is a BIG security issue!
Next to having the password visible in the script for anyone who can access the script (and the administration to keep passwords in line with the database); you also have an issue that ANYBODY can see the command "sqlplus user/password" with a simple "ps -ef"!!
My favourite solution still is OS authentication (the OPS$-logins). Personally I strongly advise against Oracle passwords in shell scripts; in fact I blow away these scripts whenever I find them, and as long as the programmers don't do the same with me, I'll continue doing so in the future ;)
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 05:36 AM
тАО04-30-2002 05:36 AM
Re: Running sqlplus from a unix shell script, how do I handle passwords?
Thanks,
Hiren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 06:53 AM
тАО04-30-2002 06:53 AM
Re: Running sqlplus from a unix shell script, how do I handle passwords?
Create user ops$XXXXX
identified externally
default tablespace x
temporary tablespace y;
OS_AUTHENT_PREFIX in your init.ora will define the prefix of the externally authenticated users; default used to be "OPS$", but can be set to anything you want, or can even be empty.
After the user has been created and the necessary grants have been given (connect, custom roles, ...) the Unix (or other OS) user XXXXX will be able to connect to the database without supplying a password; i.e. "sqlplus /" or "runform /" will be sufficient.
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2006 04:09 AM
тАО07-10-2006 04:09 AM
Re: Running sqlplus from a unix shell script, how do I handle passwords?
However if I want to follow the properties file approach, how do I pass the username/password to the sqlplus command via shell script? I am doing something like -
DBURL=$(cat temp.txt)
echo $DBURL
sqlplus $DBURL << EOF
exec packageName.procName();
EOF
The sqlplus command is not recognizing the DBURL parameter. How do I pass this shell script variable to sqlplus command?
I am new to shell scripting. Please help.
Thanks.........