Example of scheduling the Shell or batch script in DBMS Schedule.
Create a Credential Store in Oracle Database with existing OS User.
BEGIN
dbms_credential.create_credential (
CREDENTIAL_NAME => 'ORACLEUSER',
USERNAME => 'oracle',
PASSWORD => 'oracle@123',
DATABASE_ROLE => NULL,
WINDOWS_DOMAIN => NULL,
COMMENTS => 'Oracle OS User',
ENABLED => true
);
END;
/
Use that Credential in DBMS Scheduler job having writes to execute the Shell Script. Create DBMS Scheduler job which executing the shell script
-- Create the job:
BEGIN
dbms_scheduler.create_job(
job_name=>'JOB1',
job_type=>'external_script',
job_action=>'/u01/app/oracle/test.sh',
enabled=>true,
START_DATE=>sysdate,
REPEAT_INTERVAL =>'FREQ=MINUTELY; byminute=1',
auto_drop=>false,
credential_name=>'ORACLEOSUSER');
END;
/