-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
182 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
col param for a25; | ||
col value for a80; | ||
|
||
with | ||
function get_scheduler_attribute(param in varchar2) return varchar2 is | ||
res varchar2(100); | ||
begin | ||
dbms_scheduler.get_scheduler_attribute(param,res); | ||
return res; | ||
end; | ||
current_values(param,value,status) as ( | ||
select 'SCHEDULER_DISABLED' | ||
,nvl(get_scheduler_attribute('SCHEDULER_DISABLED'),'FALSE') | ||
,case when nvl(upper(get_scheduler_attribute('SCHEDULER_DISABLED')),'FALSE')='FALSE' then 'ok' | ||
else 'error' | ||
end | ||
from dual | ||
union all | ||
select name | ||
,value | ||
,case when value>0 then 'ok' else 'error' end | ||
from v$parameter where name like 'job_queue_processes' | ||
union all | ||
select 'last_start_date' | ||
,to_char(max(j.last_start_date),'yyyy-mm-dd hh24:mi:ss') | ||
,case when max(j.last_start_date)>sysdate-interval'5' minute then 'ok' else 'error' end | ||
from all_scheduler_jobs j | ||
where j.owner='TMDDBA' | ||
and job_name like 'DR$%' | ||
union all | ||
select index_name | ||
,status||'/'||i.DOMIDX_STATUS||'/'||i.domidx_opstatus | ||
,'error' | ||
from all_indexes i | ||
where owner='TMDDBA' | ||
and index_type='DOMAIN' | ||
and (status!='VALID' | ||
or domidx_status!='VALID' | ||
or domidx_opstatus!='VALID') | ||
) | ||
select * | ||
from current_values | ||
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
col param for a25; | ||
col value for a80; | ||
|
||
with | ||
function get_scheduler_attribute(param in varchar2) return varchar2 is | ||
res varchar2(100); | ||
begin | ||
dbms_scheduler.get_scheduler_attribute(param,res); | ||
return res; | ||
end; | ||
current_values(param,value,status) as ( | ||
select 'SCHEDULER_DISABLED' | ||
,nvl(get_scheduler_attribute('SCHEDULER_DISABLED'),'FALSE') | ||
,case when nvl(upper(get_scheduler_attribute('SCHEDULER_DISABLED')),'FALSE')='FALSE' then 'ok' | ||
else 'error' | ||
end | ||
from dual | ||
union all | ||
select name | ||
,value | ||
,case when value>0 then 'ok' else 'error' end | ||
from v$parameter where name like 'job_queue_processes' | ||
union all | ||
select 'last_start_date' | ||
,to_char(max(j.last_start_date),'yyyy-mm-dd hh24:mi:ss') | ||
,case when max(j.last_start_date)>sysdate-interval'5' minute then 'ok' else 'error' end | ||
from all_scheduler_jobs j | ||
where j.owner='TMDDBA' | ||
and job_name like 'DR$%' | ||
union all | ||
select index_name | ||
,status||'/'||i.DOMIDX_STATUS||'/'||i.domidx_opstatus | ||
,'error' | ||
from all_indexes i | ||
where owner='TMDDBA' | ||
and index_type='DOMAIN' | ||
and (status!='VALID' | ||
or domidx_status!='VALID' | ||
or domidx_opstatus!='VALID') | ||
) | ||
select * | ||
from current_values | ||
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exec dbms_scheduler.set_scheduler_attribute('SCHEDULER_DISABLED','TRUE'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exec dbms_scheduler.set_scheduler_attribute('SCHEDULER_DISABLED','FALSE'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
col owner format a30; | ||
col "JOB_NAME/SUBNAME" format a40; | ||
col last_start_date format a45; | ||
col last_run_duration format a16; | ||
col next_run_date format a45; | ||
|
||
-------------------- ------------------------------ ------------------------------ --------------------------------- --------------- ---------- ---------- ------ ---------------- ----------------- - | ||
select | ||
jr.OWNER | ||
,jr.JOB_NAME||nvl2(jr.JOB_SUBNAME,'('||jr.JOB_SUBNAME||')','') "JOB_NAME/SUBNAME" | ||
,last_start_date | ||
,cast(last_run_duration AS INTERVAL DAY(1) TO SECOND(3)) as last_run_duration | ||
,next_run_date | ||
from dba_scheduler_jobs jr | ||
where 1=1 | ||
; | ||
col owner clear; | ||
col "JOB_NAME/SUBNAME" clear; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,33 @@ | ||
set serverout on; | ||
|
||
accept _dir_name prompt "Directory name: "; | ||
accept _f_mask prompt "File mask: "; | ||
accept _max_files prompt "Max number of files to output[100] :" default 100; | ||
declare | ||
PROCEDURE LIST_FILES (lp_string IN VARCHAR2 default null) | ||
PROCEDURE LIST_FILES (dir_name in varchar2, file_mask IN VARCHAR2 default null, max_files in number default 100) | ||
AS | ||
lv_pattern VARCHAR2(1024); | ||
lv_ns VARCHAR2(1024); | ||
BEGIN | ||
SELECT directory_path | ||
INTO lv_pattern | ||
FROM dba_directories | ||
WHERE directory_name = '&1'; | ||
WHERE directory_name LIKE list_files.dir_name; | ||
|
||
SYS.DBMS_BACKUP_RESTORE.SEARCHFILES(lv_pattern, lv_ns); | ||
|
||
FOR file_list IN ( | ||
SELECT FNAME_KRBMSFT AS file_name | ||
FROM sys.X$KRBMSFT | ||
WHERE FNAME_KRBMSFT LIKE '%'|| lp_string||'%' | ||
WHERE FNAME_KRBMSFT LIKE '%'|| file_mask||'%' | ||
and rownum< max_files | ||
) | ||
LOOP | ||
dbms_output.put_line(file_list.file_name); | ||
END LOOP; | ||
|
||
END; | ||
begin | ||
list_files(''); | ||
list_files('&_dir_name', '&_f_mask', &_max_files); | ||
end; | ||
/ | ||
set serverout off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--set serverout on; | ||
accept _dir_name prompt "Directory name: "; | ||
accept _f_mask prompt "File mask: "; | ||
accept _max_files prompt "Max number of files to output[100] :" default 100; | ||
declare | ||
PROCEDURE LIST_FILES (dir_name in varchar2, file_mask IN VARCHAR2 default null, max_files in number default 100) | ||
AS | ||
lv_pattern VARCHAR2(1024); | ||
lv_ns VARCHAR2(1024); | ||
BEGIN | ||
SELECT directory_path | ||
INTO lv_pattern | ||
FROM dba_directories | ||
WHERE directory_name LIKE list_files.dir_name; | ||
|
||
SYS.DBMS_BACKUP_RESTORE.SEARCHFILES(lv_pattern, lv_ns); | ||
|
||
FOR file_list IN ( | ||
) | ||
LOOP | ||
dbms_output.put_line(file_list.file_name); | ||
END LOOP; | ||
|
||
END; | ||
begin | ||
list_files('&_dir_name', '&_f_mask', &_max_files); | ||
end; | ||
/ | ||
--set serverout off | ||
|
||
SELECT FNAME_KRBMSFT AS file_name | ||
FROM sys.X$KRBMSFT | ||
WHERE FNAME_KRBMSFT LIKE '%&_f_mask%' | ||
and rownum< &_max_files; | ||
|
||
SELECT count(*) cnt | ||
FROM sys.X$KRBMSFT | ||
WHERE FNAME_KRBMSFT LIKE '%&_f_mask%'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
col MEMBER for a45; | ||
select * from v$logfile order by group#,member; | ||
col MEMBER clear; |