$HOME Not Getting Set for Oracle Scheduler Script at Runtime


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting $HOME Not Getting Set for Oracle Scheduler Script at Runtime
# 1  
Old 12-13-2007
$HOME Not Getting Set for Oracle Scheduler Script at Runtime

We are researching the possibility of using Oracle 10g Scheduler on Solaris 10 to launch scripts at our site, and the script that I am testing does not get $HOME (and other environment variables) set correctly. Here is the Korn shell script (show_info.ksh):

#!/usr/bin/ksh
id
env | sort


Here is the output from the script when it is executed interactively (I removed the extraneous Oracle variable displays for brevity):

. ./show_info.ksh
+ id
uid=100(oracle) gid=1978(dba)
+ sort
+ env
$
_=/usr/bin/env
DBA_LOGS=/usr/oracle/scripts/logs
EDITOR=vi
HOME=/usr/oracle
LOGINFROM=n.n.n.n
LOGNAME=oracle
PATH=/u01/app/oracle/product/10g/bin:/u01/app/oracle/product/10g/OPatch:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/local/sbin:/usr/sbin
PS1=${LOGNAME}-${ORACLE_SID}-${PWD}
PWD=/usr/oracle/jps/oracle_scheduler
SHELL=/bin/ksh
SystemEnvironment=0200P
TERM=dtterm
TZ=US/Eastern
USER=oracle


Here is the output from the script when it is executed by cron-this appears to be running the Bourne shell, despite the Korn bang line, correct?:

+ id
uid=100(oracle) gid=1978(dba)
+ sort
+ env
HOME=/usr/oracle
LOGNAME=oracle
PATH=/usr/bin:
PWD=/usr/oracle
SHELL=/usr/bin/sh
TZ=US/Eastern
_=/usr/bin/env


Here is the output from the script when it is executed by Oracle Scheduler (dbms_scheduler)-this is what I'm trying to “fix:”

uid=100(oracle) gid=1978(dba)
PWD=/
_=/usr/bin/env


Questions:
  1. Which shell is running when the script is launched by Oracle Scheduler?
  2. How can I get $HOME to be defined correctly?

J
# 2  
Old 12-13-2007
You may need to export all the variables so child processes will see them.
# 3  
Old 12-13-2007
Quote:
Originally Posted by porter
You may need to export all the variables so child processes will see them.
Where does $HOME get set during a process login?
# 4  
Old 12-13-2007
Quote:
Originally Posted by shew01
Where does $HOME get set during a process login?
I thought "login" would do it. Smilie

The traditional sequence is init -> getty -> login -> shell.

cron is lightweight and doesn't do a full log in, it sort of just impersonates the user.
# 5  
Old 12-14-2007
Quote:
Originally Posted by porter
The traditional sequence is init -> getty -> login -> shell.
Can you elaborate a bit--I don't understand what you mean. Can you specifiy the file names that are called during the login process?

Quote:
Originally Posted by porter
cron is lightweight and doesn't do a full log in, it sort of just impersonates the user.
Apparently, Oracle Scheduler is even more lightweight. It barely impersonates the user. Smilie

I can hardcode some syntax to get around this problem, but we'll need to "rip and replace" a bunch of code if the user changes in the future, or if the disk farm changes, or if whatever else changes.... I'd like to keep the configuration generic and let the system to figure out $HOME at a minimum, and it would be nice if it would populate $SHELL too. From there, I should be able to source whatever other scripts that I need.

Is there a way to figure out which shell is running when $SHELL is not populated?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

New Oracle Home

How do I set ORACLE_HOME location? When I type echo $$ORACLE_HOME it gives me /u01/app/oracle//product/10.2.0/dbhome_1 which has been deleted. I just installed Oracle 11g and this is supposed to be a new oracle home /u01/app/oracle/product/11.2.0/dbhome_1 Any help from the community... (21 Replies)
Discussion started by: newborndba
21 Replies

2. Shell Programming and Scripting

how to change ORACLE HOME?

All, I have to change my ORACLE_HOME in the prodution environment. I have chaged it in .profile file but when I am typing the command bash-2.05$ echo $ORACLE_HOME /apps/oracle/product/10.2.0.4.2011Q1 Instead of Q1 it should show Q3 bcoz I have changed it in .profile file. But at the same... (2 Replies)
Discussion started by: Oracle_User
2 Replies

3. UNIX for Dummies Questions & Answers

Unix set home directory

Hi I've just made a directory, what command do I use to now make it the base directory? Thanks!!!!!!!!!!!!!!! (1 Reply)
Discussion started by: beckywatson
1 Replies

4. Shell Programming and Scripting

Exit status always zero in KSH from Oracle Scheduler

Hi, Running Oracle Scheduler 11g2 on an AIX 6.01. I want to run a shell script (called "external program" in Oracle terminology) which executes some commands and react on the outcome using the exit status $?. For example a "cat thisfiledoesnotexist" and then get the $? which should be not zero.... (6 Replies)
Discussion started by: hermanmol
6 Replies

5. UNIX Desktop Questions & Answers

How to set up a home SFTP server?

I want to setup a home SFTP server in order to transfer my files securely. But I don't know about this anything. My friends told that there are many secure file transfer tool are present in the net. I am unable to find the best one. Please share your experiences with and also give your suggestions... (1 Reply)
Discussion started by: verrock_poo
1 Replies

6. Shell Programming and Scripting

Execute oracle query determined at runtime from a unix script

Hi I am trying to run a SQL statement from a unix script determined at runtime. It is throwing me an error. Please advise some solution to this. echo "Enter username for the database" read username echo "Enter password for the database" read password echo "Enter SQL stmt" read... (4 Replies)
Discussion started by: infyanurag
4 Replies

7. UNIX for Dummies Questions & Answers

how to set $HOME?

Hi Everyone! I just want to know how to set $HOME. I cant see $HOME in my profile. Below is my profile. export PATH=.:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/mai lservice/sybase/12.5/OCS-12_5/bin:/mailservice/sybase/config:. #export $PATH export... (2 Replies)
Discussion started by: sachin.gangadha
2 Replies

8. Shell Programming and Scripting

setting Oracle Home

Hi, if i set Oracle home in the command line as export ORACLE_HOME=/usr/oracle/product/9.2.0; and then checking it by typing echo $ORACLE_HOME,its getting the correct result.But if i try setting the ORACLE_HOME from a shell script by just including the same line as above,it was... (3 Replies)
Discussion started by: DILEEP410
3 Replies

9. UNIX for Advanced & Expert Users

Set up the own Unix ENvironment at home

Hello! All Unix Expert, I just graduated from college with Bachalor degree in Computer Information System, and decided to start my career in Unix System. I am trying to set up my own unix Environment at home so that I can get more hand on experience since the class offered by unix vendors are... (1 Reply)
Discussion started by: jung1975
1 Replies

10. UNIX for Dummies Questions & Answers

Hardware dummy trying to set up Unix workstation for Oracle at home for practice!

I have been planning to set up a Unix workstation at home to host an Oracle database just for database admin. practice. But I don't know enough about hardware to know whether this can be done on a regular desktop and the required hardware config. If anyone could kindly guide me in this mission I... (4 Replies)
Discussion started by: tmanpakdee
4 Replies
Login or Register to Ask a Question