Sunday, April 15, 2007

List highest diskspace users in /var directory

List highest diskspace users in /var directory
use sort -nr to sort the output giving lowest at bottom

du -k /var | sort -nr | pg

redirecting ufsdump output to log file

http://www.sunmanagers.org/pipermail/summaries/2004-March/005136.html

Wednesday, April 11, 2007

exporting the oracle sid within unix id on cluster when they share the filesystem

#!/usr/bin/ksh
hs=$HOST
echo $hs
case $hs in
sun1)export ORACLE_SID=ABC1;
echo $ORACLE_SID;;
sun2)export ORACLE_SID=ABC2;
echo $ORACLE_SID;;
*)echo Not a valid host
esac

to check details of id running the processes which are identified from ps listing

to check details of id running the processes which are identified from ps listing

select b.username,b.schemaname,b.osuser,b.process,b.machine,b.terminal from v$session b,v$process a where b.paddr=a.addr and a.spid='&1'

Tuesday, April 10, 2007

currently executing sqls for the users

Following gives the active SQL all current users are executing

select v.sid,
v.username,
optimizer_mode,
hash_value,
address,
cpu_time,
elapsed_time,
sql_text
from v$s s, v$session v
where v.sql_hash_value = s.hash_value
and v.sql_address = s.address
and v.username is not null

Entry for April 11, 2007

buffer gets for cpu util
disk reads for disk i/o
sorts for sorting in sqlarea

to get buffer gets higher than some large value
SQL> select a.buffer_gets,a.disk_reads,a.sorts,a.address from v$sqlarea a where a.buffer_gets>1000000;

use similar for getting the other address of interest for disk i/o or sorts

once the address is found for ex.070000002ADDE608 for the highest sorts of 284

BUFFER_GETS DISK_READS SORTS ADDRESS
----------- ---------- ---------- ----------------
1557764 1553482 284 070000002ADDE608
1405968 27827 1 070000002879F370
1407953 27862 0 07000000287D4330
6897100 2659578 0 0700000029F8D330



use
SQL> select SQL_TEXT,PIECE from v$sqltext where address='070000002ADDE608' order by PIECE;

SQL_TEXT PIECE
---------------------------------------------------------------- ----------
SELECT DQD_FIN_ID , DQD_DIS_NO , SUM(DQD_DEMAT_QTY) FROM DMAT_QT 0
Y_DIS_ELEC WHERE DQD_NPN = :B1 GROUP BY DQD_FIN_ID , DQD_DIS_NO 1
2