Operating System - HP-UX
1824170 Members
2490 Online
109669 Solutions
New Discussion юеВ

Command Export not found in scripts

 
Maarten van Maanen
Regular Advisor

Command Export not found in scripts

We are using Oracle on our HP9000 K370 under 11.0. In the backup we do a database-shutdown, calling a shutdown-scripts with the su command. The shutdown script starts with setting a few variables. However, the export of these variables produces an error-message, which is listed below.
------------------------------
su - oracle /disk01/app/oracle/admin/C2P/test.sh

export: Command not found
export: Command not found.
/disk01/app/oracle/product/8.0.5
C2K
----------------------------------

The part of the script involved is listed below.
------------------
export ORACLE_HOME=/disk01/app/oracle/product/8.0.5
export ORACLE_SID=C2P

echo $ORACLE_HOME
echo $ORACLE_SID
--------------------

I can see what is going wrong here since the echo command gives the right results.
2 REPLIES 2
John Palmer
Honored Contributor

Re: Command Export not found in scripts

Hi,

Instead of running
su - oracle /disk01/app/oracle/admin/C2P/test.sh

Supply the -c argument:-
su - oracle -c /disk01/app/oracle/admin/C2P/test.sh

Personally I would run the command:-
su oracle -c /disk01/app/oracle/admin/C2P/test.sh

and get the script to set up the necessary Oracle environment (PATH, ORACLE_HOME and ORACLE_SID).

Regards,
John
Rainer_1
Honored Contributor

Re: Command Export not found in scripts

insert as the first line in your /disk01/app/oracle/admin/C2P/test.sh
#!/sbin/sh
to ensure that the script runs in posix shell.
(i guess your oracle user has the c-shell - check it in /etc/passwd)
Also be sure that your test.sh has posix/bourne/korn shell syntax.