-
Notifications
You must be signed in to change notification settings - Fork 5
/
die.sh
71 lines (55 loc) · 2.12 KB
/
die.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
ps -ef | grep pmon | grep -v grep | grep -v perl | grep -v ASM | grep `echo $ORACLE_SID` | \
while read PMON; do
INST=`echo $PMON | awk {' print $8 '} | cut -f3 -d_`
echo "instance: $INST"
export ORACLE_SID=$INST
export ORAENV_ASK=NO
. oraenv
sqlplus -s /nolog <<-EOF
connect / as sysdba
set head off
set lines 200
select 'Connected to: '|| INSTANCE_NAME from v\$instance;
spool TERMINATE_SESSIONS_$INST.SQL
select /* usercheck */ 'alter system disconnect session '''||s.sid||','||s.serial#||''''||' post_transaction;'
from v\$process p, v\$session s, v\$sqlarea sa
where p.addr=s.paddr
and s.username is not null
and s.sql_address=sa.address(+)
and s.sql_hash_value=sa.hash_value(+)
and sa.sql_text NOT LIKE '%usercheck%'
and lower(sa.sql_text) LIKE '%cputoolkit%'
order by status desc;
spool off
set echo on
set feedback on
@TERMINATE_SESSIONS_$INST.SQL
var name varchar2(50)
BEGIN
select /* usercheck */ address||','||hash_value into :name
from v\$sqlarea
where sql_text NOT LIKE '%usercheck%'
and lower(sql_text) NOT LIKE '%declare%'
and lower(sql_text) LIKE '%cputoolkit%';
dbms_shared_pool.purge(:name,'C',1);
END;
/
undef name
! rm TERMINATE_SESSIONS_$INST.SQL
EOF
echo '-----'
echo
echo
done
kill -9 `ps -ef | grep -i "./sql_detail" | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep -i "./loadprof" | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep -i "./gas" | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep -i "./ash_detail" | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep -i "./ash_workload" | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep -i "./snapper" | grep -v grep | awk '{print $2}'`
fuser -k vmstat.txt
fuser -k mpstat.txt
fuser -k collectl-cpuverbose.txt
kill -9 `ps -ef | grep -i "sh cputoolkit" | grep -v grep | awk '{print $2}'`
echo "welcome1" | sudo -S kill -9 `ps -ef | grep -i "./turbostat" | grep -v grep | grep -v sudo | awk '{print $2}'`