Ask The Oracle Expert: Questions & Answers

Running a script without user's password to Oracle database

SearchOracle.com

Hello Brian,
Is there any way to run a script .sh (Unix) or .bat (Windows) automatically or manually without including the password of the user that connects to the database or entering manually that password? That is, perhaps reading directly from any file of the database or something like this? Thanks in advance.

In my shell scripts, I can code something similar to the following:

sqlplus /nolog <<EOF
connect username/password
@script
EOF

The above will invoke SQL*Plus and pass everything up until the EOF string to SQL*Plus. The big problem with the above is that i

To continue reading for free, register below or login

Requires Membership to View

To gain access to this and all member only content, please provide the following information:

By joining SearchOracle.com you agree to receive email updates from the TechTarget network of sites, including updates on new content, magazine or event notifications, new site launches and market research surveys. Please verify all information and selections above. You may unsubscribe at any time from one or more of the services you have selected by editing your profile or unsubscribing via email.

TechTarget cares about your privacy. Read our Privacy Policy

Related Glossary Terms

Terms from Whatis.com − the technology online dictionary
Oracle database design and architecture

Related Resources

f you have multiple shell scripts, then it can be a pain to change the password. So I often prefer to store the password as the only word on the only line in a file (I'll call that file 'pass'). Then I invoke SQL*Plus in my shell script as follows:

sqlplus username @/dir/my_script.sql < /dir/pass

When the above is run, SQL*Plus will start and the password will be passed from the file. If you change your password, you only need to update this file and all of your scripts will work. If you do choose this method, make sure you do "chmod 600" on this file so that only your user can read the file's contents.