Solved

oracle automated login script

Posted on 2013-02-04
11
480 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)
Comment Utility
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
Comment Utility
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)
Comment Utility
You didn't answer this:  Can you use OS Authentication?
0
 
LVL 1

Author Comment

by:bkreynolds48
Comment Utility
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)
Comment Utility
>>Now I cannot store my oracle ID/PASSED in a file like oracle.login

I understand this.  You are not answering my questions.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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)
Comment Utility
>>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
Comment Utility
Thanks
0
 
LVL 34

Expert Comment

by:johnsone
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Image not there 4 33
Oracle 12c patching 1 28
dates - loop 12 39
Best RAID for a BDD Oracle 4 13
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

771 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

10 Experts available now in Live!

Get 1:1 Help Now