Which osuser is running DBMS_SCHEDULER jobs?

236 Views Asked by At

On my oracle database I am trying to figure out which osuser presents in sessions during running dbms_scheduler jobs. I can't check it myself, because in my company there is a trigger using triggering_event = 'LOGON', and simply not allowing me to start jobs in background, but i can add exceptions for osuser, but unfortunetelly i don't know which osuser is starting those jobs.

1

There are 1 best solutions below

0
William Robertson On

Quick test on my laptop db running 19c and Oracle Cloud 21c (results were the same):

begin
    dbms_scheduler.create_job
    ( job_name     => 'DEMO_JOB'
    , job_type     => 'PLSQL_BLOCK'
    , job_action   => q'[begin dbms_output.put_line('USER = '||user||', os_user = '||sys_context('userenv','os_user')); end;]' 
    , start_date   => systimestamp
    , enabled      => true );
end;
select output from user_scheduler_job_run_details where job_name = 'DEMO_JOB';

OUTPUT
--------------------------------------------------------------------------------
USER = WILLIAM, os_user = oracle

This is the same OS user (oracle) as I see on production databases. Database installation isn't really my area but I recall that you can set one or more OS users as the owners of the Oracle software and background processes, with 'oracle' being the default.