Monday, June 09, 2008

TCP Socket (KGAS)

KGAS = > is a component in the server (wait event), that handles TCP/IP sockets on Oracle 10.2+; (packages -> UTL_TCP, UTP_SMTP, UTP_HTTP, ...)

Statement to see which sessions:

SQL> SELECT sid, total_waits, time_waited FROM v$session_event WHERE event='TCP Socket (KGAS)' and total_waits > 0 ORDER BY 3,2;


SID TOTAL_WAITS TIME_WAITED
---------- ----------- -----------
303 6 2
280 18 5
285 37 9
279 37 10
281 37 10
290 37 11

Reducing Waits:
- Check the current SQL / module / action of v$session, after that check your network from that program.

Example:
Check trace file from "TCP Socket (KGAS)" waits:

alter session set events '10046 trace name context forever, level 8';
select utl_http.request('http://10.10.10.5') from dual;

=>
SQL>
SQL>
SQL> set lines 100
SQL> set pages 1000
SQL> set serverout on
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> select distinct par.value '/' lower(instance_name) '_ora_' spid '.trc' "Trace file 2 name" 3 from v$instance i, v$process p, v$mystat m, v$session s, v$parameter par 4 where s.paddr = p.addr 5 and s.sid = m.sid 6 and par.name='user_dump_dest';


Trace filename
------------------------------------------------------------------------------

/oracle/.../db_ora_9713.trc

SQL> alter session set events '10046 trace name context forever, level 8';

Session altered.

SQL> select utl_http.request('http://10.10.10.5') from dual;

$ tkprof /oracle/.../testdb2_ora_9713.trc file.out
.
.
.
Event waited on Times Max. Wait Total Waited
----------------------------------------
SQL*Net message to client 4 0.00 0.00
SQL*Net message from client 3 195.89 204.96
TCP Socket (KGAS) 1 188.99 188.99
SQL*Net break/reset to client 2 0.00 0.00
.
.
.

or you can check by (telnet)

$ telnet 10.10.10.5 80

Trying 10.10.10.5...telnet:
connect to address 10.10.10.5:
Connection timed outtelnet: Unable to connect to remote host: Connection timed out

...

No comments: