Link to home
Start Free TrialLog in
Avatar of matrix0511
matrix0511

asked on

How Can I fix This Issue With Oracle Profile on Linux?

I have a new Linux server that the Oracle network team installed Oracle "Client" on.

I am now just trying to make sure the oracle Unix user profile is setup properly so that when I login to the Linux server as "oracle" I can run "sqlplus" and other things successfully.

But right now it appears this user acct and profile are not setup correctly.

If I login to that Linux server as another valid user I get this at the prompt:

[WTSCUSTOMER\jburch@tk0110es03 ~]$

Which is correct. However, if I login as "oracle" user I get this prompt:

-bash-3.2$

And when I try to run sqlplus command which normally should come up if the profile is setup with the ORACLE_HOME, Instead I get this:

-bash-3.2$ sqlplus
-bash: sqlplus: command not found


when I login using "oracle" it defaults to this location:

-bash-3.2$ ls
Desktop
-bash-3.2$ pwd
/home/oracle


But I don't see any files in that location. I don't see any profile files that I can edit.

Here is where oracle client is installed:

-bash-3.2$ pwd
/u01/app/oracle/product/11.2.0
-bash-3.2$

I'm not a Unix expert so I'm not sure which type of profile I use for this Linus server, (ie .profile, bash, etc). but I'm guessing maybe it's bash.

Let me know how I can proceed with this to get the profile setup so that I can use my Oracle client.

Thanks!
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

>>Which is correct. However, if I login as "oracle" user I get this prompt:

There is no 'correct' prompt.  The prompt is set up using the environment variable PS1.

Whatever you export that as, it is.

From the 'correct' machine: echo $PS1.   Then in the new machines profile, use it.

>>/u01/app/oracle/product/11.2.0

In the profile:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0
export PATH=$ORACLE_HOME/bin:$PATH

>> I'm not sure which type of profile I use for this Linus server, (ie .profile, bash, etc).

.profile should be fine
Avatar of matrix0511

ASKER

Ok. I think the profile I'm using is the .bash_profile because I was able to vi that file. This is what is in it:

-bash-3.2$ vi .bash_profile
ORACLE_HOME=/u01/app/oracle/product/11.2.0/client_1
ORAENV_ASK=NO
ORACLE_SID=prod

ORACLE_BASE=/u01/app/oracle

So there is at least a path to the oracle client but not sure if that is complete because of the issues I reported earlier. Let me know next steps. Thanks
In your .bash_profile, set your PATH to include $ORACLE_HOME/bin like I posted above.

You can also set PS1 in there as well.
@slightwv, I"m not familair with "environment variable PS1". Does that get setup manually by the Unix admin or by default? Why would all other profiles I login as not have that prompt that oracle user has?

I ran that echo command you provided (echo $PS1) while logged in as my other user. this is what it displays:

[WTSCUSTOMER\jburch@tk0110es03 ~]$ echo $PS1
[\u@\h \W]\$
[WTSCUSTOMER\jburch@tk0110es03 ~]$


Then you said "Then in the new machines profile, use it".

How do I do that??
>>Does that get setup manually by the Unix admin or by default?

It is typically set by the admins in the global profile.  the .bash_profile in your home directory can override the systems profile.

>>How do I do that??

While editing your local .bash_profile:
export PS1=[\u@\h \W]\$
Just curious @slighttwv, what is the difference between the "PATH" defined in the profile file and the ORACLE_HOME? Seems like the ORACLE_HOME path would be enough for the user to know where to locate the oracle files.
Ok. I updated the profile but still got issues.

This is what my profile looks like now:

[u@hW]$vi .bash_profile
ORACLE_HOME=/u01/app/oracle/product/11.2.0/client_1
ORAENV_ASK=NO
ORACLE_SID=prod
export PATH=$ORACLE_HOME/bin:$PATH
ORACLE_BASE=/u01/app/oracle
export PS1=[\u@\h\W]\$

Notice the prompt change actually looks worse now. haha. WE will need to change that. any ideas??

When I try to run "sqlplus" I get this message:

[u@hW]$sqlplus
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
PATH is what the system uses to look for programs/commands you type in.

ORACLE_HOME is what Oracle programs use to get the information they need.

When you type sqlplus, Linux needs to find that executable if it isn't in your current directory.  PATH is searched to find it.

Once Linux finds it and starts executing it, sqlplus then needs information from ORACLE_HOME to do what it does.
In regards to the "prompt" issue...all I want is when I login as "oracle" for it to prompt with the "username\@servername" like below when I login as "jburch".

[WTSCUSTOMER\jburch@tk0110es03
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>In regards to the "prompt" issue...all I want is when I login as "oracle" for it to prompt with the "username\@servername"

I don't have access to Unix right now.

I suggest you go through the docs and come up with whatever prompt you want:
http://www.gnu.org/software/bash/manual/html_node/Printing-a-Prompt.html

From the one you have set above, it looks like it should be close.
@ slightwv,

"PATH is what the system uses to look for programs/commands you type in.

ORACLE_HOME is what Oracle programs use to get the information they need.

When you type sqlplus, Linux needs to find that executable if it isn't in your current directory.  PATH is searched to find it.

Once Linux finds it and starts executing it, sqlplus then needs information from ORACLE_HOME to do what it does."

Ah, thanks! That explains it for me.

"SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

Try exporting them in your profile:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/client_1
export ORACLE_SID=prod"

Ok, I added in the "export" commands and that worked!

Ok, so I need for you to explain to me why we needed the "export" command if we already had the path to ORACLE_HOME in the profile. What does "export" tell the system?

Thanks!
And if I'm installing new software on this Linux server in the future, do I ONLY need to add the install path to this profile or do I also have to add an "export" command in the line like I did for Oracle_home?

I"m going to be installing an ERP software (JDedwards) and I will need to probably update this profile again with the install path just need to make sure I have it defined correctly.
>> why we needed the "export" command if we

It makes the variable available to the parent shell.

Typically when you execute a shell script, it forks a new process and anything set in the new process goes away when the process does.  the export command tells the script to keep passing this value around.

The docs probably have a better explanation.
>> do I ONLY need to add the install path to this profile or do I also have to add an "export" command in the line like I did for Oracle_home?

The correct answer is:  It depends.

Software can modify the correct profiles when it installs.  Some might not.  The installation guides/manuals for the software should tell you what you need to do.

Manually adding folders to PATH is pretty common.
Ok. Great. Thanks for all your help. You were awesome!!
Outstanding support!