- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to get oracle user's environment parameter...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 10:39 PM - last edited on 01-01-2013 07:56 PM by Cathy_xu
08-11-2009 10:39 PM - last edited on 01-01-2013 07:56 PM by Cathy_xu
How to get oracle user's environment parameter in unix shell script
If i run a unix shell script by user root , in this script i want to get user oracle's environment parameter "ORACLE_SID"'s value , how to implement it , thanks!
P.S.This thread has been moved from HP-UX>System Administration to HP-UX > languages- HP Forums Moderator
- Tags:
- env
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 10:55 PM
08-11-2009 10:55 PM
Re: How to get oracle user's environment parameter in unix shell script
ORACLE_SID is usually defined in the '.profile' of the oracle user.
If you only want to use it in one script just copy it out of the profile into the script, or set it inside the script.
ORACLE_SID=123
To set it permanently for root you can add it to the .profile from root.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 11:00 PM
08-11-2009 11:00 PM
Re: How to get oracle user's environment parameter in unix shell script
But if i don't know where is the .profile exist. and i can use command "su - oracle" and "env | grep -i ORACLE_SID" to get the parameter, but i don't know how to write this kind of shell script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 11:11 PM
08-11-2009 11:11 PM
Re: How to get oracle user's environment parameter in unix shell script
Open it with vi and insert a line
ORACLE_SID=
Save the script and run it as root.
hth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 11:22 PM
08-11-2009 11:22 PM
Re: How to get oracle user's environment parameter in unix shell script
.profile file exists in every users home directory.Immediately when u login it takes you to the home directory by default.
These files are hidden files and are not visible with ls command. Hence you need to apply ls -la..
2 -r-------- 1 root sys 40 Jan 7 2008 .exrc
2 -r--r--r-- 1 bin bin 334 Nov 14 2000 .login
2 -rw-r----- 1 root sys 789 May 16 2007 .nvdrc
4 -rw------- 1 bin bin 1200 Mar 30 2007 .profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2009 12:23 AM
08-12-2009 12:23 AM
Re: How to get oracle user's environment parameter in unix shell script
"
su - oracle
oracle_sid=`env|grep -i SID`
exit
"
but i can't switch to user root again.
Same problem , i'm not sure where is the ORACLE_HOME directory .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2009 12:34 AM
08-12-2009 12:34 AM
Re: How to get oracle user's environment parameter in unix shell script
Press 'CTRL' 'D'
>>Same problem , i'm not sure where is the ORACLE_HOME directory .
# su - oracle
$ env | grep -E 'ORACLE_SID|ORACLE_HOME'
$
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2009 12:42 AM
08-12-2009 12:42 AM
Re: How to get oracle user's environment parameter in unix shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2009 12:55 AM
08-12-2009 12:55 AM
Re: How to get oracle user's environment parameter in unix shell script
try 'logout'
V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2009 01:01 AM
08-12-2009 01:01 AM
Re: How to get oracle user's environment parameter in unix shell script
Try this:
su - oracle
env | grep -E 'ORACLE_SID|ORACLE_HOME'
exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2009 01:06 AM
08-12-2009 01:06 AM
Re: How to get oracle user's environment parameter in unix shell script
Nobody do this kind task like that.
"switch user in shell script"
:(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2009 02:34 AM
08-12-2009 02:34 AM