Operating System - HP-UX
1752795 Members
5917 Online
108789 Solutions
New Discussion юеВ

Chapter III - User's environments and /etc/profile

 
SOLVED
Go to solution
rustam_2
Super Advisor

Chapter III - User's environments and /etc/profile

Hi everybody,
I'd like to find out some details about environments, how to create them correctly and how to edit profile file.
1. to set temporary (for current session) environment. I needed to environment for ORACLE_HOME and ORACLE_SID.
i did:
# cd /u01/app/oracle/product/10.2.0/db_1/bin
# PATH=$PATH:.
# export PATH
# .oraenv
after this i could run oracle commands. When i changed user and came back, i couldnt do

$echo $PATH
PATH: .

in my 2nd server:
$echo $PATH returns
/usr/bin:/usr/sbin:/sbin

so, how could i have normal PATH value? in both of them i must have PATH for OS commands and ORACLE env.
Should i run PATH=PATH:/usr/bin:/usr/sbin:/sbin:/u01/app/oracle/product/10.2.0/db_1/bin or ? I know how to set one PATH(env), such as:
# cd /u01/app/oracle/product/10.2.0/db_1/bin
# PATH=$PATH:.
# export PATH
but i need to set whole environments with 1-2 command, i'd like to find out syntax of 'set environments'

2. First mark was to set temporary environments and syntax. Better to check and know what is running right now. But for the future i'd like to know - how to edit /etc/profile and ~/.profile, coz dont wanna always
set environments after relogin\restart\shutdown and so on. I checked /etc/profile and a bit difficult to find where to put environments..? + i couldnt find .profile in my home directory.

Regards,
Rustam



40 REPLIES 40
Yallappa
Occasional Advisor

Re: Chapter III - User's environments and /etc/profile

Edit .profile file of user with vi editor and change the line
PATH=$PATH:.

to

PATH=$PATH:/u01/app/oracle/product/10.2.0/db_1/bin

and then try.
Michal Kapalka (mikap)
Honored Contributor

Re: Chapter III - User's environments and /etc/profile

hi,

i think if you like to run some commands you need to set the variables for the shell, i always use only a dedicated user for oracle administration, so only this user need to set up this shell variables. of course if you have only one instance on the oracle you could set this variables as a global variable in /etc/profile.

mikap
Horia Chirculescu
Honored Contributor

Re: Chapter III - User's environments and /etc/profile

Hello, Rustam

>so, how could i have normal PATH value?

You could do a:

source /etc/profile

That would restore the PATH to a "normal" value...

>i'd like to know - how to edit /etc/profile

You do not need to edit /etc/profile in order to alter PATH value. Change the file /etc/PATH .

Horia.
Best regards from Romania,
Horia.
Dennis Handly
Acclaimed Contributor

Re: Chapter III - User's environments and /etc/profile

>Horia: You could do a: source /etc/profile

To source a file in a real shell you use:
. /etc/profile
rustam_2
Super Advisor

Re: Chapter III - User's environments and /etc/profile

few days ago i couldn't run oracle command, coz environments weren't set. Then i run on 1st server these commands:
# cd /u01/app/oracle/product/10.2.0/db_1/bin
# PATH=$PATH:.
# export PATH
# .oraenv
then it were possible to run them. But know i cant run OS commands, coz in PATH=PATH: .

on 2nd server i didn't run any command yet, there PATH=/usr/bin:/usr/sbin:/sbin

So how can i have set
PATH=/usr/bin:/usr/sbin:/sbin:/u01/app/oracle/product/10.2.0/db_1/bin
through the CLI?

+ 2nd way, should i add these parameters in /etc/profile or /etc/path ?

i have special user for oracle DBA.


Dennis Handly
Acclaimed Contributor

Re: Chapter III - User's environments and /etc/profile

>So how can I have set:
PATH=/usr/bin:/usr/sbin:/sbin:/u01/app/oracle/product/10.2.0/db_1/bin

You type that exact line.
rustam_2
Super Advisor

Re: Chapter III - User's environments and /etc/profile

Dennis, do u mean like this?:

$PATH=PATH:/usr/bin:/usr/sbin:/sbin:/u01/app/oracle/product/10.2.0/db_1/bin

$export PATH
Horia Chirculescu
Honored Contributor

Re: Chapter III - User's environments and /etc/profile

>$PATH=PATH:...

It is the other way:

PATH=$PATH:...


Horia.
Best regards from Romania,
Horia.
Dennis Handly
Acclaimed Contributor

Re: Chapter III - User's environments and /etc/profile

>should I add these parameters in /etc/profile or /etc/path?

It depends on how many user's want this in their path vs how many don't.
Special users should add it to their own ~/.profile.