EBS performance tuning
Inactive form sessions more than 1 hour:
######################################
select p.spid, s.sid,s.CLIENT_IDENTIFIER, s.last_call_et/3600 last_call_et_Hrs ,s.status,s.action,s.module,s.program,t.disk_reads,lpad(t.sql_text,30) "Last SQL"
from gv$session s, gv$sqlarea t,gv$process p
where s.sql_address =t.address and
s.sql_hash_value =t.hash_value and
p.addr=s.paddr and
s.status='INACTIVE'
And s.module like '%frm%'
and S.LAST_CALL_ET > 3600*1
order by last_call_et;
This one shows SQL that is currently "ACTIVE":-
##################################################
select S.USERNAME, s.sid, s.osuser, t.sql_id, sql_text
from v$sqltext_with_newlines t,V$SESSION s
where t.address =s.sql_address
and t.hash_value = s.sql_hash_value
and s.status = 'ACTIVE'
and s.username <> 'SYSTEM'
order by s.sid,t.piece
/
This shows locks. Sometimes things are going slow, but it's because it is blocked waiting for a lock:
#################################################################################
select
object_name,
object_type,
session_id,
type, -- Type or system/user lock
lmode, -- lock mode in which session holds lock
request,
block,
ctime -- Time since current mode was granted
from
v$locked_object, all_objects, v$lock
where
v$locked_object.object_id = all_objects.object_id AND
v$lock.id1 = all_objects.object_id AND
v$lock.sid = v$locked_object.session_id
order by
session_id, ctime desc, object_name
/
######################################################
This is a good one for finding long operations (e.g. full table scans). If it is because of lots of short operations, nothing will show up.
COLUMN percent FORMAT 999.99
SELECT sid, to_char(start_time,'hh24:mi:ss') stime,
message,( sofar/totalwork)* 100 percent
FROM v$session_longops
WHERE sofar/totalwork < 1
/
Number of users connected to EBS
#####################################
SQL> select count(distinct d.user_name) from apps.fnd_logins a, v$session b, v$process c, apps.fnd_user d
where b.paddr = c.addr and a.pid=c.pid and a.spid = b.process and d.user_id = a.user_id
and (d.user_name = 'USER_NAME' OR 1=1);
COUNT(DISTINCTD.USER_NAME)
--------------------------
20
FIND the more waits of concurent_managers of last 10days in order
#################################################
select * from (SELECT TO_CHAR (actual_start_date, 'DD_MON_YYYY') DAY,
concurrent_queue_name,CONCURRENT_PROGRAM_NAME,
(SUM((actual_start_date -(CASE WHEN requested_start_date > request_date
THEN requested_start_date
ELSE request_date
END
)
)
*24
*60
*60
)
)
/COUNT (*) "Wait_time_per_Req_in_secs"
FROM apps.fnd_concurrent_requests cr,
apps.fnd_concurrent_processes fcp,
apps.fnd_concurrent_queues fcq,
apps.fnd_concurrent_programs fcpr
WHERE cr.phase_code = 'C'
AND cr.ACTUAL_START_DATE > sysdate-10
AND cr.ACTUAL_START_DATE IS NOT NULL
AND cr.requested_start_date IS NOT NULL
AND cr.CONTROLLING_MANAGER = fcp.CONCURRENT_PROCESS_ID
AND fcp.queue_application_id = fcq.application_id
AND fcpr.APPLICATION_ID=fcq.application_id
AND fcp.concurrent_queue_id = fcq.CONCURRENT_QUEUE_ID
GROUP BY actual_start_date, concurrent_queue_name, CONCURRENT_PROGRAM_NAME
ORDER BY 4 desc) a where rownum<101
Avv. runtime of a specific concurrent program.
##############################################
SELECT r.REQUEST_ID,
DECODE(cptl.user_concurrent_program_name,
'Report Set', substr(r.description,1,40),
SUBSTR(cptl.user_concurrent_program_name,1,40)) pn,
q.concurrent_queue_name qn,
TO_CHAR(r.ACTUAL_START_DATE,'MM/DD/YY HH:MI:SS') strttime,
-- TO_CHAR(ACTUAL_COMPLETION_DATE,'MM/DD/YY HH:MI:SS') endtime,
ROUND((r.ACTUAL_COMPLETION_DATE - r.ACTUAL_START_DATE)*(60*24),2) rtime,
r.completion_text compl_txt
FROM apps.fnd_concurrent_requests r,
apps.fnd_concurrent_processes p,
apps.fnd_concurrent_programs cp,
apps.fnd_concurrent_programs_tl cptl,
apps.fnd_concurrent_queues q
WHERE p.concurrent_queue_id = q.concurrent_queue_id
AND p.queue_application_id = q.application_id
AND r.controlling_manager = p.concurrent_process_id
AND r.phase_code = 'C'
AND r.program_application_id = cp.application_id
AND r.concurrent_program_id = cp.concurrent_program_id
AND cp.application_id = cptl.application_id
AND cp.concurrent_program_id = cptl.concurrent_program_id
AND cptl.user_concurrent_program_name = 'Requisition Import'
ORDER BY 4
/
Pending request count:
#######################
Select count(1) from apps.fnd_concurrent_worker_requests cwr,
apps.fnd_concurrent_queues_tl cq,
apps.fnd_user fu
WHERE (cwr.phase_code = 'P')
AND cwr.hold_flag != 'Y'
AND cwr.requested_start_date <= SYSDATE
AND cwr.concurrent_queue_id = cq.concurrent_queue_id
AND cwr.queue_application_id = cq.application_id
AND cq.LANGUAGE = 'US'
AND cwr.requested_by = fu.user_id;
Which request is pending on which manager:
##############################################
col USER_NAME format a20
col USER_CONCURRENT_QUEUE_NAME format a40
SELECT request_id, phase_code, status_code, user_name,
user_concurrent_queue_name
FROM apps.fnd_concurrent_worker_requests cwr,
apps.fnd_concurrent_queues_tl cq,
apps.fnd_user fu
WHERE (cwr.phase_code = 'P' )
AND cwr.hold_flag != 'Y'
AND cwr.requested_start_date <= SYSDATE
AND cwr.concurrent_queue_id = cq.concurrent_queue_id
AND cwr.queue_application_id = cq.application_id
AND cq.LANGUAGE = 'US'
AND cwr.requested_by = fu.user_id
ORDER BY 5;
Running request count:
#############################
Select count(1) from apps.fnd_concurrent_worker_requests cwr,
apps.fnd_concurrent_queues_tl cq,
apps.fnd_user fu
WHERE (cwr.phase_code = 'R')
AND cwr.hold_flag != 'Y'
AND cwr.requested_start_date <= SYSDATE
AND cwr.concurrent_queue_id = cq.concurrent_queue_id
AND cwr.queue_application_id = cq.application_id
AND cq.LANGUAGE = 'US'
AND cwr.requested_by = fu.user_id;
Running request count per concurrent manager: -
#################################################
select concurrent_queue_name, count(1) from apps.fnd_concurrent_worker_requests where phase_code='R' group by concurrent_queue_name order by concurrent_queue_name;
Which request is running on which Manager:
col USER_NAME format a20
col USER_CONCURRENT_QUEUE_NAME format a40
SELECT request_id, phase_code, status_code, user_name,
user_concurrent_queue_name
FROM apps.fnd_concurrent_worker_requests cwr,
apps.fnd_concurrent_queues_tl cq,
apps.fnd_user fu
WHERE (cwr.phase_code = 'R' )
AND cwr.hold_flag != 'Y'
AND cwr.requested_start_date <= SYSDATE
AND cwr.concurrent_queue_id = cq.concurrent_queue_id
AND cwr.queue_application_id = cq.application_id
AND cq.LANGUAGE = 'US'
AND cwr.requested_by = fu.user_id
ORDER BY 5;
Concurrent request details for a particular concurrent manager for last 8 hours:
#################################################################################
select r.request_id, pg.concurrent_program_name, q.concurrent_queue_name from apps.fnd_concurrent_requests r, apps.fnd_concurrent_programs pg, apps.fnd_concurrent_processes pc, apps.fnd_concurrent_queues q where (((SELECT SYSDATE FROM DUAL) - actual_start_date) * 24) < 8 and r.controlling_manager = pc.concurrent_process_id and
pc.queue_application_id = q.application_id and
pc.concurrent_queue_id = q.concurrent_queue_id and
r.program_application_id = pg.application_id and
r.concurrent_program_id = pg.concurrent_program_id
and q.CONCURRENT_QUEUE_NAME='&n'
order by 1
Concurrent request details (running / pending / completed timings) for a particular concurrent manager for last 1 day :
#################################################################################
select request_id,(to_char(REQUESTED_START_DATE,'DD/MM/YYYY HH24:MI:SS')) "SUBMITTED", (to_char(ACTUAL_START_DATE,'DD/MM/YYYY HH24:MI:SS')) "STARTED", (to_char(ACTUAL_COMPLETION_DATE, 'DD/MM/YYYY HH24:MI:SS')) "COMPLETED", (floor(((ACTUAL_COMPLETION_DATE-ACTUAL_START_DATE)*24*60*60)/3600)
|| ' HOURS ' || floor((((ACTUAL_COMPLETION_DATE-ACTUAL_START_DATE)*24*60*60) - floor(((ACTUAL_COMPLETION_DATE-ACTUAL_START_DATE)*24*60*60)/3600)*3600)/60) || ' MINUTES ' || round((((ACTUAL_COMPLETION_DATE-ACTUAL_START_DATE)*24*60*60) - floor(((ACTUAL_COMPLETION_DATE-ACTUAL_START_DATE)*24*60*60)/3600)*3600 -
(floor((((ACTUAL_COMPLETION_DATE-ACTUAL_START_DATE)*24*60*60) - floor(((ACTUAL_COMPLETION_DATE-ACTUAL_START_DATE)*24*60*60)/3600)*3600)/60)*60) )) || ' SECS ') "Running Time", (floor(((ACTUAL_START_DATE-REQUEST_DATE)*24*60*60)/3600) || ' HOURS ' || floor((((ACTUAL_START_DATE-REQUEST_DATE)*24*60*60) - floor(((ACTUAL_START_DATE-REQUEST_DATE)*24*60*60)/3600)*3600)/60) || ' MINUTES ' || round((((ACTUAL_START_DATE-REQUEST_DATE)*24*60*60) -floor(((ACTUAL_START_DATE-REQUEST_DATE)*24*60*60)/3600)*3600 - (floor((((ACTUAL_START_DATE-REQUEST_DATE)*24*60*60) - floor(((ACTUAL_START_DATE-REQUEST_DATE)*24*60*60)/3600)*3600)/60)*60) )) || ' SECS ') "Pending Time" from fnd_concurrent_requests where request_id in (select r.request_id from apps.fnd_concurrent_requests r, apps.fnd_concurrent_programs pg, apps.fnd_concurrent_processes pc, apps.fnd_concurrent_queues q
where (((SELECT SYSDATE FROM DUAL) - actual_start_date) * 24) <24
and r.controlling_manager = pc.concurrent_process_id and pc.queue_application_id = q.application_id and pc.concurrent_queue_id = q.concurrent_queue_id and r.program_application_id = pg.application_id and r.concurrent_program_id = pg.concurrent_program_id and q.CONCURRENT_QUEUE_NAME='&Conc_manager_name' )
order by 5, 6 DESC;
Finding SID for a Concurrent request (RAC):
############################################
column process heading "FNDLIBR PID"
SELECT a.request_id, d.sid "Oracle PID", d.serial# ,d.osuser,d.process , c.SPID "OS PID", d.inst_id "Instance", d.machine
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
Gv$process c,
Gv$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND a.request_id = &Request_ID
AND a.phase_code = 'R';
Finding runaway (not active) processes for last three hours: -
###################################################################
SELECT p.spid "OS Process", s.machine,to_char(s.logon_time,'mm-dd-yy hh24:mi:ss') Logon_Time, s.last_call_et/3600 Last_Call_ET, s.action, s.sid, s.serial# FROM GV$SESSION s, GV$PROCESS p WHERE s.paddr = p.addr and s.username IS NOT NULL and s.username = 'APPS' and s.osuser = 'applmgr' and s.last_call_et/3600 > 3 and s.action like 'FRM%' and s.status='INACTIVE' order by logon_time;
FIND request id from SID
###############################
SELECT a.request_id,d.inst_id, d.sid, d.serial# ,d.osuser,d.process
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
gv$process c,
gv$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND d.sid = &SID
AND a.phase_code = 'R';
Find SID from request id
##############################################
SELECT a.request_id,d.inst_id, d.sid, d.serial# ,d.status,d.osuser,d.process,d.last_call_et
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
gv$process c,
gv$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND a.request_id = &Request_ID
AND a.phase_code = 'R';
-----------------------------------------------------------------------------------------
SELECT ses.sid, ses.inst_id,
ses.serial#
FROM gv$session ses,
gv$process pro
WHERE ses.paddr = pro.addr
AND pro.spid IN (SELECT oracle_process_id
FROM apps.fnd_concurrent_requests
WHERE request_id = &request_id);
OS process id from SID
##########################
SELECT spid,MODULE,pid,machine,s.terminal,action FROM v$session s,v$process WHERE sid=&sid AND paddr=addr;
Which Session is using how much UNDO
########################################
SELECT s.inst_id,s.sid, s.serial#, s.username, s.program,
t.used_ublk, t.used_urec
FROM gv$session s, gv$transaction t
WHERE s.taddr = t.addr
ORDER BY 6 desc, 7 desc, 1, 2, 3, 4
SQL TEXT from SID
##########################
SELECT sql_text FROM v$sqltext,v$session WHERE sql_address=address AND sql_hash_value=hash_value AND sid=&sid ORDER BY piece;
Locks in the DB
##########################
SELECT SID, serial#, module, action, logon_time, blocking_session,blocking_instance, seq#
FROM gv$session WHERE blocking_session IS NOT NULL;
****
or
****
select 'SID ' || l1.sid ||' is blocking ' || l2.sid blocking
from gv$lock l1, gv$lock l2
where l1.block =1 and l2.request > 0
and l1.id1=l2.id1
and l1.id2=l2.id2
/
@kise
select 'alter system kill session '''||sid||','||serial#||''';'
from v$session
where sid=&1
/
SELECT inst_id, DECODE(request,0,'Holder: ','Waiter: ')||sid sess,
id1, id2, lmode, request, type
FROM gV$LOCK
WHERE (id1, id2, type) IN
(SELECT id1, id2, type FROM gV$LOCK WHERE request>0)
ORDER BY id1, request;
--------------------------
set linesize 150;
set head on;
col sid_serial form a13
col ora_user for a15;
col object_name for a35;
col object_type for a10;
col lock_mode for a15;
col last_ddl for a8;
col status for a10;
break on sid_serial;
SELECT l.session_id||','||v.serial# sid_serial,
l.ORACLE_USERNAME ora_user,
o.object_name,
o.object_type,
DECODE(l.locked_mode,
0, 'None',
1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'Exclusive',
TO_CHAR(l.locked_mode)
) lock_mode,
o.status,
to_char(o.last_ddl_time,'dd.mm.yy') last_ddl
FROM dba_objects o, gv$locked_object l, v$session v
WHERE o.object_id = l.object_id
and l.SESSION_ID=v.sid
order by 2,3;
wait events determination
##############################
select sid,serial#,sql_id,event,seconds_in_wait from v$session where module = 'IEX_SCORE_OBJECTS';
or
select EVENT,TOTAL_WAITS,TIME_WAITED from v$session_event where SID=596;
*****************************************************************************************
SELECT
d.user_name "User Name",d.description,b.status,b.last_call_et,b.action,b.MODULE ,b.sid SID,b.serial# "Serial#"
FROM
fnd_logins a, v$session b, v$process c, fnd_user d
WHERE
b.paddr = c.addr
AND a.pid=c.pid
AND a.spid = b.process
AND d.user_id = a.user_id
AND (d.user_name = 'USER_NAME' OR 1=1)
--AND b.MODULE='FNDSCSGN'
AND b.sid=1015
ORDER BY USER_name
SQL
SELECT * FROM v$session_longops WHERE sofar<totalwork
SELECT d.user_name "User Name",
b.sid SID,b.status, b.serial# "Serial#", c.spid "srvPID", a.SPID "ClPID",a.LOGIN_TYPE,
TO_CHAR(START_TIME,'DD-MON-YY HH:MM:SS') "STime",last_call_et
FROM
fnd_logins a, v$session b, v$process c, fnd_user d
WHERE
b.paddr = c.addr
AND a.pid=c.pid
AND a.spid = b.process
AND d.user_id = a.user_id
AND last_call_et>9600
ORDER BY last_call_et
SELECT r.request_id,r.requested_start_date,p.CONCURRENT_PROGRAM_NAME,r.phase_code phase ,r.status_code status,t.USER_CONCURRENT_PROGRAM_NAME
FROM fnd_concurrent_requests r ,fnd_concurrent_programs p,fnd_concurrent_programs_tl t
WHERE TRUNC (REQUESTED_START_DATE) =TRUNC (SYSDATE) AND TO_CHAR(r.requested_start_date,' HH24') BETWEEN 7 AND 10
AND phase_code='P'
AND status_code IN ('Q','I')
AND hold_flag='N'
AND r.concurrent_program_id=p.concurrent_program_id
AND t.concurrent_program_id=p.concurrent_program_id
ORDER BY r.requested_start_date
How much more time to go for a Long running jobs
###########################################
SELECT a.sid,TO_CHAR(start_time,'dd-mon:hh24:mi') start_time,
opname,SUBSTR(b.MODULE,1,10) MODULE
,target,totalwork,sofar,(elapsed_Seconds/60) elamin,
time_remaining tre
FROM v$session_longops a, v$session b
WHERE
a.sid = b.sid AND
b.status='ACTIVE' AND
totalwork <> SOFAR
ORDER BY start_time;
How much more time to go for a Long running SIDs
####################################################
SELECT sid,serial#,SUBSTR(username,1,10) username,SUBSTR(osuser,1,10)
osuser,
SUBSTR(program||MODULE,1,15) program,SUBSTR(machine,1,22)
machine,
TO_CHAR(logon_time,'ddMon hh24:mi') login,
last_call_et "last call",status
FROM v$session
WHERE sid=&1
ORDER BY 1
Scheduled Concurrent progrmas between 7AM to 9AM of a day
################################################################
SELECT
f1.request_id,PROGRAM_SHORT_NAME,f3.USER_CONCURRENT_PROGRAM_NAME,
f1.REQUEST_DATE
FROM fnd_concurrent_requests f1,FND_CONC_REQ_SUMMARY_V
f2,fnd_concurrent_programs_vl f3
WHERE TRUNC(f1.request_date) = TRUNC(SYSDATE) -1
AND f1.REQUEST_ID(+) = f2.REQUEST_ID
AND f3.CONCURRENT_PROGRAM_ID = f2.CONCURRENT_PROGRAM_ID
AND f1.CONCURRENT_PROGRAM_ID = f2.concurrent_program_id
AND TO_NUMBER(TO_CHAR(f1.REQUEST_DATE,'hh24')) BETWEEN 7 AND 9
ORDER BY f1.REQUEST_DATE;
-----------------------------------------------------------
SELECT USER_CONCURRENT_PROGRAM_NAME FROM fnd_concurrent_programs WHERE TO_NUMBER(TO_CHAR(REQUEST_DATE,'hh24')) BETWEEN 7 AND 9
DESC fnd_concurrent_programs
who has changed the sysadmin password?------>>>
select user_name
from apps.fnd_user
where user_id = ( select last_updated_by from apps.fnd_user where user_name='SYSADMIN' )
to find find free spaces in memory
###################################
select f.inst_id,pool,name,
sgasize/1024/1024 "Allocated (M)",
bytes/1024 "Free (K)",
round(bytes/sgasize*100, 2) "% Free"
from (select sum(bytes) sgasize from sys.gv_$sgastat) s, sys.gv_$sgastat f
where f.name = 'free memory'
/
Temp table space usese in %
###############################
SELECT T.TABLESPACE_NAME,
NVL(ROUND(((SUM(U.BLOCKS)*P.VALUE)/1024/1024),
2),0) USED_MB,
T.TOT_MB,
NVL(ROUND(SUM(U.BLOCKS)*P.VALUE/1024/1024/T.TOT_MB * 100,2),0) "USED %"
FROM GV$SORT_USAGE U,
GV$PARAMETER P,
(SELECT TABLESPACE_NAME,
SUM(BYTES)/1024/1024 TOT_MB
FROM DBA_TEMP_FILES
GROUP BY TABLESPACE_NAME) T
WHERE P.NAME = 'db_block_size'
AND U.TABLESPACE (+) = T.TABLESPACE_NAME
GROUP BY T.TABLESPACE_NAME,
P.VALUE,
T.TOT_MB
ORDER BY 1,2;
Temp table space usese accoring to users
########################################
SELECT b.tablespace,
ROUND(((b.blocks*p.value)/1024/1024),2)||'M' "SIZE",
a.sid||','||a.serial# SID_SERIAL,
a.username,
a.program
FROM sys.v_$session a,
sys.v_$sort_usage b,
sys.v_$parameter p
WHERE p.name = 'db_block_size'
AND a.saddr = b.session_addr
ORDER BY b.tablespace, b.blocks;
######################################
SELECT fcpp.concurrent_request_id req_id, fcp.node_name, fcp.logfile_name
FROM apps.fnd_conc_pp_actions fcpp, apps.fnd_concurrent_processes fcp
WHERE fcpp.processor_id = fcp.concurrent_process_id
AND fcpp.action_type = 6
AND fcpp.concurrent_request_id = 12715732
To find sessions details & Instance number from a SQL_ID
#############################################################
select distinct(SQL_ID),SESSION_ID,INSTANCE_NUMBER from sys.WRH$_ACTIVE_SESSION_HISTORY where SQL_ID='b2d1pwbjpx5h3';
####################################################
Determine how many users (outside of concurrent manager jobs -- forms and web users) are logged into E-Business system at any one time, and what the high water mark of users on a particular day may be.->>
-------------------------------------
select u.user_name, r.responsibility_name, f.user_function_name, s.function_type,
to_char(s.first_connect, 'DD-MON HH24:MI:SS') "First Connect",
to_char(s.last_connect, 'DD-MON HH24:MI:SS') "Last Connect", n.node_name
from icx_sessions s, fnd_user u, fnd_responsibility_vl r, fnd_form_functions_vl f, fnd_nodes n
where u.user_id(+) = s.user_id
AND f.function_id(+) = s.function_id
AND r.responsibility_id(+) = s.responsibility_id
AND n.node_id(+) = s.node_id
AND s.disabled_flag != 'Y'
and s.pseudo_flag = 'N'
and (s.last_connect + decode(FND_PROFILE.VALUE('ICX_SESSION_TIMEOUT'), NULL,s.limit_time, 0,s.limit_time,FND_PROFILE.VALUE('ICX_SESSION_TIMEOUT')/60)/24) > sysdate
and s.counter < s.limit_connects
/
---------------------------------------
SELECT DISTINCT icx.session_id,
icx.user_id,
fu.user_name,
fu.description
FROM icx_sessions icx, fnd_user fu
WHERE disabled_flag != 'Y'
AND icx.pseudo_flag = 'N'
AND (last_connect +
DECODE (fnd_profile.VALUE ('ICX_SESSION_TIMEOUT'),
NULL, limit_time,
0 , limit_time,
fnd_profile.VALUE ('ICX_SESSION_TIMEOUT')/60) / 24) > SYSDATE
AND icx.counter < limit_connects
AND icx.user_id = fu.user_id;
--------------------------------
Comments
Post a Comment