Note that there are some explanatory texts on larger screens.

plurals
  1. POSchedule job that will run as specific user
    primarykey
    data
    text
    <p>I'm trying to create a job that will run a stored procedure as a specific user which I can create and provide with the limited permissions to do only what is required.</p> <p>From what I have read I need to create the user (pretty standard) and then create a credential entry by performing;</p> <pre><code>dbms_scheduler.create_credential('[cred name]', '[Oracle User]', '[Oracle Password]'); </code></pre> <p>Once I have the credential created I try to use it in the job creation script;</p> <pre><code>dbms_scheduler.create_job( job_name =&gt; 'myJobName', job_type =&gt; 'stored_procedure', job_action =&gt; 'myStoredProcedure', credential_name =&gt; 'jobRunningUserCredential', destination_name =&gt; NULL); </code></pre> <p>The problem that I am having is that when this is run I get the following error message;</p> <pre><code>ora-27351 conflicting values of job attributes credential_name and job_type </code></pre> <p>I was wondering whether anyone can see something that I've missed out or whether I am just barking up the wrong tree with this approach in which case any recommendations are welcome.</p> <p>Thanks for any help/advice in advance.</p> <p>Sam</p> <p><strong>UPDATE:</strong></p> <p>After receiving the suggestion to use alter_chain I have implemented the following code;</p> <pre><code>dbms_scheduler.create_chain('myjob_chain', NULL, NULL, NULL); dbms_scheduler.define_chain_step('myjob_chain', 'step_name', 'schemaName'); dbms_scheduler.define_chain_step('myjob_chain', 'parallel_instances', 'schemaName'); dbms_scheduler.define_chain_step('myjob_chain', 'enable_job', 'schemaName'); dbms_scheduler.enable('myjob_chain'); dbms_scheduler.alter_chain('myjob_chain', 'step_name', 'credential_name', 'myCredential'); dbms_scheduler.create_job( job_name =&gt; 'myJobName', job_type =&gt; 'stored_procedure', job_action =&gt; 'myStoredProcedure', credential_name =&gt; 'jobRunningUserCredential', destination_name =&gt; NULL); dbms_output.put_line('job created'); dbms_scheduler.alter_chain('myjob_chain', 'set_parallel_instances', 'credential_name', 'myCredential'); dbms_scheduler.set_attribute( name =&gt; 'myJobName', attribute =&gt; 'parallel_instances', value =&gt; TRUE); dbms_output_put_line('parallel_instances'); dbms_scheduler.alter_chain('myjob_chain', 'enable_job', 'credential_name', 'myCredential'); dbms_scheduler.enable(name =&gt; 'myJobName'); dbms_output_put_line('enable'); </code></pre> <p>The output that this gives me is;</p> <pre><code>job created parallel_instances BEGIN * ERROR at line 1: ORA-27351: conflicting values of job attributes CREDENTIAL_NAME and JOB_TYPE ORA-06512: at "SYS.DBMS_ISCHED", line 4395 ORA-06512: at "SYS.DBMS_SCHEDULER", line 2803 ORA-06512: at line 67 </code></pre> <p>Any suggestions are greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload