Monday, 5 February 2018

Script to kill the ACTIVE/INACTIVE session in RAC


Check the INACTIVE /ACTIVE Sessions 

select inst_id,sid,serial#,username,status,last_call_et,program,LOGON_TIME,SQL_EXEC_START,machine,SQL_ID from gv$session where nvl(trim(username),'SYS') not in ('SYS','PUBLIC','DBSNMP') and status='INACTIVE' and type!='BACKGROUND' and TRUNC(logon_time)<=to_date('17-JAN-2018','DD-MON-YYYY')
order by LOGON_TIME; 



Creating the script to kill the INACTIVE /ACTIVE session

select 'alter system kill session ''' || sid || ',' || serial# ||',@' || inst_id || ''' immediate;' From gv$session s where nvl(trim(s.username),'SYS') not in ('SYS','PUBLIC','DBSNMP') and s.status='ACTIVE' and type!='BACKGROUND' and TRUNC(logon_time)<=to_date('26-JAN-2018','DD-MON-YYYY')
order by LOGON_TIME;  

Add Data file

 ************************************************** Database status Tablespace Usage ASM Disk Group Usage(RAC) Backup Filesystem Usage Alert...