Improving Oracle Database performance involves several strategies. First, optimizing SQL queries can significantly reduce execution time. Second, proper indexing can enhance data retrieval speed. Third, regular database maintenance, such as statistics collection and defragmentation, ensures optimal performance. Fourth, using Oracle's built-in performance tuning tools, like Automatic Workload Repository (AWR) and SQL Tuning Advisor, helps identify and resolve bottlenecks. Lastly, scaling hardware resources, such as CPU and memory, can provide the necessary power for high-demand operations.
Check Database Session Locking
select blocking_session, sid, serial#, wait_class, seconds_in_waitfrom v$session where blocking_session is not NULL order by blocking_session;
select username, sid,serial#,sql_id , wait_time from v$session where (sid ) in
(
select blocking_session from v$session
);
select inst_id,last_call_et,username,machine,event,status from gv$session where username='T24' and lower(event) like '%contention%';
select * from gv$session a , gv$lock b where a.sid=b.sid and A.INST_ID=b.inst_id and username='T24' and lower(event) like '%contention%';
select * from dba_blockers;
Check the Queries which last_call_et column value high and increasing in your Database
select event,last_call_et,username,module,program,machine,sql_id,prev_sql_id,
((select max(sql_text) from gv$sql a where a.sql_id=s.sql_id)) as sql1,
((select max(sql_text) from gv$sql a where a.sql_id=s.prev_sql_id)) as sql2
from gv$session s where status='ACTIVE' and not username is null order by last_call_et desc;
Check Active / In Active Database Sessions
select inst_id,sid,last_call_et,username,machine,event,status from gv$session where username='T24' order by last_call_et desc;
select inst_id,sid,last_call_et,username,machine,event,status from gv$session where username='T24' and status='ACTIVE' order by last_call_et desc;
Check User Level Session Locking.
SELECT se.inst_id,se.last_call_et,
lk.SID, se.username, se.OSUser, se.Machine,DECODE (lk.TYPE,'TX', 'Transaction','TM', 'DML','UL', 'PL/SQL User Lock',lk.TYPE)
lock_type, DECODE (lk.lmode, 0, 'None', 1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'xclusive',
TO_CHAR (lk.lmode))
mode_held,
DECODE (lk.request,
0, 'None',
1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'Exclusive',
TO_CHAR (lk.request))
mode_requested,
TO_CHAR (lk.id1) lock_id1,
TO_CHAR (lk.id2) lock_id2,
ob.owner,
ob.object_type,
ob.object_name,
DECODE (lk.Block, 0, 'No', 1, 'Yes', 2, 'Global') block,
se.lockwait
FROM GV$lock lk, dba_objects ob, GV$session se
WHERE lk.TYPE IN ('TX', 'TM', 'UL')
AND lk.SID = se.SID
AND lk.id1 = ob.object_id(+)
AND lk.inst_id = se.inst_id
and last_call_et > 100;
Generate AWR Report
Check "DB Time"

Check "SQL ordered by Elapsed Time"

Check Top 10 Foreground Events by Total Wait Time

Wait Classes by Total Wait Time

Check Table Stats
select max(LAST_ANALYZED),'execute dbms_stats.gather_table_stats(ownname=>' || '''' || 't24' || '''' || ',' || 'tabname=>' || '''' || table_name || '''' || ',DEGREE=> 10, estimate_percent=> 10 );' from dba_tab_statistics where owner='T24' and stale_stats ='YES'
group by table_name order by max(LAST_ANALYZED) asc;
select max(LAST_ANALYZED),'execute dbms_stats.gather_table_stats(ownname=>' || '''' || 't24' || '''' || ',' || 'tabname=>' || '''' || table_name || '''' || ',DEGREE=> 10, estimate_percent=> 10 );' from dba_tab_statistics where owner='T24' and stale_stats ='YES' group by table_name order by max(LAST_ANALYZED) asc;
select owner,table_name,LAST_ANALYZED from dba_tables;
Check Invalid Objects
select * from dba_ind_partitions where index_owner='T24' and not status='USABLE' ;
select index_name,status from dba_indexes where not status='VALID' and owner='T24';
Move Objects in Keep Pool
select table_name,BUFFER_POOL from dba_tables where OWNER='T24' AND not BUFFER_POOL='DEFAULT';
alter TABLE T24.F_BATCH storage (buffer_pool keep);
Increase INITRANS and PCT Free as DML
ALTER TABLE t24.F_LOCKING INITRANS 100 PCTUSED 0 PCTFREE 60;
Check Execution Plan for Query
explain plan for insert into test1 select * from test1;
select * from table(dbms_xplan.display);
Create Partitions on Tables on Index
