查看磁盘空间&磁盘监控脚本
select name,usable_file_mb/1024 from v$asm_diskgroup;
select 'Diskgroup capacity alert:' alert_reason,i.instance_name,substr(d.name,1,10),d.total_mb,d.free_mb,d.state,d.USABLE_FILE_MB,(d.total_mb-d.free_mb)/(d.total_mb+1)*100 usage from v$asm_diskgroup d,v$instance i where d.free_mb/d.total_mb < 0.3 and d.name != 'MDADG' and SUBSTR(D.NAME,1,10) not in ('DATADG','DATA01');
select 'Diskgroup state alert:' alert_reason,i.instance_name,d.name,d.state from v$asm_diskgroup d ,v$instance i where d.state != 'CONNECTED' and d.state !='MOUNTED';
select 'hostname-db:' hostname,name,total_mb,free_mb,state,USABLE_FILE_MB,(total_mb-free_mb)/(total_mb+1)*100 usage from v$asm_diskgroup where free_mb/total_mb < 0.3;
select 'hostname-db:' hostname,name,state from v$asm_diskgroup where state != 'CONNECTED' and state !='MOUNTED';
select 'hostname-db:' hostname,path,STATE,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS from v$asm_disk where HEADER_STATUS != 'MEMBER';
《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《
杀job:
select username,sid,paddr from gv$session where username='' and program like 'J00%'
select username,sid,paddr,serial# from gv$session where program like 'J00%'
select username,sid,paddr,serial#,status from gv$session where username='';
select * from dba_jobs_running;
如果发现准备杀死的job不在筛选出来的正在runing的job中,运行下面sql
select sid,username,PROGRAM from gv$session where sid not in(select sid from dba_jobs_running) AND username='SCS' AND NOT LIKE 'JDBC Thin Client'
选出僵死的job,然后杀掉
2,
select '!kill -9 ' ||spid from v$process where addr in (select paddr from v$session where sid=1686);
3,开始run一个job启不来时,可以看看有没有在等待的event,
select sid,event,p1,p3,p2 from gv$session where event not like '%message%'
4 ,查看job的状态
select sid,dj.job,schema_user,broken from dba_jobs_running djr join dba_jobs dj on djr.job=dj.job and schema_user=SSD;
创建job:
sys.dbms_ijob.submit(job=>job_num,luser=>’&&LOGUSER’,puser=>’&&PRIVUSER’,cuser=>’&&SCHEMAUSER’,what=>’&&WHAT’,next_date=>&&NEXTDATE, interval=>’&&INTERVAL’, broken=>FALSE);
BEGIN
sys.dbms_ijob.submit(job=>job_num,luser=>'MCC_METADATA',puser=>'MCC_METADATA',cuser=>'MCC_METADATA',what => 'mcc_metadata_temp_delete;'
,next_date => to_date('01-01-4000 00:00:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'sysdate+1',
broken=>TRUE);
COMMIT;
END;
/