kill rman shell script
cat /etc/oratab|grep '/opt/oracle/product'|grep -v '*'|grep -v '#'|grep -v DG|grep -v agent|awk -F: ' { print $1 }'|while read line
do
. oraenv<<EOF
$line
EOF
echo "**************************************************"
sqlplus -s '/as sysdba'<<!
select 'alter system kill session '''||s.sid||','||s.serial#||''' immediate;'FROM v\$process a, v\$session s where a.addr=s.paddr and client_info like 'rman%';
!
echo "**************************************************"
done
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
manual :-
select 'alter system kill session '''||s.sid||','||s.serial#||''' immediate;'FROM v$session s, v$process p WHERE s.paddr = p.addr and s.program like '%rman';
select s.sid ,s.serial#, spid
from v$session s, V$process p
where s.program like '%rman%' and wait_class='System I/O'
and s.paddr = p.addr;
select 'alter system kill session '''||s.sid||','||s.serial#||''' immediate;'FROM v$process a, v$session s where a.addr=s.paddr and client_info like 'rman%';
select b.sid, b.serial#, a.spid, b.client_info, b.program, b.logon_time from v$process a, v$session b where a.addr=b.paddr and client_info like 'rman%';
do
. oraenv<<EOF
$line
EOF
echo "**************************************************"
sqlplus -s '/as sysdba'<<!
select 'alter system kill session '''||s.sid||','||s.serial#||''' immediate;'FROM v\$process a, v\$session s where a.addr=s.paddr and client_info like 'rman%';
!
echo "**************************************************"
done
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
manual :-
select 'alter system kill session '''||s.sid||','||s.serial#||''' immediate;'FROM v$session s, v$process p WHERE s.paddr = p.addr and s.program like '%rman';
select s.sid ,s.serial#, spid
from v$session s, V$process p
where s.program like '%rman%' and wait_class='System I/O'
and s.paddr = p.addr;
select 'alter system kill session '''||s.sid||','||s.serial#||''' immediate;'FROM v$process a, v$session s where a.addr=s.paddr and client_info like 'rman%';
select b.sid, b.serial#, a.spid, b.client_info, b.program, b.logon_time from v$process a, v$session b where a.addr=b.paddr and client_info like 'rman%';
Comments
Post a Comment