Monday, September 5, 2022

df –h find . -ls | sort -nrk7 | head -10 du -S . | sort -nr | head -10 #!/bin/bash mntlist="/orahome /oraredo1 /oraarch1 /ora01 /oradump01 /" for ml in $mntlist do echo $ml usedSpc=$(df -h $ml | awk '{print $5}' | grep -v capacity | cut -d "%" -f1 -) BOX=$(uname -a | awk '{print $2}') # case $usedSpc in [0-9]) arcStat="relax, lots of disk space: $usedSpc" ;; [1-7][0-9]) arcStat="disk space okay: $usedSpc" ;; [8][0-9]) arcStat="space getting low: $usedSpc" ;; [9][0-9]) arcStat="warning, running out of space: $usedSpc" echo $arcStat $ml | mailx -s "space on: $BOX" dkuhn@gmail.com ;; [1][0][0]) arcStat="update resume, no space left: $usedSpc" echo $arcStat $ml | mailx -s "space on: $BOX" dkuhn@gmail.com ;; *) arcStat="huh?: $usedSpc" esac # BOX=$(uname -a | awk '{print $2}') echo $arcStat # done # exit 0 usedSpc=$(df -h $ml | awk '{print $5}' | grep -v capacity | cut -d "%" -f1 -) usedSpc=$(df -h $ml | grep % | grep -v Use | awk '{print $4}' | cut -d "%" -f1 -) #----------------------------------------------------------------- # Filesystem check 7 * * * * /orahome/oracle/bin/filesp.bsh 1>/orahome/oracle/bin/log/filesp.log 2>&1 #----------------------------------------------------------------- ## ps -e -o pcpu,pid,user,tty,args | sort -n -k 1 -r | head ps -e -o pmem,pid,user,tty,args | sort -n -k 1 -r | head alias topc='ps -e -o pcpu,pid,user,tty,args | sort -n -k 1 -r | head' alias topm='ps -e -o pmem,pid,user,tty,args | sort -n -k 1 -r | head' ## time dd if=/u01/dbfile/O12C/system01.dbf of=test.out SELECT a.username, a.sql_id, b.object_name, b.object_type, a.event FROM v$session a ,dba_objects b ,v$event_name c WHERE b.object_id = a.row_wait_obj# AND a.event = c.name AND c.wait_class = 'User I/O'; ## SELECT 'USERNAME : ' || s.username || CHR(10) || 'SCHEMA : ' || s.schemaname || CHR(10) || 'OSUSER : ' || s.osuser || CHR(10) || 'MODUEL : ' || s.program || CHR(10) || 'ACTION : ' || s.schemaname || CHR(10) || 'CLIENT_INFO : ' || s.osuser || CHR(10) || 'PROGRAM : ' || s.program || CHR(10) || 'SPID : ' || p.spid || CHR(10) || 'SID : ' || s.sid || CHR(10) || 'SERIAL# : ' || s.serial# || CHR(10) || 'KILL STRING : ' || '''' || s.sid || ',' || s.serial# || '''' || CHR(10) || 'MACHINE : ' || s.machine || CHR(10) || 'TYPE : ' || s.type || CHR(10) || 'TERMINAL : ' || s.terminal || CHR(10) || 'SQL ID : ' || q.sql_id || CHR(10) || 'CHILD_NUM : ' || q.child_number || CHR(10) || 'SQL TEXT : ' || q.sql_text FROM v$session s ,v$process p ,v$sql q WHERE s.paddr = p.addr AND p.spid = '&PID_FROM_OS' AND s.sql_id = q.sql_id(+) AND s.status = 'ACTIVE';