I'm trying to setup a CentOS 5.5/64 bit VM to access a remote Oracle database with PHP and Perl scripts. (I have no experience with Oracle, have only programmed and administrated some PostgreSQl and MySQL before.)
I've installed the following Oracle Instant Client rpms:
oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.2.0.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm
And have added the following variables to my .bash_profile:
export TNS_ADMIN=/etc
export ORACLE_HOME=/usr/lib/oracle/11.2
export LD_LIBRARY_PATH=$ORACLE_HOME/client64/lib
PATH=$PATH:$HOME/bin:/sbin:$ORACLE_HOME/client64/bin
Into the file /etc/tnsnames.ora
I've written the infos received from the colleague at the remote site running the Oracle database:
some_string =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = my_address)(PORT = my_port))
)
(CONNECT_DATA =
(SERVICE_NAME = PDTT)
)
)
The nice part is that I can connect from CLI now by running
sqlplus 'my_user/my_password@//my_address:my_port/PDTT'
and then can see some tables by issueing:
select table_name from user_tables;
And also I've run sudo pecl install oci8
successfully, added the file /etc/php.d/oci8.ini
containing:
extension=oci8.so
and can see the following phpinfo() output
Now my questions and problems please:
1) How should I setup ORACLE_SID variable and how to call sqlplus once it is set? Can/should I use ORACLE_SID from PHP and Perl scripts?
2) I run sudo -E perl -MCPAN -e shell
and it works well when installing other Perl modules, but for "install DBD::Oracle" it fails with:
CPAN.pm: Going to build T/TI/TIMB/DBD-Oracle-1.26.tar.gz
Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Configuring DBD::Oracle for perl 5.008008 on linux (x86_64-linux-thread-multi)
Remember to actually *READ* the README file! Especially if you have any problems.
The ORACLE_HOME environment variable value (/usr/lib/oracle/11.2) is not valid.
It must be set to hold the path to an Oracle installation directory
on this machine (or a machine with a compatible architecture).
For an Instant Client install, the directory should include an sdk subdirectory.
See the appropriate README file for your OS for more information.
ABORTED!
Running make test
Make had some problems, maybe interrupted? Won't test
Running make install
Make had some problems, maybe interrupted? Won't install
It mentions "sdk" dir above, but the rpm didn't have that dir at all:
# rpm -ql oracle-instantclient11.2-devel | grep -i sdk
#
Thank your for any hints and also any useful tips for Oracle installation and usage. There is lot of Oracle information out there, but it often assumes that Oracle is installed at the same machine.