Linux Oracle9i Shared Libraries Problem [message #98857] |
Tue, 06 May 2003 16:27 |
Srinivas Varala
Messages: 1 Registered: May 2003
|
Junior Member |
|
|
Hi all,
I was using Shared Libraries in Oracle 8.1.7(32 Bit) on Linux 7.2. These shared libraries are working fine for Oracle
8.1.7. Then I ported these shared libraries to Oracle 9.2.0 (32 Bit) on the same Linux 7.2 on the same machine and they are
not working properly.
The C-SOURCE FILE is used to create shared library is below:
C-SOURCE FILE:
shell.c
--------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void sh(char *);
void sh ( char *cmd)
{
int num;
num = system(cmd);
}
-------------------------
I created the shared library using the following command:
gcc -c shell.c -o shell.o
ld -shared -o shell.so shell.o
I am then executing a shell script using this shell.so library from PL/SQL and redirecting the output to a file.
startdb.sh
------------------------------------------------------------------------------------------------
integer k
export ORACLE_SID=BHANCLON
export ORACLE_HOME=/opt/ORA816
export LD_LIBRARY_PATH=${ORACLE_HOME}/lib
export PATH=$PATH:/usr/bin:/usr/local/bin:/usr/sbin:/etc:/usr/contrib/bin:/usr/ucb:/usr/ccs/bin:${ORACLE_HOME}/bin:.
k=`ps -ef | grep smon | grep $ORACLE_SID | wc -l`
if [[[[ $k -lt 1 ]]]] then
sqlplus /nolog <<EOF
connect / as sysdba
startup
EOF
echo "DB_STARTED_NOW"
else
echo "DB_RUNNING"
fi
sqlplus /nolog <<EOF
connect / as sysdba
select 'TRYING TO FIND THE DATABASE STATUS .... ' dummy from dual;
select decode(status,'OPEN','1379_SOURCE_DB1_OPEN_'||to_char(9*9),'Database is currently: '||status|| ' To proceed, pl. CLOSE
it or
OPEN it COMPLETELY !!!') dummy from v$instance ;
EOF
------------------------------------------------------------------------------------------------
output of the program redirected to a file:
SQL*Plus: Release 8.1.6.0.0 - Production on Thu Apr 17 23:27:38 2003
(c) Copyright 1999 Oracle Corporation. All rights reserved.
Connected to an idle instance.
ORACLE instance started.
Database mounted.
SQL>
SQL*Plus: Release 8.1.6.0.0 - Production on Thu Apr 17 23:27:46 2003
(c) Copyright 1999 Oracle Corporation. All rights reserved.
Connected.
After the startdb.sh is executed the Database is up and running but the echo commands and output of SQL Queries in the
startdb.sh are not redirected to the output file where my validation is done. Only few lines and that too randomly are
redirected to the file.
Thank you very much for going thru my problem, if u have any suggestions please feel free to post them,
Thank you,
Srinivas Varala,
Oracle DBA Reston Tech Group.
|
|
|