LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-26-2010, 10:54 PM   #1
saurabhmehan
Member
 
Registered: Jul 2010
Posts: 44

Rep: Reputation: 0
Question Getting error while getting status of active and inactive sessions from ORACLE DB


Hi All,

I have a written a test script which retrieves the status of active and inactive sessions from oracle DB, but i am receiving error while executing.

My script is
Code:
filepath="/home/ocsg/scripts/db_session_report/current_session_report.txt"
INACTIVE_SESSIONS=`/home/ocsg/client10g/bin/sqlplus -s abc/abc@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.0.1)(PORT=1521)))(CONNECT_DATA=(SID=test)))' << EOFSQL
set head off
select count(*) from V$SESSION;
exit;
EOFSQL`
echo $INACTIVE_SESSIONS > $filepath
echo DB SESSION REPORT : $INACTIVE_SESSIONS
and error i receive when executing the above script is as follows:
Code:
db_session_alert ERROR at line 1: ORA-04044: procedure, function, package, or type is not allowed here
Please help me where i am wrong in the above script.
 
Old 09-27-2010, 10:58 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,915

Rep: Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689
Quote:
Originally Posted by saurabhmehan View Post
Hi All,

I have a written a test script which retrieves the status of active and inactive sessions from oracle DB, but i am receiving error while executing.

My script is
Code:
filepath="/home/ocsg/scripts/db_session_report/current_session_report.txt"
INACTIVE_SESSIONS=`/home/ocsg/client10g/bin/sqlplus -s abc/abc@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.0.1)(PORT=1521)))(CONNECT_DATA=(SID=test)))' << EOFSQL
set head off
select count(*) from V$SESSION;
exit;
EOFSQL`
echo $INACTIVE_SESSIONS > $filepath
echo DB SESSION REPORT : $INACTIVE_SESSIONS
and error i receive when executing the above script is as follows:
Code:
db_session_alert ERROR at line 1: ORA-04044: procedure, function, package, or type is not allowed here
Please help me where i am wrong in the above script.
Obviously, based on the error message, you'd have the problem on line 1, as it clearly says. So, move that line to further down in your script, or check the syntax of what you're trying to do.
 
Old 09-27-2010, 11:39 AM   #3
healyma
Member
 
Registered: Feb 2009
Location: Mayo, Ireland
Distribution: LFS 6.4; Debian 5.4; Mythbuntu & Kubuntu 10.04
Posts: 49

Rep: Reputation: 19
That test script looks like it should be typed into a console (especially the EOFSQL stuff). Put the bold part below on one line in your script and see if it works

filepath="/home/ocsg/scripts/db_session_report/current_session_report.txt"
/home/ocsg/client10g/bin/sqlplus -s abc/abc@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP(HOST=10.0.0.1)(PORT=1521)))(CONNECT_DATA=(SID =test)))' set head off select count(*) from V$SESSION; exit; > $filepath
echo DB SESSION REPORT : $INACTIVE_SESSIONS
 
  


Reply

Tags
asap


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[2.6.34]ARP replies from inactive slave in active-backup bond. StamPit Linux - Kernel 1 09-21-2010 05:41 AM
determining if system is active or inactive i.you Linux - Software 1 02-07-2010 09:13 PM
How to disconnect inactive ssh sessions ? sultf Linux - Newbie 3 02-04-2009 03:28 PM
defunct/inactive telnet sessions tpmadigan Linux - Enterprise 2 02-04-2008 09:56 AM
Neat : After wireless Active, it become Inactive Again yteckong Linux - Wireless Networking 4 05-09-2007 08:00 AM


All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration