![]() ![]() When you create the credential for the database connection, you need to supply the relevant "tnsnames.ora" entry or you will have connection problems, especially on multitenant environments.The credential supplied in the CREATE_JOB command is the OS user that will run SQL*Plus, not the database connection credential. ![]() There are a few things to notice about these examples. Set the credential used for SQL*Plus to The credential supplied is the OS user that should using a credential, rather than an explicit connect. Create a job with a SQL*Plus script defined in-line, Notice the service is included in the username. To counter that, the SQL*Plus connection can be put into a credential itself, as shown in the following example.ĬONN Create a credential so SQL*Plus connects The previous script required an explicit connect, which is not very secure. Notice the explicit database connection in the script. The JOB_TYPE of SQL_SCRIPT runs the specified job as a SQL*Plus script, which means you get access to all the SQL*Plus functionality without having to manually shell out to the operating system and initiate SQL*Plus.ĬONN Create a job with a SQL*Plus script defined in-line, Notice the use of the credential, which indicates which OS user the script should run as, and provides authentication. L_job_name := DBMS_SCHEDULER.generate_job_name ĭBMS_OUTPUT.put_line('JOB_NAME=' || l_job_name) On UNIX/Linux servers the script is run using "sh", unless the first line of the script indicates a specific shell using a shebang, for example "#!/bin/bash".ĬONN Create a job with a shell script defined in-line. On Windows servers the script is run using "cmd.exe". It can also be used to run an existing script by specifying the full file system path to the script in the JOB_ACTION parameter. The JOB_TYPE of EXTERNAL_SCRIPT is similar to an EXECUTABLE job, except that it allows you to build a script on the fly and run it as the JOB_ACTION, as if it were an existing shell script. With these in place, we can look at the three new job scripts. correct OS user on the database server. The following permissions are necessary to allow the "TEST" user to run the examples in this article.Īll the examples use the following credential to allow them to authenticate to the OS user that runs the job.ĬONN Create a credential so script is run as the They will also need credentials to access an OS user. As a result, they require the CREATE JOB and CREATE EXTERNAL JOB privileges. ![]() ![]() They don't provide anything that was not already possible, but they reduce the likelihood of mistakes and make task-specific schedules much clearer.Īll three of the new script jobs are essentially external jobs for running shell scripts, SQL*Plus or RMAN. Script jobs are all about improving the ease of use of the Oracle Scheduler.
0 Comments
Leave a Reply. |