Solved

oracle automated login script

Posted on 2013-02-04
11
481 Views
Last Modified: 2013-02-04
I have always used a unix script to pass my oracle ID/PASSWORD.
Now we cannot have and script on the system that contains a password.
We also are not supposed to use / as sysdba

On oracle 10g - aix and Linux.

Is there a way to set up and environment variable that you can do a

sqlplus $LOGIN_ID

run a script - say -
select * from v$instance;
alter user userid identified by newpassword;

Thanks
0
Comment
Question by:bkreynolds48
  • 5
  • 4
  • 2
11 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38851478
Can you use OS Authentication?

This allows you to use sqplplus / (without the 'as sysdba').

If not, I don't think you can connect to the database without the credentials coming from somewhere.

>>run a script - say -

I don't understand what you are thinking about here.  Can you explain what your proposed script will do?
0
 
LVL 1

Author Comment

by:bkreynolds48
ID: 38851524
just want to connect to a database

sqlplus $oracle_login
select * from v$instance;
alter user USERID identified by NEWPASSWORD;
exit;

or run some other command - I just need a way to enter the ID/PASSWD for oracle without putting it in a file

file name
oracle.login

in the oracle.login file I had

userid/password


so I would just do

sqlplus <oracle.login
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38851537
You didn't answer this:  Can you use OS Authentication?
0
 
LVL 1

Author Comment

by:bkreynolds48
ID: 38851547
here is an example of what I have done in the past

#
#!/bin/ksh
#
ORACLE_HOME=/export/home/oracle/product/10_2;export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib/;export LD_LIBRARY_PATH
ORACLE_SID=PROD;export ORACLE_SID
PATH=$PATH:$ORACLE_HOME/bin:/usr/local:/usr/ucb:/usr/ccs/bin:/export/home/oracle/oradba:/usr/local/bin;export PATH

/export/home/oracle/product/10_2/bin/sqlplus -s @/export/home/oracle/myid/sql/oracle.login << EOF  
@/export/home/oracle/myid/sql/rbsoffline.sql
exit
EOF
#


Now I cannot store my oracle ID/PASSED in a file like oracle.login
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38851570
>>Now I cannot store my oracle ID/PASSED in a file like oracle.login

I understand this.  You are not answering my questions.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 38851586
Check out this option:
Secure External Password Store

http://www.oracle-base.com/articles/10g/secure-external-password-store-10gr2.php
0
 
LVL 34

Expert Comment

by:johnsone
ID: 38851613
What you are thinking of doing is possible.  You could so something like:

oracle_login="user/pass"
export oracle_login

Then run your script.

However, I'm pretty sure that your security people would have just as much of an issue with doing it this way because a privileged username and password would still be visible to ps because it would be passed via command line.

To appease the security people, you should look at something like what slightwv is suggesting.  Passwords secured in a secured and encrypted file somehow.  Then having a script that accesses the passwords.  Be careful not to pass that to a command line though as you will still have the same visible via ps command problem.
0
 
LVL 1

Author Comment

by:bkreynolds48
ID: 38851641
I am reading the do that slightwv recommend

If I do this

oracle_login="user/pass"
export oracle_login


do you just do

sqlplus $oracle_login
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38851665
>>sqlplus $oracle_login

As johnsone stated:  DO NOT do this.  If you provide the username and password as a command line argument this way, anyone on the Unix machine with a command prompt can see your password with a simple 'ps' command.

>>oracle_login="user/pass"

You 'can' do this but what does it do for you?  You still have to have the password stored somewhere or you need to type it in.

If you are willing to type it in, then there is no need to do this in the first place.
0
 
LVL 1

Author Closing Comment

by:bkreynolds48
ID: 38851670
Thanks
0
 
LVL 34

Expert Comment

by:johnsone
ID: 38851699
If you wanted to use the environment variable and have it not show up on the command line, you would have to do something like this:

sqlplus /nolog << EOF
connect $oracle_login
....
exit
EOF

That should keep it off the command line.  But, as has been pointed out, you still need to set that variable before you can run that script.  You would have to do it through commands and couldn't keep it in the profile scripts as that would be keeping it in a human readable file.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now