Operating System - HP-UX
1752866 Members
3649 Online
108791 Solutions
New Discussion

Perl script unable to connect to DB when its run under the OVSD

 
SOLVED
Go to solution
Ghazanfar_1
Advisor

Perl script unable to connect to DB when its run under the OVSD

Hi Gurus,

 

I have a strange issue. when I ran the perl scripts through hp-ux prompt it us running successfully, but when I run the script through OVSD, its giving the below error:

 

Output: DBI connect('db','user',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc. a


Couldn't connect to database: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc.

 

 

Before it was running fine, but after the restart of the server, its not running now.

 

Need urgent help on it.

 

Regards,

Ghazanfar Aziz
1 REPLY 1
Matti_Kurkela
Honored Contributor
Solution

Re: Perl script unable to connect to DB when its run under the OVSD

When you run the script through the HP-UX command prompt, your environment variable settings include the proper ORACLE_HOME, SHLIB_PATH/LD_LIBRARY_PATH etc. settings that allow the script to use the Oracle libraries successfully. When OVSD runs the script, the environment variables are different: probably some settings are missing.

 

Before the system reboot, your OVSD was probably started manually from a command prompt session that included the required environment variable settings for Oracle. Thus, the OVSD had inherited the variables from the command prompt session and passed them on to all its child processes.

 

But when you restarted the server, OVSD was probably started by a start-up script: in HP-UX, the start-up scripts usually have very minimal environment settings. So it is very likely that OVSD now does not have the correct environment settings, and so cannot pass them to any processes it starts... and this is why your scripts fail.

 

If you stopped OVSD and re-started it from a command prompt that can run the scripts successfully, you might see OVSD "miraculously" start running the scripts successfully again. But that is not a real fix, just a quick workaround: next time the system was rebooted, this issue would appear again.

 

You have two ways to fix this:

  • either modify the start-up script for OVSD so that it sets and exports the necessary environment variables before starting OVSD (NOTE: document your modification so that you'll know where to make changes the next time Oracle is upgraded.)
  • or make OVSD do something to set up the necessary variables before it runs the scripts: e.g. create a wrapper script that initializes the variables required by Oracle and then runs the actual Perl script, then make OVSD run the wrapper instead of the actual script. (this might be considerad at least somewhat self-documenting, as anyone viewing the OVSD configuration should see that a wrapper is being used)

I'm not familiar with OVSD, so unfortunately I cannot provide any detailed instructions.

MK