enq: SS – contention Wait Event in Oracle Database

Hi,

I will explain enq: SS – contention  Wait Event in this article.

 

I have seen ” enq: SS – contention Wait Event ” wait event of running session.

This wait event means, there are some problems in temp tablespace.

you can query the enq: SS – contention wait event and object, user details.

SELECT DISTINCT u.username,
u.osuser,
w.event,
w.p2text AS reason,
ts.name AS tablespace,
NVL (ddf.file_name, dtf.file_name)
FROM v$session_wait w,
v$session u,
v$tablespace ts
LEFT OUTER JOIN dba_data_files ddf ON ddf.tablespace_name = ts.name
LEFT OUTER JOIN DBA_TEMP_FILES dtf ON dtf.tablespace_name = ts.name
WHERE u.sid = w.sid AND w.p2 = ts.TS# AND w.event = 'enq: SS - contention';

 

 

Temp tablespace has been 20TB, but most of this size is related with fragmentation.

To solve this problem, you need to create a new temporary tablespace and drop existing temp tablespace.

 

Firstly, you need to create the new temporary tablespace, and alter users’ default temporary tablespaces, then wait for temporary objects completion or you may kill related sessions.

If the existing tablespace has been empty, then you can drop the old tablespace.

 

Step-1: Create the new temporary tablespace.

CREATE TEMPORARY TABLESPACE TEMP_NEW TEMPFILE
'+DATA' SIZE 100M AUTOEXTEND ON NEXT 1G MAXSIZE UNLIMITED
TABLESPACE GROUP ''
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;

 

Step-2: Alter default temporary tablespace of database.

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP_NEW;

 

Step-3: alter application user’s temporary tablespace as follows.

alter user MSD temporary tablespace TEMP_NEW;

 

Step-4: Find the related objects that are using the old temporary tablespace.

select tu.tablespace,tu.username,s.sid,s.serial#,s.inst_id from gv$tempseg_usage tu, gv$session s
where tu.session_addr=s.saddr;


Generate kill session script as follows.

select 'ALTER SYSTEM KILL SESSION '''||s.sid||','||s.serial#||',@'||s.inst_id||''';' from gv$tempseg_usage tu, gv$session s
where tu.session_addr=s.saddr and tu.tablespace='TEMP';

 

Step-5: Wait for completion of the Step-4, or kill the related sessions as follows.

ALTER SYSTEM KILL SESSION ‘sid,serial#,@inst_id’ IMMEDIATE;

ALTER SYSTEM KILL SESSION '682,5094,@6' IMMEDIATE;
ALTER SYSTEM KILL SESSION '1031,18702,@6' IMMEDIATE;
ALTER SYSTEM KILL SESSION '208,24717,@8' IMMEDIATE;
ALTER SYSTEM KILL SESSION '682,4169,@8' IMMEDIATE;
ALTER SYSTEM KILL SESSION '1031,27591,@8' IMMEDIATE;
ALTER SYSTEM KILL SESSION '208,17983,@1' IMMEDIATE;
ALTER SYSTEM KILL SESSION '682,32246,@1' IMMEDIATE;

 

 

Step-6: Drop the old temp tablespace as follows.

Make sure that any session and objects don’t use this tablespace.

DROP TABLESPACE TEMP INCLUDING CONTENTS AND DATAFILES;


You can read the following post to learn Wait Events and Their Solutions in Oracle Database

Oracle Wait Events and Their Solutions in Oracle Database

 

 

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

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

About Mehmet Salih Deveci

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 [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

Leave a Reply

Your email address will not be published. Required fields are marked *