I have a Linux script run periodically from crontab which executes some sql scripts. How can I get/identify the session of that running job?
thanks
|
|
Like ik_zelf said, try to be more explicit. If you need the session info, for the script that runs from crontab, then the query below will give you some details:
I imagine that the the shell script is using sqlplus. The output should look like:
|
|||
|
|
In order to find a specific session running a certain script, it is easiest if the scripts makes itself identifiable by using dbms_application_info and dbms_session. See Morgans Library for details. Also see track the parts of my application that are in use for sample code. Doing so enables you to select on v$session and filter not only on username and machine but also on module, action, client_info and client_id. Username and machine are not mutable but the other columns are controlled by dbms_application_info and dbms_session. Using those makes your script recognizable. This of course, only works when the other session has select privileges on v_$session. dbms_application_info is also great for finding where your code is running; a way to instrumentate your code to make performance analysis easier. your code in SQLdeveloper would be as simple as
The code added in the script to make this work would be
|
||||
|