Getting error while getting status of active and inactive sessions from ORACLE DB
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.