Solved

oracle apache server

Posted on 2013-01-22
3
491 Views
Last Modified: 2013-01-23
Hi,
I keep getting an error when running a script from my oracle 11g http server;
If i run the script on the command line ( AIX ) it works fine but when i run through a URL on my 11g HTTP server i get the error below - the script works fine on the old 1og Apache server - is there something i am missing to check

SQL*Plus: Release 11.2.0.3.0 Production Copyright (c) 1982, 2011, Oracle. All rights reserved. Use SQL*Plus to execute SQL, PL/SQL and SQL*Plus statements. Usage 1: sqlplus -H | -V -H Displays the SQL*Plus version and the usage help. -V Displays the SQL*Plus version. Usage 2: sqlplus [ [] [{logon | /nolog}] [] ] is: [-C ] [-L] [-M ""] [-R ] [-S] -C Sets the compatibility of affected commands to the version specified by . The version has the form "x.y[.z]". For example, -C 10.2.0 -L Attempts to log on just once, instead of reprompting on error. -M "" Sets automatic HTML markup of output. The options have the form: HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text] [ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}] -R Sets restricted mode to disable SQL*Plus commands that interact with the file system. The level can be 1, 2 or 3. The most restrictive is -R 3 which disables all user commands interacting with the file system. -S Sets silent mode which suppresses the display of the SQL*Plus banner, prompts, and echoing of commands. is: {[/][@] | / } [AS {SYSDBA | SYSOPER | SYSASM}] [EDITION=value] Specifies the database account username, password and connect identifier for the database connection. Without a connect identifier, SQL*Plus connects to the default database. The AS SYSDBA, AS SYSOPER and AS SYSASM options are database administration privileges. can be in the form of Net Service Name or Easy Connect. @[ | [//]Host[:Port]/] is a simple name for a service that resolves to a connect descriptor. Example: Connect to database using Net Service Name and the database net service name is ORCL. sqlplus myusername/mypassword@ORCL Host specifies the host name or IP address of the database server computer. Port specifies the listening port on the database server. specifies the service name of the database you want to access. Example: Connect to database using Easy Connect and the Service name is ORCL. sqlplus myusername/mypassword@Host/ORCL The /NOLOG option starts SQL*Plus without connecting to a database. The EDITION specifies the value for Session Edition. is: @|[.] [ ...] Runs the specified SQL*Plus script from a web server (URL) or the local file system (filename.ext) with specified parameters that will be assigned to substitution variables in the script. When SQL*Plus starts, and after CONNECT commands, the site profile (e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile (e.g. login.sql in the working directory) are run. The files may contain SQL*Plus commands. Refer to the SQL*Plus User's Guide and Reference for more information.
0
Comment
Question by:hraja77
  • 2
3 Comments
 
LVL 1

Author Comment

by:hraja77
ID: 38805114
heres the script form my cgi-bin folder:

"blocking_locks.sh.old" 83 lines, 2116 characters
#!/bin/ksh
# This will list connected database users
#
print "Content-type: text/html\n\n"
print "<HTML>
<HEAD>"
DATE=`date +"%A %B %d %Y %T"`
echo "<H2>$DATE</H2>\n";
echo "  <title>WDF - WDFWMSDBPR Blocking Locks</title>"
echo "</HEAD>"
echo "<BODY align=centre>"

. /home/oracle/.profile

echo "<H1 align=center>WDF - WDFWMSDBPR Blocking Locks</H1>"

export NLS_DATE_FORMAT='DD-MON-YYYY'

RMAN_SCRIPTS_DIR=/home/oracle/scripts

#ctrlmpwd=$($RMAN_SCRIPTS_DIR/get_pass.sh ctrlm system)
systempwd=`$GET_PASS wmsp system`
#echo " ctrlmpwd=$ctrlmpwd"

# access the database on sched_01
/oracle/product/11.2.0/bin/sqlplus -s  system/${systempwd}@wmsp  2>/dev/null <<EOF
SET FEEDBACK OFF
SET TERMOUT OFF
set trimout on
set linesize 80
SET PAGES 500
SET MARKUP HTML ON
SET NUMWIDTH 15
SELECT  /*+ RULE */
    l.session_id
   ,l.ORACLE_USERNAME
   ,l.OS_USER_NAME
   ,s.program
   ,o.OBJECT_NAME
   ,o.OBJECT_TYPE
   ,s.status
   ,decode(s.lockwait,null,'NO',s.lockwait,'BLOCKED') block
   ,round(((((TO_NUMBER(TO_CHAR(SYSDATE,     'J'))*86400) +
                       (TO_NUMBER(TO_CHAR(SYSDATE,     'SSSSS')))) -
                      ((TO_NUMBER(TO_cHAR(s.logon_time,'J'))*86400) +
                       (TO_NUMBER(TO_CHAR(s.logon_time,'SSSSS')))))/60),2) time
   ,floor(last_call_et/3600)||':'||
    floor(mod(last_call_et,3600)/60)||':'||
    mod(mod(last_call_et,3600),60) idle
  FROM  v\$locked_object l,
        dba_objects o,
        v\$session s
  WHERE l.OBJECT_ID = o.OBJECT_ID
        AND   s.sid = l.session_id
/
SELECT count(*) " Total Locks Found"
  FROM  v\$locked_object l,
        dba_objects o,
        v\$session s
  WHERE l.OBJECT_ID = o.OBJECT_ID
        AND   s.sid = l.session_id
/
select * from dba_lock where session_id > 9
/
select * from dba_blockers
/
select * from dba_blockers
/
 select distinct(program), username, count(*) from v\$session
 where username is not null
 group by program, username
 order by 3
/
 select count(*) "Total Sessions" from v\$session
 --where username is not null
 order by 1
/
exit;
EOF

print "</BODY>
</HTML>"
exit 0
0
 
LVL 34

Accepted Solution

by:
johnsone earned 500 total points
ID: 38805558
Based on the output that you are seeing, my guess is that your call to GET_PASS is failing.  That is causing the systempwd to contain nothing, or something that SQL*Plus does not understand.

If you run:

sqlplus -s system/@wmsp

You will see the same output that you are seeing.
0
 
LVL 1

Author Closing Comment

by:hraja77
ID: 38808959
thanks - you are right
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now