Error querying Oracle database from CGI Perl script - oracle

I have a CGI Perl script that will run a select statement from a Oracle Database to get records. This scripts runs on Apache with cgi-bin linked. It was running fine.
Due to failover we moved the hard disk to the backup server with similar setups. When we run the script however, the following error is shown:
install_driver(Oracle) failed: Can't load '/u02/system/perl/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.11.1: cannot open shared object file: No such file or directory at /u02/system/perl/usr/lib64/perl5/DynaLoader.pm line 200.
I had checked my ORACLE_HOME and LD_LIBRARY_PATH variables and they both pointing to the correct oracle client. Also try locate libclntsh.so.11.1 and managed to find the file in the correct directory, with permission granted.
Also added a oracle.conf file that has the path to oracle lib directory in /etc/ld.so.conf.d
All these and still it's showing the same error. Am running out of ideas....
Any pointers or suggestion are appreciated. Thank you.

You've covered the basics already which is good: make sure the libraries exist, make sure your program has read/execute permissions, and setting environment variables for ORACLE_HOME and LD_LIBRARY_PATH.
You many need to check the dependencies recursively.
ldd /u02/system/perl/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so
should show you any dependencies of the .so that can't be loaded. DBD::Oracle is also version sensitive to the Oracle client. If the version or location of the Oracle client has changed (or when all else fails), you may need to recompile DBD::Oracle.

Related

How DASK_jobqueue SLURMCluster can access local python module in parent directory

I'm using dask_jobqueue to establish a SLURMCluster. I'm trying to pass python files in the parent directory to the workers. I tried different ways including sys.path.append, setting PYTHONPATH in my .bashrc file, and setting PYTHONPATH in env_extra (it seems DASK version can't recognize job_script_prologue), but they all fail. The script works only when the imported Python files are in the same directory as the script. I just wonder if this is really the case (which means I should re-write my code to keep all files in the same directory), or I'm missing something here?
Also, I tried to use with performance_report to record some statistics in an HTML file, but it seems it does not work with dask_jobqueue, right?

Docker: Oracle database 18.4.0 XE wants to configure a new database on startup

I'm trying to configure an Oracle Database container. My problem is whenever I'm trying to restart the container, the startup script wants to configure a new database and failing to do so, because there already is a database configured on the specified volume.
What can I do let the container know that I'd like to use my existing database?
The start script is the stock one that I downloaded from the Oracle GitHub:
Link
UPDATE: So apparently, the problem arises when /etc/init.d/oracle-xe-18c start returns that no database has been configured, which triggers the startup script to try and configure one.
UPDATE 2: I tried creating the db without any environment variables passed and after restarting the container, the database is up and running. This is an annoying workaround, but this is the one that seems to work. If you have other ideas, please let me know
I think that you should connect to the linux image with:
docker exec -ti containerid bash
Once there you should check manually for the following:
if $ORACLE_BASE/oradata/$ORACLE_SID exists as it does the script and if $ORACLE_BASE/admin/$ORACLE_SID/adump does not.
Another thing that you should execute manually is
/etc/init.d/oracle-xe-18c start | grep -qc "Oracle Database is not configured
UPDATE AFTER COMMENT=====
I don't have the script but you should run it with bash -x to see what is the script looking for in order to debug what's going on
What makes no sense is that you are saying that $ORACLE_BASE/admin/$ORACLE_SID/adump does not exist but if the docker deployed and you have a database running, the first time the script run it should have created this.
I think I understand the source of the problem from start to finish.
The thing I overlooked in the documentation is that the Express Edition of Oracle Database does not support a SID/PBD other than the default. However, the configuration script (seemingly /etc/init.d/oracle-xe-18c, but not surly) was only partially made with this fact in mind. Which means that if I set the ORACLE_SID and/or ORACLE_PWD environmental variables when installing, the database will be up and running, with 2 suspicious errors, when trying to copy 2 files.
mv: cannot stat '/opt/oracle/product/18c/dbhomeXE/dbs/spfileROPIDB.ora': No such file or directory
mv: cannot stat '/opt/oracle/product/18c/dbhomeXE/dbs/orapwROPIDB': No such file or directory
When stopping and restarting the docker container, I'll get an error message, because the configuration script created folder/file names according to those variables, however, the docker image is built in a way that only supports the default names, causing it to try and reconfigure a new database, but seeing that one already exists.
I hope it makes sense.

DBD::Oracle unable to connect due to OCIEnvNlsCreate error on MacOS 10.12.6

I'm trying to connect to an Oracle server in a Perl script. The script works on other machines that are already configured. I'm trying to set up my machine to allow me to do local development.
I have extracted instantclient-basic-macos.x64-11.2.0.4.0.zip, instantclient-sqlplus-macos.x64-11.2.0.4.0.zip, instatnclient-sdk-macos.x64-11.2.0.4.0.zip, and instantclient-jdbc-macos.x64-11.2.0.4.0.zip to /usr/local/oracle_client. I have added that location to my PATH, ORACLE_HOME, LD_LIBRARY_PATH, and DYLD_LIBRARY_PATH environment variables via both .bashrc and .bash_profile in an attempt to find a fix. I have added the variables to the Perl script environment directly by setting them directly in the script:
$ENV{'ORACLE_HOME'} = '/usr/local/oracle_client';
$ENV{'LD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'};
$ENV{'DYLD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'};
I have reinstalled DBD::Oracle multiple times with various environment configurations. I can connect to the database using the sqlplus client installed to /usr/local/oracle_client.
Inside /usr/local/oracle_client, I have created symlinks for bin and lib pointing to the /usr/local/oracle_client dir (bin -> .). The SDK also lives inside a subdirectory structure located at /usr/local/oracle_client/sdk, but all of the include files have been copied to the /usr/local/oracle_client folder.
What am I missing?

Execute property for oracle pkgs on Unix

I am trying to understand file properties and from what I understand that for the files like shell scripts on UNIX to be executable, the file properties need to be set to execute (rwx-). At our organization, oracle files are maintained on UNIX file system and compiled on oracle during the time of run or compiled once for all the schemas. But the pkgs maintained on UNIX, some have executable property and some don't(rwxrwxr-- and rw-r--r--). So when a shell script is calling this pkg that is not executable how will it be able to compile on Oracle? Please help me understand or direct me to documents that has notes on this. Thanks in advance.
The package script itself doesn't need to be executable as it's just a text file containing source code. SQL*Plus reads the contents and submits it to the server for compilation.

WKHTMLTOPDF and "Error: Unable to create temporery file"

I've written a piece of code in PHP to generate PDF using WKHTMLTOPDF binary file. It was working fine till I had to recompile my Apache. Now it fails with error Error: Unable to create temporery file (this is the exact wording).
The situation in which the error is reproducible is a little complicated. I managed to narrow down the error and now I'm pretty sure that the error happens because of the user that Apache runs as. It seems to me that when WKTHMLTOPDF is running as a user with no home folder, it's unable to access a temporary folder within the user's home folder.
Surely I can change the Apache's user but I would rather resolve this problem once and for all. To this end it would be great if I could somehow set the temp folder for WKHTMLTOPDF or at least print its current value to make it valid! Does anyone know how to do any of these two?
BTW, I'm using WKHTMLTOPDF 0.11.0 rc1.
I saw the same error today in Rails4 + pdfkit gem(0.8.2) + wkhtmltopdf(0.12.2.1) under CentOS 6.7.
This error came from wkhtmltopdf and the reason was it couldn't create temporary file. wkhtmltopdf depends on some temporary filename creation API (I'm not sure), but probably following shows some hints:
$ man tempfile
$ man tempnam
In my case, my TMPDIR environment variable showed wrong path (I had accidentaly deleted the directory!) so that wkhtmltopdf couldn't create work file.
When I unset TMPDIR, then it worked! Of course, setting correct existence directory to TMPDIR should be OK too.

Resources