Professional Documents
Culture Documents
Common SCRIPTS
Common SCRIPTS
Common SCRIPTS
com/p/dba-shell-
scripts.html
select s.sid,s.serial#,s.status,p.spid,s.module,s.action,s.program
from v$session s,v$process p
where s.sid in (select session_id from dba_locks where blocking_others='Blocking')
and s.paddr=p.addr
Note: Kill only INACTIVE blocking sessions. For Inactive blocking sessions,
Event will be as shown below:
SQL> select EVENT from gv$session_wait where sid=&sid;
Enter value for sid: 19
old 1: select EVENT from gv$session_wait where sid=&sid
new 1: select EVENT from gv$session_wait where sid=19
EVENT
----------------------------------------------------------------
SQL*Net message from client
Sample Output:
Enter value for form_process_id: 19721
old 5: and s.process = '&form_process_id'
new 5: and s.process = '19721'
Shadow
ORACLE/OS User sid (audsid) Process ID Waiting P1
------------------------- -------------------- ---------- ------------------------------ ----------
APPS applmgr () 22,21485 (615657) 27872 SQL*Net message from client 1952673792
à Total scheduled requests
A)
select oracle_process_id ,
decode(status_code,'R','Running','D','Canceled','E','Error','X','Terminated','G',
'Warning','T','Terminating')"Status_code",
phase_code,to_char(actual_start_date,'DD-MON-YYYY=>hh24:mi:ss') "Login Time"
from apps.fnd_concurrent_requests where request_id='&Enter_conn_req_id'
B)
select s.sid,s.serial#,module,s.status from v$session s,v$process p
where s.paddr=p.addr
and p.spid=&oracle_process_id
C)
update fnd_concurrent_requests
set phase_code='C',
status_code='X'
where request_id=&Enter_REQUESTID;
commit;
Make sure that database session for the request id is killed using the output from step A and B.
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P' AND status_code in ('Q','I');
Commit;
prompt --> Product Installation Status, Version Info and Patch Level
select decode(nvl(a.APPLICATION_short_name,'Not Found'), 'SQLAP','AP','SQLGL','GL','OFA','FA',
'Not Found','id '||to_char(fpi.application_id), a.APPLICATION_short_name) apps,
decode(fpi.status,'I','Installed','S','Shared','N','Inactive',fpi.status) status,
fpi.product_version,nvl(fpi.patch_level,'-- Not Available --') Patchset,
to_char(fpi.last_update_date,'dd-Mon-RRRR') "Update Date"
from fnd_oracle_userid o, fnd_application a, fnd_product_installations fpi
where fpi.application_id = a.application_id(+)
and fpi.oracle_id = o.oracle_id(+)
order by 1,2;
set
pagesize
9999
set linesize 80
set verify off
col "Profile Option" for a15
col "Option Level" for a13
col "Value" for a15
col "Set On" for a9
col "Scoldee" for a15
select * from
(
select tl.user_profile_option_name "Profile Option",
decode(val.level_id,
10001, 'Site',
10002, 'Application',
10003, 'Responsibility',
10004, 'User',
10005, 'Server',
10006, 'Organization',
10007, 'Server+Resp',
'No idea, boss') "Option Level",
val.profile_option_value "Value",
val.last_update_date "Set on",
usr.user_name "Scoldee"
from fnd_profile_options opt,
fnd_profile_option_values val,
fnd_profile_options_tl tl,
fnd_user usr
where opt.profile_option_id = val.profile_option_id
and opt.profile_option_name = tl.profile_option_name
and usr.user_id = val.last_updated_by
order by val.last_update_date desc
)
where rownum <= &number_of_items
;
exit;
==================================================
**********************************************************************
To list down the processing details of Concurrent managers
SELECT
TO_CHAR (actual_start_date, 'DD-MON-YY : HH24') "Queue Time",
fcqtl.user_concurrent_queue_name "Concurrent Manager",
fcptl.user_concurrent_program_name "Program",
ROUND
( SUM (GREATEST (actual_completion_date - actual_start_date, 0))
* 60
* 24,
2
) "Total Duration (min)",
ROUND
( AVG (GREATEST (actual_completion_date - actual_start_date, 0))
* 60
* 24,
2
) "Avg Duration (min)",
ROUND
( MIN (GREATEST (actual_completion_date - actual_start_date, 0))
* 60
* 24,
2
) "Min Duration (min)",
ROUND
( MAX (GREATEST (actual_completion_date - actual_start_date, 0))
* 60
* 24,
2
) "Max Duration (min)",
COUNT (*) "Times Run", fcq.target_processes "Total Processes"
FROM fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcptl,
fnd_concurrent_processes fcproc,
fnd_concurrent_queues_tl fcqtl,
fnd_concurrent_queues fcq,
fnd_concurrent_requests fcr
WHERE fcr.phase_code = 'C'
AND fcr.actual_completion_date IS NOT NULL
AND actual_start_date IS NOT NULL
AND fcq.concurrent_queue_id = fcproc.concurrent_queue_id
AND fcq.application_id = fcproc.queue_application_id
AND fcq.manager_type = 1
AND fcr.controlling_manager = fcproc.concurrent_process_id
AND fcr.program_application_id = fcp.application_id
AND fcr.concurrent_program_id = fcp.concurrent_program_id
AND fcp.concurrent_program_name NOT IN
('ACTIVATE', 'ABORT', 'DEACTIVATE', 'VERIFY')
AND fcr.concurrent_program_id = fcptl.concurrent_program_id
AND fcr.program_application_id = fcptl.application_id
AND fcptl.LANGUAGE = 'US'
AND fcproc.queue_application_id = fcqtl.application_id
AND fcproc.concurrent_queue_id = fcqtl.concurrent_queue_id
AND fcqtl.LANGUAGE = 'US'
GROUP BY TO_CHAR (actual_start_date, 'DD-MON-YY : HH24'),
fcqtl.user_concurrent_queue_name,
fcptl.user_concurrent_program_name,
fcq.target_processes
ORDER BY "Queue Time" ASC,
"Concurrent Manager" ASC,
"Times Run" DESC,
"Max Duration (min)" DESC,
"Total Duration (min)" DESC
**********************************************************************
**********************************************************************
SELECT
a.request_id,
a.user_concurrent_program_name,
y.USER_CONCURRENT_QUEUE_NAME Processing_Manager_Name,
TO_CHAR(a.requested_start_date,'dd-Mon-yyyy :hh24:mi') Requested_start_date,
TO_CHAR(a.actual_start_date,'dd-Mon-yyyy :hh24:mi') Actual_start_date,
TO_CHAR(a.actual_completion_date,'dd-Mon-yyyy :hh24:mi') completion_date,
FLOOR((a.ACTUAL_COMPLETION_DATE- a.ACTUAL_START_DATE)*24) "in Hours",
round((((a.ACTUAL_COMPLETION_DATE- a.ACTUAL_START_DATE)*24)-
(FLOOR((a.ACTUAL_COMPLETION_DATE- a.ACTUAL_START_DATE)*24)))*60) "In_Min",
FLOOR((a.ACTUAL_start_DATE- a.requested_START_DATE)*24)*60 "Start Delay By Mins",
b.logfile_node_name as "HOSTNAME",SUBSTR(a.requestor,1,30) as "REQUESTOR" ,
trim(b.argument_text) as "PARAMETERS"
FROM fnd_conc_req_summary_v a,fnd_concurrent_requests b,
fnd_concurrent_processes x, fnd_concurrent_queues_vl y
where b.request_id=a.request_id
and x.CONCURRENT_QUEUE_ID = y.CONCURRENT_QUEUE_ID
and x.CONCURRENT_PROCESS_ID = a.controlling_manager
and a.actual_start_date < sysdate
order by a.actual_start_date
**********************************************************************
**********************************************************************
**********************************************************************
select
to_char(w.seconds_in_wait,'9999999') seconds_in_wait,
to_char(p.spid,'9999999') spid,
to_char(s.process,'9999999') process,
to_char(s.sid,'9999999') sid,
to_char(s.serial#,'9999999') serial,
substr(u.user_name,1,10) user_name,
substr(s.status,1,10) status,
to_char(Request_id,'9999999999') request_id,
substr(concurrent_program_name,1,15) concurrent_program_name,
substr(user_concurrent_program_name,1,20) user_concurrent_program_name,
to_char(requested_start_Date,'DD-MON-RR HH:MI') requested_start_Date,
to_char(round((sysdate- requested_start_date)*1440, 2),'9,999,999.99') running_minutes
FROM FND_CONCURRENT_WORKER_REQUESTS, fnd_user u, v$session s, v$process p,
v$session_wait w
WHERE (Phase_Code='R')and hold_flag != 'Y'and Requested_Start_Date <= SYSDATE
AND ('' IS NULL OR ('' = 'B' AND PHASE_CODE = 'R' AND STATUS_CODE IN ('I', 'Q')))and '1' in
(0,1,4)
and requested_by=u.user_id and s.paddr=p.addr and s.sid=w.sid and oracle_process_id = p.spid
and oracle_session_id = s.audsid
order by requested_start_date;
**********************************************************************
To find the OPP logs
SELECT fcpa.concurrent_request_id req_id, fcp.node_name, fcp.logfile_name
FROM fnd_conc_pp_actions fcpa, fnd_concurrent_processes fcp
WHERE fcpa.processor_id = fcp.concurrent_process_id
AND fcpa.action_type = 6
AND fcpa.concurrent_request_id = :P_REQUEST_ID;
**********************************************************************
To know conc program name from request id
Select * from FND_CONC_REQ_SUMMARY_V where request_id = '4716010';
**********************************************************************
**********************************************************************
to know the concurrent program name from the module name
select fcpl.user_concurrent_program_name
, fcp.concurrent_program_name
, fcp.concurrent_program_id
, fav.application_short_name
, fav.application_name
, fav.application_id
, fdfcuv.end_user_column_name
, fdfcuv.form_left_prompt prompt
, fdfcuv.enabled_flag
, fdfcuv.required_flag
, fdfcuv.display_flag
from apps.fnd_concurrent_programs fcp
, apps.fnd_concurrent_programs_tl fcpl
, apps.fnd_descr_flex_col_usage_vl fdfcuv
, apps.fnd_application_vl fav
where fcp.concurrent_program_id = fcpl.concurrent_program_id
and fcpl.user_concurrent_program_name = :conc_prg_name
and fav.application_id=fcp.application_id
and fcpl.language = 'US'
**********************************************************************
**********************************************************************
**********************************************************************
Undo tablespace usage
Tablespace monitoring
SELECT owner,
segment_name,
segment_type,
tablespace_name,
bytes/1048576 MB,
initial_extent,
next_extent,
extents,
pct_increase
FROM
DBA_SEGMENTS
WHERE
OWNER = 'table owner' AND
SEGMENT_NAME = 'table name' AND
SEGMENT_TYPE = 'TABLE'
/
total_tables,
round((done_tables-total_tables)*100,2) "%tables|done",
round((done_ROWS-total_rows)*100,2) "%rows|done"
from (
select
from all_tables
First you need to get the listing of running concurrent request in Oracle Apps 11i or R12. You
can use the SQL query script as below to obtain the list of running request.
SELECT a.request_id
,a.oracle_process_id "SPID"
,frt.responsibility_name
,c.concurrent_program_name || ': ' || ctl.user_concurrent_program_name
,a.description
,a.ARGUMENT_TEXT
,b.node_name
,b.db_instance
,a.logfile_name
,a.logfile_node_name
,a.outfile_name
,q.concurrent_queue_name
,a.phase_code,a.status_code, a.completion_text
, actual_start_date
, actual_completion_date
, fu.user_name
,(nvl(actual_completion_date,sysdate)-actual_start_date)*1440 mins
,(SELECT avg(nvl(a2.actual_completion_date-a2.actual_start_date,0))*1440 avg_run_time
FROM APPLSYS.fnd_Concurrent_requests a2,
APPLSYS.fnd_concurrent_programs c2
WHERE c2.concurrent_program_id = c.concurrent_program_id
AND a2.concurrent_program_id = c2.concurrent_program_id
AND a2.program_application_id = c2.application_id
AND a2.phase_code || '' = 'C') avg_mins
,round((actual_completion_date - requested_start_date),2) * 24 duration_in_hours
FROM APPLSYS.fnd_Concurrent_requests a,APPLSYS.fnd_concurrent_processes b
,applsys.fnd_concurrent_queues q
,APPLSYS.fnd_concurrent_programs c
,APPLSYS.fnd_concurrent_programs_tl ctl
,apps.fnd_user fu
,apps.FND_RESPONSIBILITY_TL frt
WHERE a.controlling_manager = b.concurrent_process_id
AND a.concurrent_program_id = c.concurrent_program_id
AND a.program_application_id = c.application_id
AND a.phase_code = 'R'
AND a.status_code = 'R'
AND b.queue_application_id = q.application_id
AND b.concurrent_queue_id = q.concurrent_queue_id
AND ctl.concurrent_program_id = c.concurrent_program_id
AND a.requested_by = fu.user_id
AND a.responsibility_id = frt.responsibility_id
ORDER BY a.actual_start_date DESC
You can see the request id and other relevant information from the result.
Based on the SPID associated to each running request, query the v$session or
v$session_longops table to see what is the request id doing in the backend.
SELECT b.sid, b.serial#, a.spid, b.program, b.osuser, b.machine,
b.TYPE, b.event, b.action, b.p1text, b.p2text, b.p3text, b.state, c.sql_text,b.logon_time
FROM v$process a, v$session b, v$sqltext c
WHERE a.addr=b.paddr
AND b.sql_hash_value = c.hash_value
AND b.STATUS = 'ACTIVE'
AND a.spid = '11696'
ORDER BY a.spid, c.piece
Replace v$session with gv$session if the database is running on RAC environment. Enable or
set trace if you wish to know more details on the session.
====================================================================
5.To find concurrent program name,phase code,status code for a given request id?
SELECT request_id, user_concurrent_program_name,
DECODE(phase_code,'C','Completed',phase_code)
phase_code, DECODE(status_code,'D', 'Cancelled' ,
'E', 'Error' , 'G', 'Warning', 'H','On Hold' , 'T', 'Terminating', 'M', 'No Manager' , 'X',
'Terminated', 'C', 'Normal', status_code) status_code, to_char(actual_start_date,'dd-mon-
yy:hh24:mi:ss') Start_Date, to_char(actual_completion_date,'dd-mon-yy:hh24:mi:ss'),
completion_text FROM apps.fnd_conc_req_summary_v WHERE request_id = '&req_id' ORDER
BY 6 DESC;
6.To find the sql query for a given concurrent request sid?
select 'ALTER SYSTEM KILL SESSION '''||sid||','||serial#||''' immediate;' from v$session where
MODULE like '';
SELECT a.request_id,
d.sid as Oracle_SID,
d.serial#,
d.osuser,
d.process,
c.SPID as OS_Process_ID
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;
12. Oracle Concurrent Request Error Script (requests which were error ed out)
SELECT a.request_id "Req Id"
,a.phase_code,a.status_code
, actual_start_date
, actual_completion_date
,c.concurrent_program_name || ': ' || ctl.user_concurrent_program_name "program"
FROM APPLSYS.fnd_Concurrent_requests a,APPLSYS.fnd_concurrent_processes b
,applsys.fnd_concurrent_queues q
,APPLSYS.fnd_concurrent_programs c
,APPLSYS.fnd_concurrent_programs_tl ctl
WHERE a.controlling_manager = b.concurrent_process_id
AND a.concurrent_program_id = c.concurrent_program_id
AND a.program_application_id = c.application_id
AND a.status_code = 'E'
AND a.phase_code = 'C'
AND actual_start_date > sysdate - 2
AND b.queue_application_id = q.application_id
AND b.concurrent_queue_id = q.concurrent_queue_id
AND ctl.concurrent_program_id = c.concurrent_program_id
AND ctl.LANGUAGE = 'US'
ORDER BY 5 DESC;
SELECT
user_concurrent_program_name,
request_date,
request_id,
phase_code,
status_code
FROM
fnd_concurrent_requests fcr,
fnd_concurrent_programs_tl fcp,
fnd_responsibility_tl fr,
fnd_user fu
WHERE
fcr.CONCURRENT_PROGRAM_ID = fcp.concurrent_program_id
and fcr.responsibility_id = fr.responsibility_id
and fcr.requested_by = fu.user_id
and user_name = '&user'
AND actual_start_date > sysdate - 1
ORDER BY REQUEST_DATE Asc;
The below query identifies the manager which will be executing a given program. This query is
based on the specialization rules set for the managers.
16.To see all the pending / Running requests per each manager wise
The below query can be used to find all incompatibilities in an application instance.
2 Through OAM
In oracle apps, navigate to
OAM>Site Map>/License Manager>Reports>Licensed Products
Here filter the products by using "Licensed". These are the licensed and installed products in
oracle apps.
SELECT a.application_name,a.product_code,
DECODE (b.status, 'I', 'Installed', 'S', 'Shared', 'N/A') status,
patch_level
FROM apps.fnd_application_vl a,
apps.fnd_product_installations b
WHERE a.application_id = b.application_id
and b.status='I'
order by product_code asc;
19.How to Find out Product Installations and Patch Set level in Oracle Applications 11i ?
20. How to Find Environment Variables from database table - Oracle E-Business Suite
Are you running Oracle E-Business Suite (EBS) / Applications and want to get an operating
system level environment variable value from a database table, for example for use in PL/SQL?
Or perhaps to default a concurrent program parameter? Didn't think environment variables
were stored in the database?
Try out out this query that shows you $FND_TOP:
select value
from fnd_env_context
where variable_name = 'FND_TOP'
and concurrent_process_id =
( select max(concurrent_process_id) from fnd_env_context );
VALUE
--------------------------------------------------------------------------------
/d01/oracle/VIS/apps/apps_st/appl/fnd/12.0.0
-------------------------------------------------------------------------------
Or
Did you want to find out the Product "TOP" directories e.g the full directory path values from
fnd_appl_tops under APPL_TOP?
VARIABLE_NAME VALUE
--------------- ----------------------------------------------------------------
AD_TOP /d01/oracle/VIS/apps/apps_st/appl/ad/12.0.0
AF_JRE_TOP /d01/oracle/VIS/apps/tech_st/10.1.3/appsutil/jdk/jre
AHL_TOP /d01/oracle/VIS/apps/apps_st/appl/ahl/12.0.0
AK_TOP /d01/oracle/VIS/apps/apps_st/appl/ak/12.0.0
ALR_TOP /d01/oracle/VIS/apps/apps_st/appl/alr/12.0.0
AME_TOP /d01/oracle/VIS/apps/apps_st/appl/ame/12.0.0
AMS_TOP /d01/oracle/VIS/apps/apps_st/appl/ams/12.0.0
AMV_TOP /d01/oracle/VIS/apps/apps_st/appl/amv/12.0.0
AMW_TOP /d01/oracle/VIS/apps/apps_st/appl/amw/12.0.0
APPL_TOP /d01/oracle/VIS/apps/apps_st/appl
AP_TOP /d01/oracle/VIS/apps/apps_st/appl/ap/12.0.0
AR_TOP /d01/oracle/VIS/apps/apps_st/appl/ar/12.0.0
...
select value
from fnd_env_context
where variable_name = 'APPLTMP'
and concurrent_process_id =
( select max(concurrent_process_id) from fnd_env_context );
VALUE
--------------------------------------------------------------------------------
/d01/oracle/VIS/inst/apps/VIS_demo/appltmp
NB: These queries assume your concurrent managers are running!
SELECT
DBA_USERS.USERNAME USERNAME,
DECODE(V$SESSION.USERNAME, NULL, 'NOT CONNECTED', 'CONNECTED') STATUS,
NVL(OSUSER, '-') OSUSER,
NVL(TERMINAL,'-') TERMINAL,
SUM(DECODE(V$SESSION.USERNAME, NULL, 0,1)) SESSIONS
FROM
DBA_USERS, V$SESSION
WHERE DBA_USERS.USERNAME = V$SESSION.USERNAME (+)
GROUP BY
DBA_USERS.USERNAME,
DECODE(V$SESSION.USERNAME, NULL, 'NOT CONNECTED', 'CONNECTED'),
OSUSER,
TERMINAL
ORDER BY 1 ;
SELECT
f.user_name
,a.request_id "Req Id"
,a.concurrent_program_id "Prg Id"
,a.RESPONSIBILITY_ID Responsibility
,a.phase_code,a.status_code
,b.os_process_id "OS"
,vs.sid
,vs.serial# "Serial#"
,vp.spid
,TO_CHAR(request_date,'DD-MON-YY hh24:mi:ss') request_date
,(NVL(a.actual_completion_date,SYSDATE)-a.actual_start_date)*1440 "Time"
,c.concurrent_program_name||' - '||c2.user_concurrent_program_name "Program"
FROM APPLSYS.fnd_Concurrent_requests a
,APPLSYS.fnd_concurrent_processes b
,applsys.fnd_concurrent_queues q
,APPLSYS.fnd_concurrent_programs_tl c2
,APPLSYS.fnd_concurrent_programs c
,APPLSYS.fnd_user f
,v$session vs
,v$process vp
WHERE
a.controlling_manager = b.concurrent_process_id
AND a.concurrent_program_id = c.concurrent_program_id
AND a.program_application_id = c.application_id
AND c2.concurrent_program_id = c.concurrent_program_id
AND c2.application_id = c.application_id
AND a.phase_code IN ('I','P','R','T')
AND a.requested_by = f.user_id
AND b.queue_application_id = q.application_id
AND b.concurrent_queue_id = q.concurrent_queue_id
AND c2.LANGUAGE = 'US'
AND a.oracle_process_id = vp.spid
AND vs.paddr = vp.addr
ORDER BY 9
Step 2 : Get Sid from step1 and Keep on executing this query in SQL. This query will show the
currently running SQL in the DB, as your concurrent is submitted and running. You can now
find out the exact query ( select / insert / update ) which is actually taking time in your
concurrent program.
SELECT sql_text FROM v$sqltext t,v$session s
WHERE t.ADDRESS = s.SQL_ADDRESS
AND t.HASH_VALUE = s.SQL_HASH_VALUE
AND s.sid = 100 – Get this value from step1
ORDER BY PIECE
Step 3 :
------------
The following query finds total run-time (in minutes) for a concurrent program. Thus, with a
little modification to this query, you can track which concurrent programs take (very) long time
to complete, and may need performance tuning.
-------------------------------------------------------------------------------
-- Query to find runtime for a concurrent program
-------------------------------------------------------------------------------
SELECT /*+ rule */
rq.parent_request_id "Parent Req. ID",
rq.request_id "Req. ID",
tl.user_concurrent_program_name "Program Name",
rq.actual_start_date "Start Date",
rq.actual_completion_date "Completion Date",
ROUND((rq.actual_completion_date -
rq.actual_start_date) * 1440, 2) "Runtime (in Minutes)"
FROM applsys.fnd_concurrent_programs_tl tl,
applsys.fnd_concurrent_requests rq
WHERE tl.application_id = rq.program_application_id
AND tl.concurrent_program_id = rq.concurrent_program_id
AND tl.LANGUAGE = USERENV('LANG')
AND rq.actual_start_date IS NOT NULL
AND rq.actual_completion_date IS NOT NULL
AND tl.user_concurrent_program_name = 'Autoinvoice Import Program' -- <change it>
-- AND TRUNC(rq.actual_start_date) = '&start_date' -- uncomment this for a specific date
ORDER BY rq.request_id DESC;
*************************************************************
Here is a sample anonymous PL/SQL block which will reset the Oracle Apps frontend
password for a given user from backend
DECLARE
flag_value BOOLEAN;
BEGIN
flag_value :=
fnd_user_pkg.changepassword(username=> 'NKUMAR2'
,newpassword => 'welcome1');
IF flag_value
THEN
DBMS_OUTPU.PUT_LINE('The password reset successfully');
ELSE
DBMS_OUTPUT.PUT_LINE('The password reset has failed');
END IF;
END;
/
COMMIT;
25 .Checking the duplicated schedules of the same program with the same arguments
The below query can be used to check the duplicated schedule of the same program with the
same arguments. This can be used to alert the users to cancel these duplicated schedules.
Note: This query will return even though the request was submitted using a different
responsibility.
A Request can be in Pending state for variety of reasons like conflict with other requests,
improperly tuned managers (sleep seconds / cache size / number of managers etc)
We can schedule this script to gather data regularly for historical analysis as we normally
purge the concurrent requests regularly.
SELECT TO_CHAR (actual_start_date, 'DD-MON-YYYY') DAY,
concurrent_queue_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
WHERE cr.phase_code = 'C'
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 fcp.concurrent_queue_id = fcq.concurrent_queue_id
GROUP BY TO_CHAR (actual_start_date, 'DD-MON-YYYY'), concurrent_queue_name
ORDER BY 2;
Note: Depending on the purging schedules some requests might miss if the corresponding
data in fnd_concurrent_processes is purged.
Do you need a daily report which would give an average run time of all concurrent requests in
your environment?
So you would know which concurrent request is taking longer time and on which day:
The below script gives an average run time for all concurrent requests for the current day,
previous day, day before yesterday and for the whole week:
OUTFILE LOGFILE
------------------------------ ------------------------------
/usr/tmp/PROD/o0068190.tmp /usr/tmp/PROD/l0068190.tmp
REM Now tail log file on database node to see where it is at, near realtime
REM tail -f /usr/tmp/l0068190.tmp
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
DECODE(fcr.phase_code,
'C', 'Completed',
'P', 'Pending',
'R', 'Running',
'I', 'Inactive',
fcr.phase_code) "Phase",
DECODE(fcr.status_code,
'A', 'Waiting',
'B', 'Resuming',
'C', 'Normal',
'D', 'Cancelled',
'E', 'Error',
'F', 'Scheduled',
'G', 'Warning',
'I', 'Normal',
'Q', 'Standby',
'R', 'Normal',
'S', 'Suspended',
'T', 'Terminating',
'U', 'Disabled',
'W', 'Paused',
'X', 'Terminated',
'Z', 'Waiting',
fcr.status_code) "Status",
-- fcr.number_of_arguments,
-- fcr.argument_text,
-- fcr.logfile_name,
-- fcr.outfile_name
fnd_responsibility_tl frt,
fnd_concurrent_requests fcr,
fnd_concurrent_programs_tl fcpt
********************************************************
SELECT
(SELECT application_short_name
FROM fnd_application fa
WHERE fa.application_id = frt.application_id)
application
, frt.responsibility_id
, frt.responsibility_name
FROM apps.fnd_responsibility_tl frt;
//*
2. Menus Listing
Purpose/Description:
To see the Menus associated with a given responsibility
Parameters
responsibility_id that you can retrieve from query nr 1 (Responsibilities Listing)
*//
SELECT DISTINCT
a.responsibility_name
, c.user_menu_name
FROM
apps.fnd_responsibility_tl a
, apps.fnd_responsibility b
, apps.fnd_menus_tl c
, apps.fnd_menus d
, apps.fnd_application_tl e
, apps.fnd_application f
WHERE
a.responsibility_id(+) = b.responsibility_id
AND a.responsibility_id = 50103
AND b.menu_id = c.menu_id
AND b.menu_id = d.menu_id
AND e.application_id = f.application_id
AND f.application_id = b.application_id
AND a.LANGUAGE = ‘US’;
//*
3. Submenu And Function Listing
Purpose/Description:
By using this query you can check function and submenus attached to a specific menu
Parameters
User_menu_name that you can get by running query 2 (Menu Listing)
*//
SELECT
c.prompt
, c.description
FROM
apps.fnd_menus_tl a
, fnd_menu_entries_tl c
WHERE
a.menu_id = c.menu_id
AND a.user_menu_name = ‘Navigator Menu – System Administrator GUI’;
//*
4.User and Assigned Responsibility Listing
Purpose/Description:
You can use this query to check responsibilities assigned to users.
Parameters
None
*//
SELECT UNIQUE
u.user_id
, SUBSTR (u.user_name, 1, 30) user_name
, SUBSTR (r.responsibility_name, 1, 60) responsiblity
, SUBSTR (a.application_name, 1, 50) application
FROM
fnd_user u
, fnd_user_resp_groups g
, fnd_application_tl a
, fnd_responsibility_tl r
WHERE
g.user_id(+) = u.user_id
AND g.responsibility_application_id = a.application_id
AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id
ORDER BY
SUBSTR (user_name, 1, 30)
, SUBSTR (a.application_name, 1, 50)
, SUBSTR (r.responsibility_name, 1, 60);
//*
5. Responsibility and assigned request group listing
Purpose/Description:
To find responsibility and assigned request groups.
Every responsibility contains a request group (The request group is basis of submitting
requests)
Parameters
None
*//
SELECT
responsibility_name responsibility
, request_group_name
, frg.description
FROM
fnd_request_groups frg
, fnd_responsibility_vl frv
WHERE
frv.request_group_id = frg.request_group_id
ORDER BY responsibility_name
//*
6. Profile option with modification date and user
Purpose/Description:
Query that can be used to audit profile options.
Parameters
None
*//
SELECT
t.user_profile_option_name
, profile_option_value
, v.creation_date
, v.last_update_date
, v.creation_date – v.last_update_date "Change Date"
, (SELECT UNIQUE user_name
FROM fnd_user
WHERE user_id = v.created_by) "Created By"
, (SELECT user_name
FROM fnd_user
WHERE user_id = v.last_updated_by) "Last Update By"
FROM
fnd_profile_options o
, fnd_profile_option_values v
, fnd_profile_options_tl t
WHERE
o.profile_option_id = v.profile_option_id
AND o.application_id = v.application_id
AND start_date_active <= SYSDATE
AND NVL (end_date_active, SYSDATE) >= SYSDATE
AND o.profile_option_name = t.profile_option_name
AND level_id = 10001
AND t.LANGUAGE IN (SELECT language_code
FROM fnd_languages
WHERE installed_flag = ‘B’
UNION
SELECT nls_language
FROM fnd_languages
WHERE installed_flag = ‘B’)
ORDER BY user_profile_option_name;
//*
7. Forms personalization Listing
Purpose/Description:
To get modified profile options.
Personalization is a feature available in 11.5.10.X.
Parameters
None
*//
SELECT
ffft.user_function_name "User Form Name"
, ffcr.SEQUENCE
, ffcr.description
, ffcr.rule_type
, ffcr.enabled
, ffcr.trigger_event
, ffcr.trigger_object
, ffcr.condition
, ffcr.fire_in_enter_query
, (SELECT user_name
FROM fnd_user fu
WHERE fu.user_id = ffcr.created_by) "Created By”
FROM
fnd_form_custom_rules ffcr
, fnd_form_functions_vl ffft
WHERE ffcr.ID = ffft.function_id
ORDER BY 1;
//*
8. Patch Level Listing
Purpose/Description:
Query that can be used to view the patch level status of all modules
Parameters
None
*//
SELECT
a.application_name
, DECODE (b.status, ‘I’, ‘Installed’, ‘S’, ‘Shared’, ‘N/A’) status
, patch_level
FROM
apps.fnd_application_vl a
, apps.fnd_product_installations b
WHERE
a.application_id = b.application_id;
//*
9. Request attached to responsibility listing
Purpose/Description:
To see all requests attached to a responsibility
Parameters
None
*//
SELECT
responsibility_name
, frg.request_group_name
, fcpv.user_concurrent_program_name
, fcpv.description
FROM
fnd_request_groups frg
, fnd_request_group_units frgu
, fnd_concurrent_programs_vl fcpv
, fnd_responsibility_vl frv
WHERE
frgu.request_unit_type = ‘P’
AND frgu.request_group_id = frg.request_group_id
AND frgu.request_unit_id = fcpv.concurrent_program_id
AND frv.request_group_id = frg.request_group_id
ORDER BY responsibility_name;
//*
10. Request listing application wise
Purpose/Description:
View all request types application wise
Parameters
None
*//
SELECT
fa.application_short_name
, fcpv.user_concurrent_program_name
, description
, DECODE (fcpv.execution_method_code
,’B', ‘Request Set Stage Function’
,’Q', ‘SQL*Plus’
,’H', ‘Host’
,’L', ‘SQL*Loader’
,’A', ‘Spawned’
,’I', ‘PL/SQL Stored Procedure’
,’P', ‘Oracle Reports’
,’S', ‘Immediate’
,fcpv.execution_method_code) exe_method
, output_file_type
, program_type
, printer_name
, minimum_width
, minimum_length
, concurrent_program_name
, concurrent_program_id
FROM
fnd_concurrent_programs_vl fcpv
, fnd_application fa
WHERE
fcpv.application_id = fa.application_id
ORDER BY description
//*
11. Count Reports per module
Purpose/Description:
To Count Reports
Parameters
None
*//
SELECT
fa.application_short_name
, DECODE (fcpv.execution_method_code
,’B', ‘Request Set Stage Function’
,’Q', ‘SQL*Plus’
,’H', ‘Host’
,’L', ‘SQL*Loader’
,’A', ‘Spawned’
,’I', ‘PL/SQL Stored Procedure’
,’P', ‘Oracle Reports’
,’S', ‘Immediate’
,fcpv.execution_method_code) exe_method
, COUNT (concurrent_program_id) COUNT
FROM
fnd_concurrent_programs_vl fcpv
, fnd_application fa
WHERE
fcpv.application_id = fa.application_id
GROUP BY
fa.application_short_name
, fcpv.execution_method_code
ORDER BY 1;
//*
12. Request Status Listing
Purpose/Description:
This query returns report/request processing time
Parameters
None
*//
SELECT
f.request_id
, pt.user_concurrent_program_name user_concurrent_program_name
, f.actual_start_date actual_start_date
, f.actual_completion_date actual_completion_date
, floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)
‘ HOURS ‘
floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)
‘ MINUTES ‘
round((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600 -
(floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)*60) ))
‘ SECS ‘ time_difference
, DECODE(p.concurrent_program_name
,’ALECDC’
,p.concurrent_program_name’['
f.description']‘
,p.concurrent_program_name) concurrent_program_name
, decode(f.phase_code
,’R',’Running’
,’C',’Complete’
,f.phase_code) Phase
, f.status_code
FROM
apps.fnd_concurrent_programs p
, apps.fnd_concurrent_programs_tl pt
, apps.fnd_concurrent_requests f
WHERE
f.concurrent_program_id = p.concurrent_program_id
AND f.program_application_id = p.application_id
AND f.concurrent_program_id = pt.concurrent_program_id
AND f.program_application_id = pt.application_id
AND pt.language = USERENV(‘Lang’)
AND f.actual_start_date is not null
ORDER by f.actual_completion_date-f.actual_start_date desc;
//*
13. User and responsibility listing
Purpose/Description:
Check responsibilities assigned to users
Parameters
None
*//
SELECT UNIQUE
u.user_id
, SUBSTR (u.user_name, 1, 30) user_name
, SUBSTR (r.responsibility_name, 1, 60) responsiblity
, SUBSTR (a.application_name, 1, 50) application
FROM
fnd_user u
, fnd_user_resp_groups g
, fnd_application_tl a
, fnd_responsibility_tl r
WHERE g.user_id(+) = u.user_id
AND g.responsibility_application_id = a.application_id
AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id
–AND a.application_name like ‘%Order Man%’
ORDER BY SUBSTR (user_name, 1, 30),
SUBSTR (a.application_name, 1, 50),
SUBSTR (r.responsibility_name, 1, 60)
//*
14. Applied Patch Listing
Purpose/Description:
Check Current Applied Patches
Parameters
None
*//
SELECT
patch_name
, patch_type
, maint_pack_level
, creation_date
FROM applsys.ad_applied_patches
ORDER BY creation_date DESC
15. How to check the System Administarator responsiblity for the users in ORACLE EBS ?
Tuning SQLs
Enable Trace for a concurrent program
step 1
SQL>
SQL> oradebug event 10046 trace name context off
Statement processed.
SQL>
**********************************************************************
**********************************************************************
SELECT s.sid,
s.serial#,
p.spid,
s.process,
substr(to_char(s.logon_time,'mm-dd-yy hh24:mi:ss'),1,20) Logon_Time,
s.action,
s.module,
fu.user_name,
fip.ipaddress
FROM
V$SESSION s, V$PROCESS p,fnd_oam_forms_rti fip, fnd_logins fl, fnd_user fu
WHERE s.paddr = p.addr
AND s.process = fip.PID
AND fl.pid = p.pid
AND fl.user_id = fu.user_id
AND s.username IS NOT NULL
AND s.username = <'apps username'>
AND s.osuser = <'applmgr or os user who owns the application>'
**********************************************************************
SELECT a.session_id,
a.user_id,
b.user_name,
b.description,
c.RESPONSIBILITY_NAME,
d.APPLICATION_SHORT_NAME,
e.APPLICATION_NAME,
TO_CHAR (first_connect, 'MM/DD/YYYY HH:MI:SS') start_time,
TO_CHAR (last_connect,
'MM/DD/YYYY HH:MI:SS'
)"Date and time of last hit"
FROM apps.icx_sessions a,
apps.fnd_user b,
apps.fnd_responsibility_tl c,
apps.fnd_application d,
apps.fnd_application_tl e
WHERE a.user_id = b.user_id
AND last_connect > SYSDATE -1
AND a.counter < limit_connects
and a.responsibility_id = c.responsibility_id
and c.application_id = d.application_id
and c.application_id = e.application_id
order by a.last_update_date desc;
**********************************************************************
**********************************************************************
Checking the details of indexes and sampling size and judge whether it is required or not
**********************************************************************
Taken from Arup Nanda Blog
select sid
from v$session s, v$process p
where p.spid = 956
and s.paddr = p.addr;
3806
select sql_fulltext
from v$sql l, v$session s
where s.sid = 3806
and l.sql_id = s.sql_id;
--------------------------------------
----------------------------------------
select
blocking_session B_SID,
blocking_instance B_Inst
from v$session
where sid = 3346;
B_SID B_INST
—————— ———————
2832 1
----------------------------------------------------
select row_wait_obj#,
row_wait_file#,
row_wait_block#,
row_wait_row#
from v$session
where sid = 3346;
-------------------------------------------------------
COL1 C
————— —
1 x
----------------------------------
--------------------------------------------
select sql_id
from v$session
where sid = 3089;
SQL_ID
—————————————————
g0uubmuvk4uax
-------------------------------------------------------
The P1 column shows the file ID, and the P2 column shows the block ID. From that information in the
result in Listing 7, you can get the segment name from the extent information in DBA_EXTENTS, as
shown below:
select owner, segment_name
from dba_extents
where file_id = 5
and 3011 between block_id
and block_id + blocks;
OWNER SEGMENT_NAME
—————— —————————————
ARUP T1
select s.value
from v$sesstat s, v$statname n
where s.sid = 3806
and n.statistic# = s.statistic#
and n.name = 'CPU used by this session';
**********************************************************************
Checking the percentage compeletion for long ops
taken from https://carlos-sierra.net/2014/11/02/finding-sql-with-performance-changing-over-time/
--------------------------------------------------------------------------------
--
--
-- Purpose: Lists SQL Statements with Elapsed Time per Execution changing ov
--
--
-- Version: 2014/10/31
--
-- Usage: Lists statements that have changed their elapsed time per execut
-- this metric for SQL statements within the sampled history, and u
-- linear regression identifies those that have changed the most. I
-- words where the slope of the linear regression is larger. Positi
--
-- Example: @sql_performance_changed.sql
--
--
--
--
--------------------------------------------------------------------------------
--
SPO sql_performance_changed.txt;
PRO SQL Statements with "Elapsed Time per Execution" changing over time
WITH
per_time AS (
SELECT h.dbid,
h.sql_id,
FROM dba_hist_sqlstat h,
dba_hist_snapshot s
GROUP BY
h.dbid,
h.sql_id,
),
avg_time AS (
SELECT dbid,
sql_id,
MEDIAN(time_per_exec) med_time_per_exec,
STDDEV(time_per_exec) std_time_per_exec,
AVG(time_per_exec) avg_time_per_exec,
MIN(time_per_exec) min_time_per_exec,
MAX(time_per_exec) max_time_per_exec
FROM per_time
GROUP BY
dbid,
sql_id
),
time_over_median AS (
SELECT h.dbid,
h.sql_id,
h.days_ago,
a.med_time_per_exec,
a.std_time_per_exec,
a.avg_time_per_exec,
a.min_time_per_exec,
a.max_time_per_exec
),
ranked AS (
t.dbid,
t.sql_id,
ROUND(AVG(t.med_time_per_exec)/1e6, 3) med_secs_per_exec,
ROUND(AVG(t.std_time_per_exec)/1e6, 3) std_secs_per_exec,
ROUND(AVG(t.avg_time_per_exec)/1e6, 3) avg_secs_per_exec,
ROUND(MIN(t.min_time_per_exec)/1e6, 3) min_secs_per_exec,
ROUND(MAX(t.max_time_per_exec)/1e6, 3) max_secs_per_exec
FROM time_over_median t
GROUP BY
t.dbid,
t.sql_id
r.sql_id,
r.change,
FROM ranked r
ORDER BY
r.rank_num
SPO OFF;
Once you get the output of this script above, you can use the one below to actually list the
time series for one of the SQL statements of interest:
----------------------------------------------------------------------------------
------
--
--
--
-- Version: 2014/10/31
--
--
-- Parameters: SQL_ID
--
-- Example: @one_sql_time_series.sql
--
--
--
----------------------------------------------------------------------------------
-----
--
SPO one_sql_time_series.txt;
SELECT h.instance_number,
h.plan_hash_value,
h.executions_total,
TO_CHAR(ROUND(h.rows_processed_total / h.executions_total),
'999,999,999,999') rows_per_exec,
FROM dba_hist_sqlstat h,
dba_hist_snapshot s
ORDER BY
h.sql_id,
h.instance_number,
s.end_interval_time,
h.plan_hash_value
SPO OFF;
In EBS 12.2 we all know that Online patching has been introduced. Thus during a patching cycle
if a patch has been applied using adop phase=apply and later we aborted it before the cycle
gets complete, the table ad_bugs and ad_applied_patches will not be updated. So we cannot
query these two tables. As per metalink note:Doc ID 1963046.1, use the below query to find out
if a patch has been applied or not.
**************************************************
select AD_PATCH.IS_PATCH_APPLIED(\'$release\',\'$appltop_id\',\'$patch_no\',\'$language\')
from dual;
Example sql using the APPL_TOP ID for a specific node in a multinode environment (1045 is the
APPL_TOP ID):
expected results:
EXPLICIT = applied
NOT APPLIED = not applied / aborted
Also don't forget to complete the APPL_TOP snapshot using adadmin option.
***********************************************************************
<INSTALL BASE>/fs_ne/EBSapps/log/adop
Download any required technology patches and unzip the contents. The patch contents may be
unzipped into $NE_BASE/EBSapps/patch.
$ adop phase=prepare
2. Apply technology patches to the Oracle Home under the Patch f/s using the information below.
3. Apply any Oracle E-Business Suite patches planned for this patching cycle
4. After all patches have been successfully applied, complete the patching cycle.
$ adop phase=finalize
$ adop phase=cutover
Note: Below steps can be done when applications are up and running
6. To complete the process and synchronize the technology level between patch and run f/s.
$ adop phase=fs_clone
adop hotpatch steps (we cannot abort hotpatch and abondon cannot be done):
After hotpatch please run phase=cleanup and phase=fs_clone to sync the run fs with patch fs to
prepare for next patching cycle
If we try to re-apply the patch which is already applied/exists then adop patch terminates
with below message and by default it takes N when prompted. to overcome this we need to
re-apply patch with options=forceapply.
This Patch seems to have been applied already.
Would you like to continue anyway [N] ? N *
$ adop phase=abort
$ adop phase=cleanup cleanup_mode=full
$ adop phase=fs_clone
Then reapply the patch
1. Use adctrl and select option#8 (This will not be visible) to skip thefailed jobs
2. Restart adop using "restart=yes" parameter
** If the failed jobs are numerous, then better to re-start this patch once again with autoskip option.
This command will restart the patch once again from starting onwards and will skip all the failures if
any comes. But make sure to review the log file at the end of the patch application that you have
skipped the failures that you want to.
Refer Note:
How to Apply WebLogic Server (WLS) Patches Using Smart Update [Video] (Doc ID 876004.1)
3.cd $FMW_HOME/utils/bsu
To install patch:
./bsu.sh -prod_dir=$FMW_HOME/wlserver_10.3 -patchlist=7FC9 -verbose -install
To Verify:
./bsu.sh -prod_dir=$FMW_HOME/wlserver_10.3 -status=applied -verbose -view | grep 7FC9
To Rollback:
./bsu.sh -remove -patchlist=7FC9 -prod_dir=$FMW_HOME/wlserver_10.3 -verbose
We can also apply the Smart Update patch in graphical (GUI) mode.
$ export ORACLE_HOME=$FMW_HOME/webtier
$ export PATH=$ORACLE_HOME/OPatch:$PATH
$ opatch lsinventory
Apply opatch:
$ opatch apply
$ export ORACLE_HOME=$FMW_HOME/oracle_common
$ export PATH=$ORACLE_HOME/OPatch:$PATH
$ opatch lsinventory
Apply opatch:
$ opatch apply
Queries :
In Oracle E Business Suite (ebs erp) R12.2.x you cannot query the AD_BUGS table to check if
patches have been applied..
The AD_BUGS table may have entries for patches that were applied but later the patching cycle was
aborted (not really applied).
The way to check whether a patch is really applied is to use the AD_PATCH.IS_PATCH_APPLIED
PL/SQL function.
Usage:
select AD_PATCH.IS_PATCH_APPLIED(\'$release\',\'$appltop_id\',\'$patch_no\',\'$language\')
from dual;
Example sql:
Expected results:
EXPLICIT = applied
NOT APPLIED = not applied / aborted
Note: If you are sure patch is applied, but showing as not applied then do the following workaround.
Restarting adop
1 If you have shut down the workers, or if adop quits while performing processing actions, it saves all
the actions completed up to that point in restart files.
Investigate and Patching Utilities resolve the problem that caused the failure,
then restart adop. After you restart adop, it will ask if you want to continue with the previous session
(at the point where the processing stopped), or start a new session.
To restart from beginning, use restart=no abandon=yes
To restart a patch you need to use restart=yes abandon=no .
2.2
column id format 99
column bn format a12
column pr format 99999999
column afs format a40
column pfs format a40
column cs format a9
column nn format a10
column ed format a28
column drv format a28
column pt format a35
It looks like the first ADOP cycle (prepare phase) was attempted at session ID 2 and then for some
reason it didn't finish and then an abort was initiated which did finish. A new ADOP session (ID 3)
was attempted but via hotpatch and it failed. Since this table only reports what went on with ADOP
there's no information about adpatch usage, i.e. if it was used before the
first ADOP cycle or in between session 2 and 3, or after session 3.
2.4 To diagnostic further for the root cause why patch application failed, we need adpatch log for the
failed patch xxxx.
cd $APPL_TOP_NE/../log/adop/<session id>
eg.
/d01/EBS/VIS/fs_ne/EBSapps/log/adop/<session id>/timestamp/context_name/xxxx/log
3 If you are just wants to start from a fresh page and considering the state of these tables
I would suggest making a manual modification to the AD_ADOP_SESSIONS table just so it would
not hold up ADOP execution due to an
incomplete hotpatch session.
Do the following:
update ad_adop_sessions set status='C' where adop_session_id=3;