commit b9b23f13defeb9dc17264cfee3986f4eb764c564 Author: jsmith Date: Mon Feb 17 06:59:03 2020 -0600 initial commit diff --git a/Linux/Descriptive/swap_info.sh b/Linux/Descriptive/swap_info.sh new file mode 100755 index 0000000..02fa7a2 --- /dev/null +++ b/Linux/Descriptive/swap_info.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Get current swap usage for all running processes +# Erik Ljungstrom 27/05/2011 +# Modified by Mikko Rantalainen 2012-08-09 +# Pipe the output to "sort -nk3" to get sorted output +# Modified by Marc Methot 2014-09-18 +# removed the need for sudo + +SUM=0 +OVERALL=0 +for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"` +do + PID=`echo $DIR | cut -d / -f 3` + PROGNAME=`ps -p $PID -o comm --no-headers` + for SWAP in `grep VmSwap $DIR/status 2>/dev/null | awk '{ print $2 }'` + do + let SUM=$SUM+$SWAP + done + if (( $SUM > 0 )); then + echo "PID=$PID swapped $SUM KB ($PROGNAME)" + fi + let OVERALL=$OVERALL+$SUM + SUM=0 +done \ No newline at end of file diff --git a/Oracle/block_usage.sql b/Oracle/block_usage.sql new file mode 100644 index 0000000..6e3c9d3 --- /dev/null +++ b/Oracle/block_usage.sql @@ -0,0 +1,12 @@ +alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'; + set lines 200 + set pages 100 + col osuser for a15 + col username for a15 + col program for a20 + col module for a20 + col machine for a40 + col status for a11 + col logon_time for a20 + col sql_fulltext for a70 word_wrapped + SELECT s.sid, s.serial#, s.username, s.osuser, s.machine, sq.sql_fulltext FROM v$session s join v$sql sq ON s.sql_id=sq.sql_id JOIN v$sort_usage su ON s.saddr = su.session_addr order by su.blocks desc; \ No newline at end of file diff --git a/Oracle/blocking_session.sql b/Oracle/blocking_session.sql new file mode 100644 index 0000000..8420c42 --- /dev/null +++ b/Oracle/blocking_session.sql @@ -0,0 +1 @@ +select blocking_session, sid, sql_id, serial#, username, wait_class, seconds_in_wait from v$session; \ No newline at end of file diff --git a/Oracle/tablespace_usage.sql b/Oracle/tablespace_usage.sql new file mode 100644 index 0000000..216a162 --- /dev/null +++ b/Oracle/tablespace_usage.sql @@ -0,0 +1 @@ +select df.tablespace_name "Tablespace", totalusedspace "Used MB", (df.totalspace - tu.totalusedspace) "Free MB", df.totalspace "Total MB", round(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace)) "Pct. Free"from (select tablespace_name, round(sum(bytes) / 1048576) TotalSpace from dba_data_files group by tablespace_name) df, (select round(sum(bytes)/(1024*1024)) totalusedspace, tablespace_name from dba_segments group by tablespace_name) tu where df.tablespace_name = tu.tablespace_name ; \ No newline at end of file