initial commit

This commit is contained in:
jsmith 2020-02-17 06:59:03 -06:00
commit b9b23f13de
4 changed files with 38 additions and 0 deletions

24
Linux/Descriptive/swap_info.sh Executable file
View File

@ -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

12
Oracle/block_usage.sql Normal file
View File

@ -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;

View File

@ -0,0 +1 @@
select blocking_session, sid, sql_id, serial#, username, wait_class, seconds_in_wait from v$session;

View File

@ -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 ;