今天主要简单介绍一下DBA_SCHEDULER_CREDENTIALS和常用的三个脚本。
COLUMN credential_name FORMAT A25 COLUMN username FORMAT A20 COLUMN windows_domain FORMAT A20 SELECT credential_name, username, windows_domain FROM dba_scheduler_credentials ORDER BY credential_name;
SET VERIFY OFF SET SERVEROUTPUT ON DECLARE l_clob CLOB; l_additional_info VARCHAR2(4000); l_external_log_id VARCHAR2(50); BEGIN SELECT additional_info, external_log_id INTO l_additional_info, l_external_log_id FROM (SELECT log_id, additional_info, REGEXP_SUBSTR(additional_info,'job[_0-9]*') AS external_log_id FROM dba_scheduler_job_run_details WHERE job_name = UPPER('&1') ORDER BY log_id DESC) WHERE ROWNUM = 1; DBMS_OUTPUT.put_line('ADDITIONAL_INFO: ' || l_additional_info); DBMS_OUTPUT.put_line('EXTERNAL_LOG_ID: ' || l_external_log_id); DBMS_LOB.createtemporary(l_clob, FALSE); DBMS_SCHEDULER.get_file( source_file => l_external_log_id ||'_stdout', credential_name => UPPER('&2'), file_contents => l_clob, source_host => NULL); DBMS_OUTPUT.put_line('stdout:'); DBMS_OUTPUT.put_line(l_clob); END; /
SET LINESIZE 300 VERIFY OFF COLUMN log_date FORMAT A35 COLUMN owner FORMAT A20 COLUMN job_name FORMAT A30 COLUMN error FORMAT A20 COLUMN req_start_date FORMAT A35 COLUMN actual_start_date FORMAT A35 COLUMN run_duration FORMAT A20 COLUMN credential_owner FORMAT A20 COLUMN credential_name FORMAT A20 COLUMN additional_info FORMAT A30 SELECT log_date, owner, job_name, status error, req_start_date, actual_start_date, run_duration, credential_owner, credential_name, additional_info FROM dba_scheduler_job_run_details WHERE job_name = DECODE(UPPER('&1'), 'ALL', job_name, UPPER('&1')) ORDER BY log_date;
觉得有用的朋友多帮忙转发哦!后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~