Oracle Kill Session Scripts -4 and gv$lock view

Hi,

Sometimes application developers or client offers you to kill any session or sessions group like SQL Net Client, or JDBC Client sessions, RMAN sessions or All sessions.

 

You can read other Kill Session Scripts in Oracle.

 

Oracle Kill Session Scripts -1

https://ittutorial.org/oracle-kill-session-scripts-2/

https://ittutorial.org/oracle-kill-session-scripts-3/

 

gv$lock view lists the locks currently held by the Oracle Database and outstanding requests for a lock or latch.

You can list the locks running the following command.

SQL> select * from gv$lock;

 

You may want to kill some users sessions which are still executing more than 720 seconds and without SYS user and User type ( not background sessions ), then you can use following useful Oracle DBA script.

 

 

SELECT 
'alter system kill session ''' || SID || ',' || s.serial# ||',@'||p.inst_id|| ''';'
FROM gv$session s, gv$process p
WHERE s.paddr = p.addr(+)
and s.TYPE ='USER' and s.username!='SYS' and status='ACTIVE' and last_call_et > 720;

alter system kill session '409,13205,@2';
alter system kill session '776,14616,@2';
alter system kill session '1187,19997,@2';
alter system kill session '2694,61796,@2';
alter system kill session '24,29348,@2';
alter system kill session '822,34620,@2';
alter system kill session '1181,15588,@2';
alter system kill session '2310,62598,@2';
alter system kill session '409,13205,@1';
alter system kill session '776,14616,@1';
alter system kill session '1187,19997,@1';







System altered.
System altered.
System altered.
System altered.
System altered.
System altered.
System altered.
System altered.
System altered.
System altered.
System altered.






 

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

https://ittutorial.org/oracle-database-19c-tutorials-for-beginners/

 566 views last month,  1 views today

About Mehmet Salih Deveci

blank
I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience. I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource. I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks. I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients. If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress mehmetsalih.deveci@outlook.com. -                                                                                                                                                                                                                                                 - Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  mehmetsalih.deveci@outlook.com a mail atabilirsiniz.

Check Also

blank

Alter System Flush Shared pool in Oracle

Hi, I will explain Alter System Flush Shared pool in Oracle in this post.  4,988 views …

4 comments

  1. blank

    Thank you, I’ve recently been searching for information about this topic for ages and yours is the greatest I have discovered till now. But, what about the conclusion? Are you sure about the source?

  2. blank

    At this time I am ready to do my breakfast, when having my breakfast coming yet again to read additional news.|

  3. blank

    Hi Mehmetsalih,

    I have one question, i found one sql_id and talking multiple plans, i have pinned the new plan also but plan was not picking i able to see multiple sql_id are running for this same sql_id.how we can resolve. This type of issues? I hope can you please explain more…

    Regards,
    Baba.

Leave a Reply