Friday, August 13, 2010

Concurrent Manager and program related scripts

SQL Script to Troubleshoot a long-running concurrent request

set term on
set feedback on
set echo on
set arraysize 4
set linesize 200
set pages 9999
set underline =;
column username format A15
column sid format 9990 heading SID
column type format A4
column lmode format 990 heading 'HELD'
column request format 990 heading 'REQ'
column id1 format 9999990
column id2 format 9999990
column sql_text format a100
column name format a80
break on id1 skip 1 dup
undefine v_request_id
define v_request_id
undefine v_spid
define v_spid
undefine v_sid
define v_sid
spool vj_concurrent_monitor.lst

Prompt Enter the concurrent_request_id
Accept v_request_id
prompt checking requests
select oracle_process_id from fnd_concurrent_requests where request_id='&v_request_id';

Prompt Enter the operating system oracle process id for this concurrent request
accept v_spid
Prompt Getting the sid
SELECT SID,SERIAL#,LOGON_TIME FROM V$SESSION WHERE PADDR IN
(SELECT ADDR FROM V$PROCESS WHERE SPID='&v_spid');

prompt Enter the session id for this concurrent request
accept v_sid
prompt memory usage for this session
SELECT A.SID,A.USERNAME,B.VALUE,c.name FROM V$SESSION a,V$SESSTAT B,V$STATNAME C WHERE A.SID=B.SID
AND B.STATISTIC#=C.STATISTIC# AND C.NAME like'%memor%' and a.sid='&v_sid';

prompt resource usage for this session
SELECT A.SID,A.USERNAME,B.VALUE,c.name FROM V$SESSION a,V$SESSTAT B,V$STATNAME C WHERE A.SID=B.SID
AND B.STATISTIC#=C.STATISTIC# and a.sid='&v_sid' order by b.value;


prompt this session waited on
select sid,event,wait_time,state from v$session_wait where sid='&v_sid' order by wait_time;


prompt current sql executing by this session
select a.sid,b.sorts,b.executions,b.loads,b.parse_calls,b.disk_reads,
b.buffer_gets,b.rows_processed,C.sql_text from v$session a,v$sqlarea b,V$SQLTEXT C
where a.sql_address=b.address and b.address=c.address and a.sid='&v_sid';


prompt sql which is taking more than 3mb in shared pool
prompt nosql should take morethan 1mb in shared pool.
prompt please ask the developers to tune the following sql statements
select name,
namespace,type,sharable_mem/(1024*1024) sharablemem,loads,executions,locks,pins,kept from v$db_object_cache
where SHARABLE_MEM>3000000;


prompt sort segments using by this session
SELECT s.username,s.sid,s.osuser,s.process,s.machine,u.extents, u.blocks,u.tablespace FROM v$session s, v$sort_usage u
WHERE s.saddr=u.session_addr order by extents;
and s.sid='&v_sid';

prompt current temp segments free in this instance
SELECT tablespace_name, extent_size, total_extents, used_extents, free_extents, max_used_size FROM v$sort_segment;



prompt total system events at this time
select event,total_waits waits, total_timeouts timeouts, time_waited total_time from v$system_event order by total_waits;

prompt latch contention if thery is any
SELECT latch#, name, gets, misses, sleeps FROM v$latch WHERE sleeps>0 ORDER BY sleeps ;


prompt the latch which is sleeping
select name, sleeps,latch# from v$latch_children where sleeps>4 order by sleeps;


spool off
clear columns
clear breaks

How to find out which request is handle by which concurrent queue.
a) First find out short_name of a program and then pass it as parameter to below query.

b) The below query will give you output
 I - Included  - Included in new concurrent queue
 E - excluded from Standard Manager 

This way you know now this running program (concurrent request) is handled by new manager and not part of standard manager.

SELECT A.INCLUDE_FLAG, A.QUEUE_APPLICATION_ID, C.USER_CONCURRENT_QUEUE_NAME,
 B.CONCURRENT_PROGRAM_NAME
FROM APPLSYS.FND_CONCURRENT_QUEUE_CONTENT A, APPLSYS.FND_CONCURRENT_PROGRAMS B, APPS.FND_CONCURRENT_QUEUES_VL C
WHERE type_id = b.concurrent_program_id and b.concurrent_program_name = ‘&SHORT_NAME’ and c.concurrent_queue_id = a.concurrent_queue_id


How to find out Summary of Concurrent requests.

SELECT
request_id, SUBSTR(requestor,1,25), SUBSTR(program,1,50), SUBSTR(user_concurrent_program_name,1,100),
TO_CHAR(actual_start_date,’dd/mm/yy :hh24:mi’) start_date,
TO_CHAR(actual_completion_date,’dd/mm/yy :hh24:mi’) completion_date,
FLOOR((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24) “in Hours”,
(((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24)-(FLOOR((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24)))*60 “In_Min”
–requestor, program, user_concurrent_program_name
FROM fnd_conc_req_summary_v
WHERE (ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24*60 >10

How to find database SID from a Concurrent request.

column process heading “FNDLIBR PID”
SELECT a.request_id, d.sid, d.serial# ,d.osuser,d.process , c.SPID
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
v$process c,
v$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’;
You need your concurrent request ID as an input.
c.SPID= is the operating system process id
d.sid= is the Oracle process id

Cancel Concurrent requests. We don't need concurrent requests which are scheduled in production to keep running in test. We use the following update to cancel them.
update fnd_concurrent_requests
set phase_code='C',
status_code='D'
where phase_code = 'P'
and concurrent_program_id not in (
select concurrent_program_id
from fnd_concurrent_programs_tl
where user_concurrent_program_name like '%Synchronize%tables%'
or user_concurrent_program_name like '%Workflow%Back%'
or user_concurrent_program_name like '%Sync%responsibility%role%'
or user_concurrent_program_name like '%Workflow%Directory%')
and (status_code = 'I' OR status_code = 'Q');

Use the SQL below to only cancel the running requests connecting as sys
UPDATE applsys.fnd_concurrent_requests
SET phase_code = 'C', status_code = 'X'
WHERE phase_code = 'R' and status_code ='R'
/
commit

Also, please put all Pending Jobs on Hold, using the SQL below connecting as sys

update applsys.fnd_concurrent_requests
set hold_flag='Y' where
phase_code='P' and hold_flag='N'
/
commit
update fnd_concurrent_requests fcr
set phase_code = 'C',
status_code = 'D'
where fcr.PHASE_CODE <> 'C'
and (fcr.program_application_id,fcr.CONCURRENT_PROGRAM_id) in
(select fcp.application_id,fcp.concurrent_program_id from fnd_concurrent_programs fcp,fnd_executables_vl fev
where fcp.executable_application_id=fev.application_id and fcp.executable_id=fev.executable_id
and (upper(fev.user_executable_name) like 'AL%MAIL%'
or upper(fev.user_executable_name) like 'AL%FTP%'
or upper(fev.user_executable_name) like 'AL%EXCEL%'))
/


To change the number of processes for the standard manager
update FND_CONCURRENT_QUEUE_SIZE
set min_processes = 4
where concurrent_queue_id = 0;

how to find params passed to request from backend

select CONCURRENT_PROGRAM_ID,CONCURRENT_PROGRAM_NAME from fnd_concurrent_programs where concurrent_program_name like '';

select REQUEST_ID,CONCURRENT_PROGRAM_ID,substr(ARGUMENT_TEXT,1,60)params,status_code,phase_code from fnd_concurrent_requests where CONCURRENT_PROGRAM_ID=;

To increase the jvm for OPP

"From Note ID 737311.1 we need to do step 3 We are changing this parameter to 2048m as mentioned below in script.
Configure the Output Post Processor's JVM. These steps set the JVM to 2GB, depending upon
your server's size you might find 3 GB (-mx3072m), 4GB (-mx4096m) or even 5GB (-mx5120m) is a better value. This setting prevents the error ""java.lang.OutOfMemoryError: Java heap space""
in the Output Post Processor's log associated to the Subledger Accounting Program.
Login to SQL*Plus as APPS.
SQL>update FND_CP_SERVICES set DEVELOPER_PARAMETERS =
'J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx2048m'
where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES
where CONCURRENT_QUEUE_NAME = 'FNDCPOPP');
Bounce the concurrent managers.

one more eg:
To determine current heap size:
select DEVELOPER_PARAMETERS
from FND_CP_SERVICES
where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES where CONCURRENT_QUEUE_NAME = 'FNDCPOPP');

To increase heap size to 1024:
update FND_CP_SERVICES
set DEVELOPER_PARAMETERS = 'J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx1024m'
where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES where CONCURRENT_QUEUE_NAME = 'FNDCPOPP');


Query to find pending concurrent requests

select count(*)
from APPS.FND_ 2 CONCURRENT_PROGRAMS_VL a,
APPS.FND_CONCURRENT_REQUESTS b
where a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_ID
and a.APPLICATION_ID = b.PROGRAM_APPLICATION_ID
and b.PHASE_CODE = 'P'
and b.requested_start_date <= sysdate

Pending job details
"SELECT c.user_name, request_id, phase_code, status_code, hold_flag,
TO_CHAR(requested_start_date,'DD-MON-YY:HH24:MM:SS') Requested_Start_Date,
user_concurrent_program_name, b.concurrent_program_id
FROM applsys.fnd_concurrent_requests a,
applsys.fnd_concurrent_programs_tl b,
applsys.fnd_user c
WHERE a.phase_code = 'P'
AND a.concurrent_program_id = b.concurrent_program_id
AND b.LANGUAGE = 'US'
AND c.user_id = a.requested_by
ORDER BY user_concurrent_program_name;"


Cancel scheduled concurrent Request “Gather Schema Statistics” sqlplus apps/apps
sql>
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P'
AND status_code in ('Q','I') and concurrent_program_id=38121;
Commit;
Exit


Putting all concurrent jobs on hold:
Update applsys.fnd_concurrent_requests set hold_flag='Y' where phase_code in ('R','P','I');

Cancel scheduled concurrent Request “Gather Schema Statistics”
sqlplus apps/apps
sql>
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P'
AND status_code in ('Q','I') and concurrent_program_id=38121;
Commit;
Exit

To terminate request from backend
SQL> select REQUEST_ID,ORACLE_ID,ORACLE_PROCESS_ID,ORACLE_SESSION_ID,OS_PROCESS_ID from applsys.FND_CONCURRENT_REQUESTS where REQUEST_ID=577945;

REQUEST_ID ORACLE_ID ORACLE_PROCESS_ID ORACLE_SESSION_ID
---------- ---------- ------------------------------ -----------------
OS_PROCESS_ID
------------------------------------------------------------------------------------------------------------------------------------
577945 900 13348 1242142
13299

SQL> !kill -9 13348
/bin/ksh: kill: 13348: No such process

SQL> update APPLSYS.fnd_Concurrent_requests set PHASE_CODE='C', STATUS_CODE='D' where REQUEST_ID=577945;

1 row updated.

SQL> commit;

Commit complete.

Schedule “Purge Concurrent Request and/or Manager Data”
Cancel existing scheduled request before scheduling new.
# ebappsenv
# sqlplus apps
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P'
AND status_code in ('Q','I')
and concurrent_program_id=32263;

Parameter:
Entity : REQUEST
Mode : Age
Mode Value : 15  On non-prod environments as per case# 734780

Schedule:
on specific days : Wednesday and Saturday at 19:00 CET


Run Gather Schema Statistics as a Concurrent request
Cancel any pending jobs for “Gather Schema Statistics”
Sqlplus apps/appspasswd
Sql>
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P'
AND status_code in ('Q','I') and concurrent_program_id=38121;

Login to Oracle applications of target instance as sysadmin thru Appjump
Select system administrator Responisibility
Verify whether Concurrent Request “Gather Schema Statistics” is running or not
If not running, schedule the request to run immediately with Parameters : ALL,10


To check status fo running requests:

column REQUEST heading 'Request' format a8
column PHASE heading 'Phase' format A8
column STATUS heading 'Status' format A8
column PROGRAM heading 'Program Name' format A40
column SHORT heading 'Short Name' format A15
column REQUESTOR heading 'Requestor' format A10
column START_TIME heading 'Start Time' format A15
column RUN_TIME justify left heading 'Time(m)' format 999999.9
column OSPID heading 'OSPID' format a5
column OS_PIDa heading 'OSPIDA' format a6
column SID heading 'SID' format 99999
column serial# heading 'Serial#' format 99999

select substr(fcrv.request_id,1,8)REQUEST,
decode(fcrv.phase_code,'P','Pending','R','Running','I','Inactive','Completed')PHASE,
decode(fcrv.status_code,
'A','Waiting',
'B','Resuming',
'C','Normal',
'F','Scheduled',
'G','Warning',
'H','On Hold',
'I','Normal',
'M','No Manager',
'Q','Standby',
'R','Normal',
'S','Suspended',
'T','Terminating',
'U','Disabled',
'W','Paused',
'X','Terminated',
'Z','Waiting',fcrv.status_code)STATUS,
substr(fcrv.program,1,40)PROGRAM,substr(fcrv.PROGRAM_SHORT_NAME,1,15)SHORT,
substr(fcrv.requestor,1,15)REQUESTOR,
-- to_char(fcrv.actual_start_date,'MM/DD/RR HH24:MI')START_TIME,
round(((sysdate - fcrv.actual_start_date)*1440),1)RUN_TIME,
substr(fcr.oracle_process_id,1,7)OSPID,s.sid,s.serial#
from apps.fnd_conc_req_summary_v fcrv,
apps.fnd_concurrent_requests fcr,
v$session s,v$process p
where fcrv.phase_code = 'R'
and fcrv.request_id = fcr.request_id
and s.paddr = p.addr
and fcr.oracle_process_id = p.spid
and fcrv.concurrent_program_id not in ('40112','40113','36887')
--and trunc(fcrv.actual_start_date) like trunc(sysdate)
order by PHASE, STATUS, REQUEST desc;

Take export dump of concurrent tables and import

exp userid=applsys/xxxx file=conc.dmp log=exp.log tables=FND_CONCURRENT_QUEUES,FND_CONCURRENT_QUEUES_TL,
FND_CONCURRENT_QUEUE_SIZE, FND_CONCURRENT_QUEUE_CONTENT

Truncate the fnd concurrent tables

SQL> truncate table fnd_Concurrent_queues;

Table truncated.

SQL> truncate table FND_CONCURRENT_QUEUES_TL;

Table truncated.

SQL> truncate table FND_CONCURRENT_QUEUE_SIZE;

Table truncated.

SQL> truncate table FND_CONCURRENT_QUEUE_CONTENT;

Table truncated.
Import the data back into the fnd tables which was exported as part of step above

imp userid=applsys/apps ignore=y file=conc.dmp full=y log=imp.log


Check whether the GSM is Up and Running in the system --> Profile option or using the Following Query :
select DECODE(b.profile_option_value, 'Y', 'Enabled', 'Disabled') DETAILS
from fnd_profile_options a, fnd_profile_option_values b
where a.APPLICATION_ID = b.APPLICATION_ID
and a.PROFILE_OPTION_ID = b.PROFILE_OPTION_ID
and a.PROFILE_OPTION_NAME = 'CONC_GSM_ENABLED';


Check whether the Service Manager is up and Running by the following Query :
select CONCURRENT_QUEUE_NAME, ENABLED_FLAG, MAX_PROCESSES, RUNNING_PROCESSES
from FND_CONCURRENT_QUEUES
where CONCURRENT_QUEUE_NAME like 'FNDSM%';

The following SQL scripts located under $FND_TOP/sql are useful when diagnosing concurrent manager problems:

afimchk.sql Tells the status of the ICM and PMON method

afcmstat.sql Lists active manager processes

afrqrun.sql Lists all the running, waiting and Terminating requests

afrqwait.sql Lists requests that are constrained and waiting for the ICM to release them.

afrqscm.sql Prints log file name of managers that can run a given request. It can be used to check for possible errors when a request stays in pending status. It requires a request id value.

afcmcreq.sql Prints the log file name of the manager that processed the request

afrqstat.sql Summary of completed concurrent requests grouped by completion status and execution type. It requires number of days prior to today on which to report parameter.

afimlock.sql Lists locks that the ICM is waiting to get

afcmrrq.sql Lists managers that currently are running a request


Reports on requests that having been running for over a specified amount of time (hard coded as 4 hours). Exceptions, in addition to the defaults below, can be added by entering the program ID for the program exceptions under multi-items.

Runs Every 20 minutes

Uses the following query:
select b.REQUEST_ID, a.DESCRIPTION, b.phase_code,
(sysdate - b.actual_start_date) * 24 "running",
to_char(sysdate, 'mm/dd/yyyy hh:mi') "now",
to_char(b.request_date, 'mm/dd/yyyy hh:mi') "request_date",
to_char(b.actual_start_date, 'mm/dd/yyyy hh:mi') "start_time",
b.program_application_id "program_application_id",
b.concurrent_program_id "concurrent_program_id"
from APPS.FND_CONCURRENT_PROGRAMS_VL a,
APPS.FND_CONCURRENT_REQUESTS b
where a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_ID
and a.APPLICATION_ID = b.PROGRAM_APPLICATION_ID
and b.STATUS_CODE = 'R'
and b.PHASE_CODE = 'R'
and ((sysdate - b.actual_start_date) * 24) > 4
and a.CONCURRENT_PROGRAM_ID NOT IN(36887,43393,38121,42789,31556)

Excludes:
36887 - Workflow Mailer
43393 - ITM Adapter
38121 - Gather Schema Statistics
42789 - OAM Applications Dashboard Collection
31556 - Planning Manager

Monitors pending jobs exceeds the specified threshold. Excessive pending jobs may indicate an issue with the Concurrent Manager. Uses the following query:

select a.concurrent_program_name, b.REQUEST_ID, a.description,
to_char(b.request_date, 'mm/dd/yyyy hh:mi:ss') ""request_date"",
to_char(b.requested_start_date, 'mm/dd/yyyy hh:mi:ss') ""request_start""
from APPS.FND_CONCURRENT_PROGRAMS_VL a,
APPS.FND_CONCURRENT_REQUESTS b
where a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_ID
and a.APPLICATION_ID = b.PROGRAM_APPLICATION_ID
and b.PHASE_CODE = 'P'
and b.requested_start_date <= sysdate


The error threshold monitor will alert if the number of failed jobs exceeds the user defined threshold in a 30 minute period.

select a.concurrent_program_name, b.REQUEST_ID, a.description,
b.status_code, b.phase_code
from APPS.FND_CONCURRENT_PROGRAMS_VL a,
APPS.FND_CONCURRENT_REQUESTS b
where a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_ID
and a.APPLICATION_ID = b.PROGRAM_APPLICATION_ID
and b.STATUS_CODE IN ('E')
and b.actual_completion_date > sysdate - 1/48


Find request which are put on hold
SQL> select REQUEST_ID from fnd_concurrent_requests where phase_code ='P' and hold_flag='Y';


To find oracle_process id for a request id to pull trace file from udump:

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'


To find spid of a request to get the trace file
prompt accept request prompt 'Please enter the concurrent request id for the appropriate concurrent program:
prompt

column traceid format a8
column tracename format a80
column user_concurrent_program_name format a40
column execname format a15
column enable_trace format a12
set lines 80
set pages 22
set head off

SELECT 'Request id: '||request_id ,'Trace id: '||oracle_Process_id, 'Trace Flag: '||req.enable_trace,
'Trace Name:'||dest.value||'/'||lower(dbnm.value)||'_ora_'||oracle_process_id||'.trc', 'Prog. Name: '||prog.user_concurrent_program_name,'File Name: '||execname.execution_file_name|| execname.subroutine_name ,
'Status : '||decode(phase_code,'R','Running') ||'-'||decode(status_code,'R','Normal'),'SID Serial: '||ses.sid||','|| ses.serial#,'Module : '||ses.module
from fnd_concurrent_requests req, v$session ses, v$process proc,
v$parameter dest, v$parameter dbnm, fnd_concurrent_programs_vl prog,
fnd_executables execname
where req.request_id ='&request'
and req.oracle_process_id=proc.spid(+)
and proc.addr = ses.paddr(+)
and dest.name='user_dump_dest'
and dbnm.name='db_name'
and req.concurrent_program_id = prog.concurrent_program_id
and req.program_application_id = prog.application_id
and prog.application_id = execname.application_id
and prog.executable_id=execname.executable_id


To check failed jobs submitted by an user
set lines 1000 pages 100
clear columns
col "Submitted By" format a15 word_wrap
select user_name "Submitted By", request_id "Request #",
to_char(cr.request_date,'dd-mon-rr hh24:mi') "Submitted on",
to_char(cr.last_update_date,'dd-mon-rr hh24:mi') "Failed on"
from applsys.fnd_concurrent_requests cr,
applsys.fnd_user u
where u.user_id = cr.requested_by
and user_name like '%BATCH%'
and cr.status_code ='E'
and cr.phase_code ='C'
and cr.request_date > sysdate - 1
order by 1

Statement to put the jobs on hold and release them lateron
To hold the requests (as apps user):
1) Drop table apps.str_dba_conc_req_hold ;
2) Create table apps.str_dba_conc_req_hold as select * from fnd_Concurrent_requests where PHASE_CODE='P' and hold_flag='N';
3) select count(*) from apps.str_dba_conc_req_hold ;
4) update fnd_Concurrent_requests set hold_flag='Y' where PHASE_CODE='P' and hold_flag='N' and request_id in (select request_id from apps.str_dba_conc_req_hold) ;

NOTE: You have to commit if select & update are same number of records. Otherwise rollback and try again till the numbers are same

5) Commit;

To Release these requests in prod after patching, here is the step :

6) a. update fnd_Concurrent_requests set hold_flag='N' where request_id in (select request_id from apps.str_dba_conc_req_hold);
b. commit;


How to take cm program trace.

Responsibility: System Administrator
Navigate: Concurrent > Program > Define
Query Concurrent Program
Select the Enable Trace Checkbox

Responsibility: System Administrator
Navigate: Profiles > System
Query Profile Option Concurrent: Allow Debugging
Set profile to Yes

Logon to the Responsibility that runs the Concurrent Program
In the Submit Request Screen click on Debug Options (B)
Select the Checkbox for SQL Trace


To submit active user request from backend
CONCSUB APPS/APPS SYSADMIN "System Administrator" SYSADMIN CONCURRENT FND FNDSCURS PROGRAM_NAME='"Active Users"'

sql program to submit request from backend
"SET SERVEROUTPUT ON
declare
req_id number;
begin
DBMS_OUTPUT.PUT_LINE('In begin');
fnd_global.APPS_INITIALIZE (0, 21758, 671);
req_id := FND_REQUEST.SUBMIT_REQUEST(application => 'FND',program => 'FNDSCURS',description => '',start_time =>
'',sub_request => FALSE);

if (req_id = 0) then
/* Handle submission error */
DBMS_OUTPUT.PUT_LINE('Request ID :' || req_id);
DBMS_OUTPUT.PUT_LINE('As the request ID is 0, the request was not submitted');
DBMS_OUTPUT.PUT_LINE('Please verify this part again');
else
DBMS_OUTPUT.PUT_LINE('Request ID :' || req_id);
DBMS_OUTPUT.PUT_LINE('Request submitted successfully');
commit;
end if;
end;
/

Meaning of status_code and phase_code in FND_CONCURRENT_REQUESTS table STATUS_CODE Column:

A - Waiting
B - Resuming
C - Normal
D - Cancelled
E - Error
F - Scheduled
G - Warning
H - On Hold
I - Normal
M - No Manager
Q - Standby
R - Normal
S - Suspended
T - Terminating
U - Disabled
W - Paused
X - Terminated
Z - Waiting


PHASE_CODE column

C - Completed
I - Inactive
P - Pending
R - Running

Thursday, August 12, 2010

CLONE related scripts

Remove the end date of responsibilities for users with below script

declare
v_resp_id number;
v_resp_app_id number;
x boolean;
begin
for c1rec in (select * from fnd_user where creation_date > '13-JUL-09'
and sysdate between start_date and nvl(end_date,sysdate+1)
)
LOOP
for c2rec in (
SELECT responsibility_id,responsibility_application_id
--into v_resp_id,v_resp_app_id
FROM FND_USER_RESP_GROUPS_DIRECT where user_id=c1rec.user_id)
LOOP
fnd_user_resp_groups_api.update_assignment(
c1rec.user_id,
c2rec.responsibility_id,
c2rec.responsibility_application_id,
0,
sysdate-1,
null,
null);
end loop;
end loop;
end;
/


Backup reponsibilities of users and restore them back

cd /home/applvis/REFRESH_FILES_

exec dbms_output.enable(1000000);
set serverout on;
spool restore_resp_assignment.sql
DECLARE
v_resp_id number;
v_resp_app_id number;
x boolean;
BEGIN
FOR c1rec IN (SELECT user_id
FROM fnd_user
WHERE creation_date > sysdate-360
AND sysdate BETWEEN start_date
AND nvl(end_date,sysdate+1)
)
LOOP
FOR c2rec IN (SELECT responsibility_id,responsibility_application_id
FROM fnd_user_resp_groups_direct WHERE user_id=c1rec.user_id)
LOOP
dbms_output.put_line('fnd_user_resp_groups_api.insert_assignment('||c1rec.user_id||','
||c2rec.responsibility_id||','
||c2rec.responsibility_application_id||','
||0||','
||'sysdate-1,'
||'null,'
||'null);');
END LOOP;
END LOOP;
END;
/


Restore responsibilities with below script

cd /home/applvis/REFRESH_FILES_

@restore_resp_assignment.sql



Place Pending/(Normal/Standby) to On Hold

sqlplus apps
create table fnd_concurrent_requests_backup as select * from fnd_concurrent_requests;
UPDATE fnd_concurrent_requests
SET hold_flag = 'Y'
WHERE phase_code = 'P'
AND status_code in ('Q','I');
Commit;

SQL> update applsys.fnd_concurrent_requests
set hold_flag='Y' where phase_code='P' and hold_flag='N';


How to Correct Session Cookie Name.

a)select session_cookie_name from icx_parameters;

b)update icx_parameters set session_cookie_name = ‘’;

c)select session_cookie_name from icx_parameters;

Set the databases global name
The new database will still have the source databases global name. Run the following to reset it:
alter database rename global_name to
/
Alter database rename global_name to VIS.ABC.COM;


Controlfile backup
alter database backup controlfile to trace as '/home/oracle/cr_.sql'


backup users and their privileges on target database
$ sqlplus “/ as sysdba”
SQL> spool users.lst
SQL> select 'create user '||username||
' identified by values '''||password||
''' default tablespace '||default_tablespace||
' temporary tablespace '|| temporary_tablespace||';'
from dba_users
where username not in ('SYS','SYSTEM','OUTLN','DBSNMP');

SQL> select 'grant '||GRANTED_ROLE||' to '||GRANTEE||';'
from dba_role_privs
where grantee not in ('SYS','SYSTEM','OUTLN','DBSNMP');

SQL> select 'grant '||PRIVILEGE||' to '||GRANTEE||';'
from dba_sys_privs
where grantee not in ('SYS','SYSTEM','OUTLN','DBSNMP');
SQL> spool off
SQL> exit;
select 'drop user '||username||' cascade;' from dba_users where username not in ('SYS','SYSTEM','OUTLN','DBSNMP');

Verify No Profiles Pointing to PROD servers by running SQL below:set linesize 200
col profile_option_name format a40
col profile_option_value format a120
select pov.level_id,po.profile_option_name, pov.profile_option_ID
from applsys.FND_PROFILE_OPTION_VALUES pov, applsys.fnd_user fusr,
and level_id in ('10001', '10002', '10003','10007')
and pov.profile_option_id = po.profile_option_id;

Make sure nothing is pointing to SOURCE instance used for SNAP taking (sid, machine name and port).
select distinct V.PROFILE_OPTION_value
from fnd_profile_options o,
fnd_profile_option_values v
where o.application_id = v.application_id
and o.profile_option_id = v.profile_option_id
and lower (v.profile_option_value) like '%prod%';

Checking profile option values if they are pointing to source
(During cloning only site level profile options are updated to target instance).
SQL> select PO.PROFILE_OPTION_NAME,PV.PROFILE_OPTION_VALUE, PV.LEVEL_ID
from fnd_profile_option_values pv, fnd_profile_options po
where upper(PROFILE_OPTION_VALUE) like ‘%&enter_source_in_UPPERCASE%’
and pv.PROFILE_OPTION_ID=po.PROFILE_OPTION_ID;

In above query level_id represents following level
10001 - SITE
10002 - APP
10003 - RESP
10004 - USER
10005 - SERVER
10006 - ORG
10007 - ServerResponsibility


update profile options if any pointing to Source Instance
sqlplus apps/
column PROFILE_OPTION_VALUE format a80
select PROFILE_OPTION_ID,profile_option_value from fnd_profile_option_values
where profile_option_value like '%&VALUE%'
order by profile_option_value

Check for below values
source server names
source sid
source web port

Update profile options using below dml if any pointing to Source Instance.

update fnd_profile_option_values
set PROFILE_OPTION_value= '&NEW'
where PROFILE_OPTION_value = '&OLD';"

other way:
column start_value format a75
column target_value format a85
set lines 200

select profile_option_value Source_Value,
replace(replace(replace(replace(profile_option_value,'src_server','trg_server'),'PROD','PATCH'),
'/d01/applmgr/prodcomn','/d01/applptch/ptchcomn'),'/d02/oracle/proddb','/d02/oraptch/ptchdb') target_value
from fnd_profile_option_values
where profile_option_value like '%src_server%';

if you feel that the target values are correct then run the below update statement.

update fnd_profile_option_values
set profile_option_value=
replace(replace(replace(replace(profile_option_value,'src_server','trg_server'),'PROD','PATCH'),'/d01/applmgr/prodcomn','/d01/applptch/ptchcomn'),'/d02/oracle/proddb','/d02/oraptch/ptchdb')
where profile_option_value like '%src_server%';
commit;

select profile_option_value Source_Value,
replace(replace(replace(profile_option_value,'src_server','trg_server'),'PROD','PATCH'),'8000','8003') target_value
from fnd_profile_option_values
where profile_option_value like '%src_server%';

If you feel that the target values are correct then run the below update statement.

update fnd_profile_option_values
set profile_option_value=
replace(replace(replace(profile_option_value,'src_server','trg_server'),'PROD','PATCH'),'8000','8003')
where profile_option_value like '%src_server%';

update fnd_profile_option_values
set profile_option_value= null
where profile_option_value like '%ebusiness%';

Changing value for Workflow Administrator
Click on Workflow Administrator from the Navigator.
Administrator Workflow -> Administration ->
Change the value for Workflow System Administrator from “Sysadministrator” to “ Workflow Administrator”

After executing autoconfig make sure Workflow System Administrator is NOT set to SYSADMIN . Please set this to ""Workflow Administrator Web (New)""
Following script will take care of this ."
"sqlplus apps/""pwd""
SQL> update wf_resources set text = 'FND_RESP|FND|FNDWF_ADMIN_WEB_NEW|STANDARD' where name = 'WF_ADMIN_ROLE';

1 row updated.

SQL> commit;

Commit complete.

Update alerts and notifications after clone
update alr_alerts set end_date_active = sysdate -1;
update alr_alerts set enabled_flag ='N';
update wf_notifications set mail_status ='SENT' where mail_status ='MAIL';
update wf_notifications set status ='CLOSED';

After disabling alerts o/p should be
SQL> Select distinct enabled_flag from alr_alerts;
E
-
N

Update concurrent requests after clone
create table applsys.fnd_concurrent_requests_bak as
select * from applsys.fnd_concurrent_requests
where concurrent_program_id in
(select concurrent_program_id from fnd_concurrent_programs_tl
where user_concurrent_program_name
in ('Purge Concurrent Request and/or Manager Data','Purge Signon Audit data',
'Purge Obsolete Workflow Runtime Data',
'Workflow Background Process','Gather Schema Statistics'))
and
phase_code != 'C' and
status_code != 'C';

select count(*) from applsys.fnd_concurrent_requests_bak;
create table applsys.fnd_concurrent_requests_ORIG as select * from applsys.fnd_concurrent_requests ;
truncate table applsys.fnd_concurrent_requests ;
insert into applsys.fnd_concurrent_requests select * from applsys.fnd_concurrent_requests_bak;

commit;

UPDATE applsys.fnd_concurrent_requests
SET phase_code = 'C', status_code = 'X'
WHERE phase_code = 'R' and status_code ='R';
commit;

Cancel scheduled concurrent Request “Gather Schema Statistics”
sqlplus apps/apps
sql>
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P'
AND status_code in ('Q','I') and concurrent_program_id=38121;
Commit;


Purge the concurrent requests with some user submitted exceptions
Cancel all scheduled and pending concurrent requests with the following user exceptions. OMAMUS, OMAME, WFMGR, INVMGR

sqlplus connect apps/apps
create table fnd_concurrent_requests_bak_1 as select * from fnd_concurrent_requests where concurrent_program_id in (select concurrent_program_id from fnd_concurrent_programs_tl where user_concurrent_program_name
in ('Purge Concurrent Request and/or Manager Data','Purge Signon Audit data', 'Purge Obsolete Workflow Runtime Data','Workflow Background Process')) and phase_code!='C' and status_code!='C';

create table fnd_concurrent_requests_bak_2 as select * from fnd_concurrent_requests where
phase_code ='P' and status_code='I' and requested_by in (select user_id from fnd_user where user_name in ('OMAMUS','OMAME','WFMGR','INVMGR'));

- select count(*) from fnd_concurrent_requests_bak_2;
- select count(*) from fnd_concurrent_requests_bak_1;

connect applsys/apps
- truncate table fnd_concurrent_requests;

connect applsys/apps
- insert into fnd_concurrent_requests select * from fnd_concurrent_requests_bak_2;
- commit;
- select count(*) from fnd_concurrent_requests;

- drop table fnd_concurrent_requests_bak_2; & drop table fnd_concurrent_requests_bak_1;


None of the profiles should point to /tmp, /usr/tmp, /var/tmp etc. Query to check.
set head off
column PROFILE_OPTION_NAME format a30
column PROFILE_OPTION_VALUE format a40
select a.PROFILE_OPTION_ID,a.profile_option_name,PROFILE_OPTION_VALUE
from applsys.fnd_profile_option_values b , fnd_profile_options a
where a.PROFILE_OPTION_ID=b.PROFILE_OPTION_ID
and b.PROFILE_OPTION_VALUE like '%tmp%'

Backup the database links for the TARGET instance. , EXP /IMP
login as oratrn
Su – oratrn

Export the db links
$ exp file=link.dmp tables='sys.link$'

Export: Release 10.2.0.3.0 - Production on Tue May 6 19:56:03 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Username: / as sysdba

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
Export done in UTF8 character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...
. . exporting table LINK$ 6 rows exported
Export terminated successfully without warnings.


$ imp file=/refresh_files_June2008/link.dmp full=y ignore=y

Import: Release 10.2.0.3.0 - Production on Tue Jun 3 09:06:35 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Username: / as sysdba

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path
import done in UTF8 character set and AL16UTF16 NCHAR character set
. importing SYS's objects into SYS
. importing SYS's objects into SYS
. . importing table "LINK$" 6 rows imported
Import terminated successfully without warnings.


To put an end date to a resposibility
update fnd_responsibility a
set a.end_date = sysdate
where a.responsibility_id =
(select t.responsibility_id
from fnd_responsibility_tl t
where t.responsibility_name = 'VIS Legacy MIS');

Clearing node information in fnd_nodes
exec fnd_conc_clone.setup_clean as apps user will delete all node information then run autoconfig to create node information in fnd_nodes;


To drop redo-logfile group
The database shuold be in Mounted state.
Select group#,status from v$log;
Alter database drop logfile group num ; (the group # which is Inactive-status);
In case of RAC :alter database disable thread 2;

To get front end url
select home_url from icx_parameters;

To check Guest user and password
SELECT fnd_web_sec.validate_login('GUEST','ORACLE') from dual;

Changing the SITENAME
sqlplus apps/
update fnd_profile_option_values set PROFILE_OPTION_VALUE= ‘VIS clone from PROD on ’ where PROFILE_OPTION_ID='125';


"Update of Logfiles Names and Nodenames
update fnd_concurrent_queues set node_name='VCOSXAOR0P' where node_name is not null and node_name in ('VMDSXAAH1I','VMDSXAAH1M','VMDSXAAH1L');

The following script will show the logfiles names and node names
select LOGFILE_NAME, LOGFILE_NODE_NAME, OUTFILE_NAME, OUTFILE_NODE_NAME from fnd_concurrent_requests;

The following script will update the logfiles names and node names
update fnd_concurrent_requests set logfile_name='/d01/oravis/viscomn/admin/log/VIS_hostanme/'||substr(logfile_name,48),
LOGFILE_NODE_NAME='hostname',
OUTFILE_NAME='/d01/oravis/viscomn/admin/log/VIS_hostname/'||substr(outfile_name,48),
OUTFILE_NODE_NAME='hostname';

Commit;


Pre-clone merge commands
For Multi-Tier clone, run the following command on each node:

cd /admin/scripts/
perl adpreclone.pl appsTier

For Single-tier clone,
On Admin Node
cd /admin/scripts/
perl adpreclone.pl appsTier merge

On Forms Node,
cd /admin/scripts/
perl adpreclone.pl appltop merge

Copy the required files for merging from source snap:
directory /clone/appl/*
- to -
directory /clone/appl on target Node


Copy following directories from source snap:
<806 ORACLE_HOME>

Copy XXDHM_TOP/forms

Also copy au_top/forms amd au_top/resource from source web node to target node


Steps for multi to single node clone

Copy following directories from admin snap:
•
•
•
• /util
• /clone
• /_pages (if exists)

Copy following directories from web snap:
• <806 ORACLE_HOME>
•
• Copy XXDHM_TOP/forms from web snap

Copy the required files for merging from web snap
directory /clone/appl/*
- to -
directory /clone/appl on target Node

NOTE: Please make sure to copy all the directories under /clone/appl from the web snap

Log in to the Target node as the APPLMGR user and execute the following commands:
$ cd /clone/bin
$ perl adcfgclone.pl appsTier

Finishing tasks
• Check the xml file and set the login_page parameter (if it is not set already) as follows and Run AutoConfig (if changing the value):

http://server.domain:port/oa_servlets/AppsLogin

• Log in to the target system application tier node as the APPLMGR user and run the following tasks in adadmin for all products:
o generate JAR files
o generate message files
o relink executables
o copy files to destination

• Run adadmin to verify files required at runtime. If any files are listed as missing files, you must manually copy them to the merged APPL_TOP.

• Remove the temporary directory /clone/appl to reduce disk space usage.
• Follow the post-clone steps



Following are the steps for implementing shared appl_top

Have sysadmin team rename the existing /d01 on hostname2 to /d01-old and mount the /d01 of hostname1 on to hostname2.

clone context on hostname2

cd $AD_TOP/bin
perl adclonectx.pl sharedappltop contextfile=/d01/oratst/testappl/admin/PREPROD_hostname1.xml

Note: Enable only web and forms services when the script prompts


Take the bake up of the context file on hostname1 and edit the xml file to disable the forms and web, which are enabled for single node clone.


on hostname1 go to FND_TOP/patch/115/bin and run perl -I $AU_TOP/perl/txkSOHM.pl
On hostname2 go to $FND_TOP/patch/115/bin and run perl -I $AU_TOP/perl/txkSOHM.pl


When the txkSOHM.pl scripts prompts for values, please make a note of below given entries:

On hostname1

Type of Instance [primary/secondary] : primary

Absolute path of config top : /d01/oratst/tstcomn/conf/PREPROD_hostname1



On hostname2

Type of Instance [primary/secondary] : secondary

Absolute path of config top : /d01/oratst/tstcomn/conf/PREPROD_hostname2

one more eg:
Shared file system configuration:

Running Rapid clone on target primary node


perl /d01/appltest/testcomn/clone/bin/adcfgclone.pl appsTier
(Define admin,concurrent,reports on this node)



a) On Primary Node: hostname1 as appltest
(Configure concurrent,admin,reports services on this node).

$ cd /d01/appltest/testappl/fnd/11.5.0/patch/115/bin
$ perl -I /d01/appltest/testappl/au/11.5.0/perl txkSOHM.pl
(Check for any errors before proceed)

For config_top use value: /d01/appltest/testcomn/conf/TEST_hostname1

b) On Secondary Node: hostname2 as appltest
(Configure Forms, Apache and Discoverer on this node).

$cd $AD_TOP/bin
$perl adclonectx.pl sharedappltop contextfile=/d01/appltest/testappl/admin/TEST_hostname1.xml
(Note: Enable only web and forms services when the script prompts)

$ cd /d01/appltest/testappl/fnd/11.5.0/patch/115/bin
$ perl -I /d01/appltest/testappl/au/11.5.0/perl txkSOHM.pl

For config_top use value: /d01/appltest/testcomn/conf/TEST_hostname2

The script prompts for the following information:
Prompt Response Comment
Absolute path of Applications context file /admin/.xml Name of the Applications context file, including the path
Type of Instance Secondary For all additional nodes mounting up a shared file system make sure to use secondary
Absolute path of 8.0.6 shared Oracle home <8.0.6 ORACLE_HOME location> Location of the 8.0.6 Oracle home
Absolute path of iAS shared Oracle home Location of the iAS Oracle home
Absolute path of config top Location in which the iAS and 8.0.6 instance-specific configuration files should be stored. Specify a secure location for these files. For eg: Choose a local directory for storing the configuration files
Oracle Applications APPS schema password


Example:
$ cd /d01/appltest/testappl/fnd/11.5.0/patch/115/bin
$ perl -I /d01/appltest/testappl/au/11.5.0/perl txkSOHM.pl
Absolute path of Application's Context XML file : /d01/appltest/testappl/admin/TEST_hostname2.xml
Type of Instance [primary/secondary] : secondary
Absolute path of 8.0.6 Shared Oracle Home : /d01/appltest/testora/8.0.6
Absolute path of iAS Shared Oracle Home : /d01/appltest/testora/iAS
Absolute path of config top : /d01/appltest/testcomn/conf/TEST_hostname2
Oracle Application apps schema password : ****


This command will also execute autoconfig. Make sure autoconfig completes without any errors. Also, check log file and make sure there are no errors



You can rerun the oui registration with the following script:
/d21/oravis/viscomn/admin/out/VIS_hostname/regOUI_APPSIAS_PTCH.sh
Log file located at /var/opt/oracle/oraInventory/logs/OracleHomeCloner_06150953.log


TO submit GSS
Submit ""Gather Schema Statistics"" Job in Cloned/Target Environment after Clone is completed.

1.Login to the Target Instance Application via the URL as SYSADMIN user
2.System Administrator > Concurrent > Requests > Submit a New Request > Gather Schema Statistics
3.Use parameters ALL, 90, NOBACKUP
4.Make sure the request starts running in RUNNING NORMAL


Ensure that ""Purge concurrent Manager Requests/Data"" is scheduled to run daily with AGE=7 and MODE=ALL and to be informed to client / PM.

Ensure that ""Purge Obsolete Workflow data"" is scheduled to run daily with AGE=7 and WORKFLOW_TYPE=TEMP.

Ensure that ""Purge Signon Audit data"" is scheduled to remove 2 days old data on daily basis. "


How to change Apps 11i form color change after cloning
1. Set the Java Look and Feel profile option value to oracle. If you set it to generic, it will take the default values and you wont be able to set your own color.
2. Then set Java Color Scheme profile option value to any of the LOVs as per your choice."
"It won't get effect immediately, you have to log out from
application and again you have to relogin to view color change effect

To set colour scheme
titanium
Profile Option to change = %Java%Color%Scheme%


TO generate env files for environment using autoconfig without sourceing ens since if envs are not present
Run AutoConfig setup phase on the Target System
Execute the INSTE8_SETUP phase of AutoConfig with the new context file. This will create the environment files required for the AutoPatch session:

cd /bin

./adconfig.sh run=INSTE8_SETUP contextfile=
Note: This command does not require the environment to be sourced
Verifying the environment variables.
Now log out f the environment and re-login and make sure the env variables are all set correctly.

Run AutoConfig setup phase on the target system
Run the script $AD_TOP/bin/autoconfig.sh in the setup mode as follows: $ADTOP/bin/adconfig.sh run=INSTE8_SETUP


Create shared applications tier directories:
ls -l $APPL_TOP/admin/*xml
cd $FND_TOP/patch/115/bin
perl -I $AU_TOP/perl txkSOHM.pl

Clone the AutoConfig XML context file on the Target System
Create the target context file using the script $AD_TOP/bin/adconectx.pl.


For the URL to be prod.lenovo.com the following variables in the context file should be like this
configuration would bring the URL as http://hostname.domainname:8000 but the customer needs the URL to be like http://prod.lenovo.com:8000

So we need to update the following parameter values in the XML file and then autoconfig.
login_page oa_var="s_login_page">http://prod.lenovo.com:8000/oa_servlets/AppsLogin

webentryhost oa_var="s_webentryhost">prod

webentrydomain oa_var="s_webentrydomain">lenovo.com


add responsibility from backend
begin
fnd_user_pkg.addresp(
'&User_Name',
'&Responsablity_Application_Short_Name',
'&Responsibility_Key',
'&Security_Group',
'&Description',
'&Start_Date',
'&End_Date' );
commit;
end;

EX:
exec fnd_user_pkg.addresp('','SYSADMIN','SYSTEM_ADMINISTRATOR','STANDARD','Application Object Library System Adminstrator',SYSDATE,null);


Purge Signon Audit Data
executes $FND_TOP/sql/FNDSCPRG.sql
Check the profile option "Sign-on: Audit level" and make sure it is set to ""Form"". This is required in order to monitor forms sessions.

In case your curious, there are 4 valid values for this profile option: None, User, Reponsibility and Form. As you progress from None to Form additional information is collected and stored.

None - Obvious, nothing is audited.

User - FND_LOGINS table gets updated with one record per user session.

Reponsibility - Same as User, as well, FND_LOGIN_RESPONSIBILITIES will be updated with 1 record for each responsibility used during the session.

Form - Same as user and responsibility, plus FND_LOGIN_RESP_FORMS will be updated with one record for each form selected during the session.

As with any audting, you should determine how long you require the data and purge/archive it.
In order to purge data in the above tables you need to schedule
the concurrent program, ""Purge Signon Audit Data"". This program requires one parameter, Audit Date. All data older than this date will be deleted.

Note: this program deletes data in the above tables as well as FND_UNSUCCESSFUL_LOGINS.

Beware: Enabling auditing does have a slight impact on performance.


Script for hot backup
cr_hot_backup.sql
set lines 999 pages 999
set verify off
set feedback off
set heading off

spool begin_backup.sql

select 'alter tablespace ' || tablespace_name || ' begin backup;' tsbb
from dba_tablespaces
where contents != 'TEMPORARY'
order by tablespace_name
/
spool off

spool end_backup.sql

select 'alter tablespace ' || tablespace_name || ' end backup;' tseb
from dba_tablespaces
where contents != 'TEMPORARY'
order by tablespace_name
/
spool off

Monday, July 27, 2009

Form servlet and socket mode in R12

Oracle Applications Release12 by default configures Forms 10g stack in servlet mode, as this is the preferred and recommended deployment model for forms on the web. In this mode a java servlet called the Forms Listener Servlet manages the communication between the Forms Java Client and the OracleAS Forms Services. The Forms Listener Servlet communicates through the HTTP server port and does not need extra ports to handle the communication between the client and the Oracle Applicaiton Server, Forms Services

Although Forms Servlet is the preferred deployment method, there may be circumstances where customers need to switch from Forms Servlet mode to Forms Socket mode, which allows desktop clients to access the Forms Server directly.

also to reduce network traffic. as said above the servlet mode uses http protocol on each transaction between a client and the Forms Server requiring the exchange of cookies and http headers which increases network traffic.

Listener executable name in 10g AS is frmsrv present in $ORACLE_HOME/bin.


How to check if form service is in servlet or socket mode:

To check if it is in servlet mode use from backend:
$ ./adformsctl.sh status

You are running adformsctl.sh version 120.12.12000000.3

Not starting the Forms OC4J instance as Forms connect mode is set to socket.

adformsctl.sh: exiting with status 1


To check it is servlet from front end do,
Log in to Oracle Applications and launch a Forms-based application.
Open the Sun Java Console (from Tools Menu in Internet Explorer).
Check whether the "mode" directive displayed in Sun Java Console when launching forms-based applications, is set to http,native
Direct Forms Servlet Launch is:
web_protocol>://.:/forms/frmservlet


TO check if it is socket mode from backend:
$ ./adformsrvctl.sh status

You are running adformsrvctl.sh version 120.9.12000000.7

Checking status of FORMS Server (Socket Mode) ...

Forms Server (Socket) is running as PID 8352


adformsrvctl.sh: exiting with status 0

adformsrvctl.sh: check the logfile $ADMIN_LOG_HOME/ora/10.1.2/forms/socket.log for more information ...


To check it is socket from front end do,
Log in to Oracle Applications and launch a Forms-based application.
Open the Sun Java Console (from Tools Menu in Internet Explorer).
Check whether the "mode" directive displayed in Sun Java Console when launching forms-based applications is set to socket.
The direct launch URL for Forms Socket Mode is:
://.:/OA_HTML/frmservlet



Manually Starting/stoping/status of Forms Server in socket mode:


$INST_TOP/admin/scripts/adformsrvctl.sh start
$INST_TOP/admin/scripts/adformsrvctl.sh stop
$INST_TOP/admin/scripts/adformsrvctl.sh status

Step by steps to convert to socket mode:

1.Source the environment on the application tier.

2.Stop all the application tier services:

$INST_TOP/admin/scripts/adstpall.sh

3.Run the following command to enable Forms Socket Mode:

$FND_TOP/bin/txkrun.pl -script=ChangeFormsMode \
[-contextfile=] \
-mode=socket \
[-port=] \
-runautoconfig= \
-appspass=

Parameter Description
-contextfile Full path to application tier context file, using the syntax:
On UNIX:

$INST_TOP/appl/admin/.xml

-mode servlet - to enable Forms Servlet mode. This is the default value.

socket - to enable Forms Socket mode
-port Port number used to run Forms in socket mode. The default port number is 9095.

A port number is not needed if servlet mode is used.

-runautoconfig Specify whether AutoConfig should be run after changing the forms mode. Possible values are:

No - Do not run AutoConfig after enabling Forms servlet/socket mode. This is the recommended value.
Yes - Run AutoConfig after enabling Forms servlet/socket mode.

-appspass Password for the applications user. Required only if -runautoconfig=Yes.


For example, on UNIX:

$FND_TOP/bin/txkrun.pl -script=ChangeFormsMode \
-contextfile=$INST_TOP/appl/admin/mycontext.xml \
-mode=socket \
-port=9095 \
-runautoconfig=No
The script prompts for the parameters if they are not passed as command line arguments.


one more eg:
$FND_TOP/bin/txkrun.pl -script=ChangeFormsMode -contextfile=$INST_TOP/appl/admin/.xml -mode=socket -port=9001
-runautoconfig=Yes -appspass=


Note:If Autoconfig was not automatically executed as part of the preceding step, then run AutoConfig on the application tier:
$INST_TOP/admin/scripts/adautocfg.sh


4.Start all the application tier services:

$INST_TOP/admin/scripts/adstrtal.sh

5.Check whether Forms Server is running:
On UNIX:
$INST_TOP/admin/scripts/adformsrvctl.sh status

Log in to Oracle Applications and launch a Forms-based application.
Open the Sun Java Console (from Tools Menu in Internet Explorer).
Check whether the "mode" directive displayed in Sun Java Console when launching forms-based applications is set to socket.
The direct launch URL for Forms Socket Mode is:
://.:/OA_HTML/frmservlet




------------------------------------------------------------------------------------------------------------------

Step by steps to convert to servlet mode:


Carry out these steps to reenable Forms Servlet mode if Socket Mode is no longer required:

1.Source the environment on the application tier.

2.Stop all the application tier services:

$INST_TOP/admin/scripts/adstpall.sh

3. Run the following script to disable Forms Socket Mode and re-enable Forms Servlet Mode:

$FND_TOP/bin/txkrun.pl -script=ChangeFormsMode \
[-contextfile=] \
[-mode=servlet] \
-runautoconfig= \
-appspass=
Parameter Description
-contextfile Full path to application tier context file, using the syntax:
On UNIX:

$INST_TOP/appl/admin/.xml

-mode servlet - to enable Forms Servlet mode. This is the default value.

socket - to enable Forms Socket mode
-port Port number used to run Forms in socket mode. The default port number is 9095.

A port number is not needed if servlet mode is used.

-runautoconfig Specify whether AutoConfig should be run after changing the forms mode. Possible values are:

No - Do not run AutoConfig after enabling Forms servlet/socket mode. This is the recommended value.

Yes - Run AutoConfig after enabling Forms servlet/socket mode.

-appspass Password for the applications user. Required only if -runautoconfig=Yes.


For example, on UNIX:

$FND_TOP/bin/txkrun.pl -script=ChangeFormsMode \
-contextfile=$INST_TOP/appl/admin/mycontext.xml \
-mode=servlet \
-runautoconfig=No



If Autoconfig was not automatically executed as part of the preceding step, then run AutoConfig on the application tier:
On UNIX:

$INST_TOP/admin/scripts/adautocfg.sh


4.Start all the application tier services:

$INST_TOP/admin/scripts/adstrtal.sh

5.Log in to Oracle Applications and launch a Forms-based application.
Open the Sun Java Console (from Tools Menu in Internet Explorer).
Check whether the "mode" directive displayed in Sun Java Console when launching forms-based applications, is set to http,native

Direct Forms Servlet Launch is:
web_protocol>://.:/forms/frmservlet


Manually Starting Forms Server
On UNIX:

$INST_TOP/admin/scripts/adformsrvctl.sh start
Step 4.2: Manually Stopping Forms Server
On UNIX:

$INST_TOP/admin/scripts/adformsrvctl.sh stop
Step 4.3: Checking Status of Forms Server
On UNIX:

$INST_TOP/admin/scripts/adformsrvctl.sh status



Reference:384241.1

Thursday, July 23, 2009

All information on Gather Stats and more on performance issues

Introduction:

Prior to Release 11i, Oracle Applications have defaulted to use the Rule-Based Optimizer.
Oracle's Applications development team has reviewed SQL statements in 11i to tune them for use by the Cost-Based Optimizer (CBO).
CBO uses statistics to decide the execution of SQL statements.
FND_STATS is a vital part of collecting this data.

CBO stands for Cost Based Optimization. The R11i application was written to
use the CBO. It determines the most efficient way to execute a SQL statement
based on statistical data stored in the data dictionaries. These stored
statistics are used to compute the cost of executing the SQL. The execution
plan with the lowest cost is the one chosen by the optimizer.


References:
419728.1 How To Gather Statistics On Oracle Applications 11.5.10 - Concurrent Process,Temp Tables, Manually
232419.1 How to Troubleshoot Performance Issues
113653.1 OM-PERF: Performance Tuning - Setup
113573.1 OM-PERF: Performance Tuning - FAQ
744143.1 Tuning performance on eBusiness suite
156968.1 --> coe_stats.sql - Automates CBO Stats Gathering using FND_STATS and Table sizes
170647.1 Does Gather Schema Statistics collect statistics for indexes?
427878.1 Which Method To Gather Statistics When On DB 10g
Note 244040.1 - Oracle E-Business Suite Recommended Performance Patches
Note 122371.1 - How to gather statistics for Oracle Applications
Note 116571.1 - Cost Based Optimiser and Applications Release 11i
Note 117363.1 - Analysing 11i Tables for Performance
Note 102334.1 - How to automate ANALYZE TABLE when changes occur on tables
Note 114671.1 - Gathering Statistics for the Cost Based Optimizer
Note 116178.1 - Analyze Command - Compute Statistics vs. Estimate Statistics
Verifying Statistics
============
Note 163208.1 bde_last_analyzed.sql - Verifies CBO Statistics
Automatic Statistic Gathering
====================
Note 377152.1 Best Practices for automatic statistics collection on 10g
Note 465787.1 Managing CBO Stats during an upgrade to 10g or 11g
368252.1 EBPERF FAQ - Collecting Statistics with Oracle Apps 11i
394371.1 adpatch performance is slow
Note 370583.1 - Basic troubleshooting of JVM consuming cpu or too many JDBC connections in Apps 11i
Note 304099.1 - Using J2SE Version 5.0 with Oracle E-Business Suite 11i
Note 401561.1 - Using J2SE Version 6 with Oracle E-Business Suite 11i


The Rule Based Optimizer (RBO) uses a fixed ranking system to determine the
most efficient access method when executing a SQL statement. This method is
not as flexible as CBO; which takes into consideration the data distribution
characteristics of the database. CBO also offers a number of enhancements
which are not available with RBO.


RBO still exists. By default the 11i apps will use CBO. However, by
the use of hints, RBO can still be invoked.

Statistics must be gathered for Application Releases; 10.7, 11.0 and 11i.
Applications 11i must use FND_STATS. Applications 10.7 and 11.0 can use any method


ANALYZE Command - Compute Statistics vs. Estimate Statistics

COMPUTE STATISTICS

When computing statistics, an entire object is scanned to
gather data about the object. This data is used by Oracle
to compute exact statistics about the object. Slight variances
throughout the object are accounted for in these computed
statistics. Because an entire object is scanned to gather
information for computed statistics, the larger the size of
an object, the more work that is required to gather the necessary
information.

ESTIMATE STATISTICS

When estimating statistics, Oracle gathers representative
information from portions of an object. This subset of information
provides reasonable, estimated statistics about the object. The
accuracy of estimated statistics depends upon how representative
the sampling used by Oracle is. Only parts of an object are
scanned to gather information for estimated statistics, so an
object can be analyzed quickly. You can optionally specify the
number or percentage of rows that Oracle should use in making the
estimate.

Should I gather statistics for SYS schema?

- On 8i, never gather stats for the SYS schema, because it is not supported or recommended.
- On 9i, gathering stats for SYS schema is supported, but not necessary.
- On 10g, it is mandatory to collect stats for SYS schema.


How to collect statistics for SYS schema ?

You must have the SYSDBA (or both ANALYZE ANY DICTIONARY and ANALYZE ANY) system privilege to execute this procedure.
execute dbms_stats.gather_schema_stats(''SYS'', method_opt=>''for all columns size 1'', degree=>30,estimate_percent=>100,cascade=>true);

If you are using Database version 10G, you can use the following syntax instead
execute dbms_stats.gather_dictionary_stats ();
this procedure will gather statistics for all system schema's, including SYS and SYSTEM, and other optional schema's, such as CTXSYS and DRSYS.
There are no eBusiness Suite specific guidelines on how often these statistics need to be refreshed.
Normally, you would need to re-gather stats on those objects if there is a significant change in the environment (a lot of DB users created, a lot of new objects created or rebuilt, etc).

How do I collect statistics for fixed objects (V$ views) in 10G databases?

Run the following command during a typical workload
dbms_stats.gather_fixed_objects_stats;
Note: the script $APPL_TOP/admin/adstats.sql requires the Database to be in restricted mode and could be used only when running upgrades. For optimal performance, statistics on fixed objects should be gathered when there is a typical load in the system.
There are no eBusiness Suite specific guidelines on how often these statistics need to be refreshed
Normally, you would need to re-gather stats on fixed objects after upgrades or if the workload changes.
For additional guidelines, refer to
Note 465787.1 Managing CBO Stats during an upgrade to 10g or 11g





Checks:
1.Run the Verify Stats report to confirm that statistics are current.

This report is a utility provided with FND_STATS, and can be run as follows:

SQL> set server output on
SQL> set long 10000
SQL> exec FND_STATS.VERIFY_STATS(OM, OE_ORDER_HEADERS_ALL)

This procedure takes a schema name and/or a list of comma separated
table_names and checks the stats on all these objects and spools out a
report. Some important columns to look at are LAST_ANALYZED and NUM_ROWS.

2. Ensure that the database initialization parameters which affect CBO are set
up correctly.

Run the following script to verify the init.ora parameters are correct:

$FND_TOP/sql/AFCHKCBO.sql

The output of this report shows the customer's current settings vs. the
recommended settings for CBO.

3. When slow performance is encountered check that the profile
options OM: Debug is set to 'No' and OM: Debug Level is 'null'.
If these profile options are set to a value of 'yes' for
OM: Debug or other than NULL for OM: Debug Level, then system
performance maybe adversely affected.


What to do?
If you use Oracle Applications, it is recommended that you run the concurrent programs for gathering statistics

To run concurrent program Gather Schema Statistics:
1. Log on to Oracle Applications with
Responsibility = System Administrator
2. Submit Request Window
Navigate to: List > Request > Run.
3. Enter the appropriate parameters. This can be run for specific
schemas by specifying the schema name or entering 'ALL' to gather
statistics for every schema in the database.
4. Submit the gather schema statistics program.


The following concurrent requests are available in Oracle Applications for gathering statistics:
Gather All Column Statistics
Gather Column Statistics
Gather Schema Statistics
Gather Table Statistics
For Oracle Applications 11i it is recommended to use only the 'Gather Schema Statistics' or the 'Gather Table Statistics'. Rest are not supported, and results in sub-optimal plans.

When you gather statistics for a table or a whole schema, it cascades down and gathers also the statistics for all indexes on each table and all columns for that particular table or schema.

Gather Schema Statistics Concurrent Request calls Gather_Schema_Stats as part of FND_STATS package.

The package specification and package body for FND_STATS are located in
$FND_TOP/admin/sql/ AFSTATSS.pls and AFSTATSB.pls

AFSTATSB.pls:
--------------
FND_STATS.Gather_Schema_Stats calls
FND_STATS.GATHER_TABLE_STATS with cascade = TRUE for each schema calls
DBMS_STATS.GATHER_TABLE_STATS with cascade_true

Cascade option of GATHER_TABLE_STATS:
--------------------------------------
Running procedure DBMS_STATS.GATHER_TABLE_STATS with parameter cascade set to
the non-default value TRUE means that indexes for the table are analyzed.

Using the cascade option is equivalent to running the gather_index_stats
procedure on each of the table's indexes, however, Applications customers are
always recommended to use the Gather Schema Statistics concurrent request
rather than analyze Apps objects manually.


parameters:
· Schemaname
You may enter ALL to analyze every defined App schema.

· Estimate_percent
Percentage of rows to estimate. If left empty it will default to 10%. The valid range is 0-99. A higher percentage will be more accurate, but take longer to run. If the object(s) that you are gathering statistics for do not change often or the object(s) has data entered that is very similiar you may choose a lower number. However, if the data changes frequently a larger number entered for this parameter would be recommended to provide a more accurate representation of your data.

· Degree
Enter the Degree of parallelism. If not entered, it will default to min(cpu_count, parallel_max_servers). Modifying the degree of parallelism on a table can cause the plan to change. Increasing the degree of parallelism is likely to make full table scans appear cheaper and more attractive while reducing it will make Full Table Scans look less attractive.

· Backup Flag
If the value is 'NOBACKUP' then it won't take a backup of the current statistics and should run quicker. If the value is 'BACKUP' then it does an export_table_stats prior to gathering the statistics.

· Restart Request Id
Enter the request id that should be used for recovering gather_schema_stats if this request should fail. You may leave
this parameter null.

· Gather Options
As of 11.5.10, FND_STATS.GATHER_SCHEMA_STATS introduced a new parameter called OPTIONS that, if set to GATHER AUTO, allows FND_STATS to automatically determine the tables for which statistics should be gathered based on the change threshold. The Modifications Threshold can be adjusted by the user by passing a value for modpercent, which by default is equal to 10. GATHER AUTO uses a database feature called Table Monitoring, which needs to be enabled for all the tables. A procedure called ENABLE_SCHEMA_MONITORING has been provided to enable monitoring on all tables for a given schema or all Applications schemas .


Manual Execution
=============
In R11i customers should be using the FND_STATS command.
Do not use the ANALYZE command or DBMS_STATS package directly,
as doing so may cause incomplete statistics to be generated.

Use the following command to gather schema statistics:
exec fnd_stats.gather_schema_statistics('ONT') < For a specific schema >
exec fnd_stats.gather_schema_statistics('ALL') < For all schemas >

Use the following command for gathering statistics on a temporary table
(ie: temporary tablename = TEMP_tmp in schema ABC):
exec fnd_stats.gather_table_stats('ABC','TEMP_tmp');

# sqlplus apps/
SQL> exec fnd_stats.gather_schema_statistics('MRP'); <- One schema
SQL> exec fnd_stats.gather_schema_statistics('ALL'); <- All schemas
SQL> exec fnd_stats.gather_table_stats('MRP','MRP_FORECAST_DATES'); <- One table



Troubleshooting tips:
1.Ensure the initialization parameters for eBusiness suite are set correctly.

It can be checked by using bde_chk_cbo.sq l .Then you verify the result with one of the following two notes :

Note 216205.1 Database Initialization Parameters for Oracle Applications 11i

Note 396009.1 Database Initialization Parameters for Oracle Applications Release 12

2.Make sure Gather Shema Stats is running on periodical basis. It can be checked with bde_last_analyzed.sql (Note 163208.1) which verifies stats by schema and index.


3.For 10g Database users, we recommend to enable ASMM(Automatic shared memory management). This puts Oracle in control of allocating memory within the SGA. The SGA_TARGET parameter sets the amount of memory available to the SGA. This parameter can be altered dynamically up to a maximum of the SGA_MAX_SIZE parameter value. Provided the STATISTICS_LEVEL is set to TYPICAL or ALL and the SGA_TARGET is set to a value other than "0" Oracle will control the memory pools which would otherwise be controlled by the following parameters:

DB_CACHE_SIZE (default block size)
SHARED_POOL_SIZE
LARGE_POOL_SIZE
JAVA_POOL_SIZE


4.If all the above settings are fine, and still you face slow performance, then either AWR or Statspack report is must checking.

-For10g Database users, refer to Note 276103.1 PERFORMANCE TUNING USING 10g ADVISORS AND MANAGEABILITY .
-For 9i Database users, refer to Note 94224.1 Title: FAQ- Statspack Complete Reference

Best practices for tuning performance
Database tier

Refer to Recommended Performance Patches for the Oracle E-Business Suite.
There are several optimizer related patches that need to be applied on top of 10.2.0.(2/3). Refer to Note 244040.1 for an updated list.
Convert to the OATM Tablespace Model for the EBusiness Suite. See Note 404954.1 How to run OATM migration utility.
Applications tier

Deploy with socket mode for internal users: R12: Refer to Note 384241.1.
Enable Forms Dead Client Detection
Value specified in minutes : FORMS_TIMEOUT=10
• Terminates fwebmx processes for dead clients.
• Enable Forms Abnormal Termination Handle
Do not set FORMS_CATCHTERM
Disable Cancel Query
• Cancel Query increases middle-tier CPU as well as DB CPU
• Refer to MetaLink Note 138159.1 on how to enable and tune Cancel query related parameters
• To Disable Cancel Query : Set the Profile “FND: Enable Cancel Query” to ‘No’
For tuning JVM/OC4J Refer to Note 362851.1:Guidelines to setup the JVM in Apps 11i
Use one JVM per 2 CPUs
• No more than one JVM/CPU
• No more than 100 concurrent users per JVM



Tracing The Performance of a Process:
1. Navigate to SQLPLUS.
2. At the SQL prompt, type the following:

SQL> alter system set timed_statistics = true;

Whenever troubleshooting an application performance problem, it is a good idea
to collect timed_statistics to determine which piece of code is taking the
longest amount of time to execute. Before running a trace, make sure that
timed_statistics is turned on at the database level. This will in no way affect
performance for the users that are currently using the database.

1. Form Trace:
To turn
trace on at the form level, go to the toolbar and navigate to
HELP -> TOOLS -> TRACE. By clicking on the word trace, a checkmark will appear
next to it, indicating that trace has been turned on. Reproduce the problem.
Navigate to HELP -> TOOLS -> TRACE, and click on the word trace to uncheck
trace and turn it off.

2.SQL Trace
Some applications now have profiles that allow you to turn trace
on within the application. These profiles are usually updateable at
the user level and can be turned on just for the user who is trying
to trace a process. By turning trace on with the use of one of these
profile options, you are effectively doing the same thing as setting
SQL_TRACE=TRUE in the init.ora, but you DO NOT have to bounce the
database. See the below list of current Trace Profile Options:

AX: Trace Mode
Debug: Trace Level for Danish
INV: Debug Trace
MRP: Trace Mode
OE: Debug Trace
Utilities: SQL Trace

If you do not have the luxury of a profile option to turn SQL trace
on, you can also turn trace on by typing the following at the SQL
prompt:

SQL> alter session set sql_trace = true;

After setting SQL Trace to true, run the process and then turn off trace
when you are done:

SQL> alter session set sql_trace = false;

3.tkprof:

tkprof sys=no explain=apps/
sort='(prsela,exeela,fchela)'

The above mentioned command sorts the SQL by placing the worst performing
SQL statement at the top of the output file

Upgrade compatibility

To answer to questions while planning for upgrade such as

My current DB and Apps versions are so and so, I need to upgrade DB and Apps to so and so latest versions,
So is direct upgrade possible?
How should I split the upgrade process ?
I want only DB upgrade, will it be compatible with my Current apps version ?
I want only Apps upgrade, will it be compatible with my current DB version ?


Read below to get an answer:

oracle database upgrade guide at http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14238/preup.htm#i1007718
–362203.1 Oracle Applications Release 11i with Oracle 10g Release 2
–216205.1 Database Initialization Parameters for Oracle Applications 11i


10G upgrade :

Base release of 10gR2 is 10.2.0.1 so first you have to Install 10.2.0.1 & then apply patchset 10.2.0.2 which is certified to work with Apps 11i (11.5.9 & 11.5.10)

–You can download 10.2.0.1 software from http://www.oracle.com/technology/software/products/database/oracle10g/index.html
You need companion CD as well so download companion CD as well from above location.
–10.2.0.2 is available as patch 4547817 which you can download from http://metalink.oracle.com or updates.oracle.com


You can upgrade directly to 10.2.0.1 from following database version
8.1.7.4 , 9.2.0.4 or higher, 10.1.0.2 or higher


Database upgrade is Two Step process:

1.upgrade software from 8i, 9i or 10.1 to 10.2
Install companion CD separately ( Ultra Search )
apply patcheset 10.2.0.2 check ReadMe of patch 4547817 via OUI


2.Upgrade database Metadata ( via executing sql’s or dbua )

Complete Checklist for Manual Upgrades to 10gR2 316889.1

Now apart from upgrading database there are some pre upgrade & post upgrade steps specific to oracle applications 11i & follow them as mentioned in metalink note # 362203.1

Upgrade to 9.2.0.8 from note: 216550.1



Apps upgrade to support 10G:

316365.1 Oracle Applications Release 11.5.10.2 Maintenance Pack Installation Instructions (Use this to upgrade from 11i i.e. 11.5.5,6,7,8,9 to 11.5.10.2)

Upgrade of Oracle Application to 11.5.10.2 from previous release of 11i (11.5.5 to 11.5.9) should be done by applying maintenance pack i.e. Patch # 3480000 and few other prereq. & post patch steps. Follow Metalink Note # 316365.1

Your application should be on AD minipack I version 2 i.e. 11.AD.I.2 which is available via patch # 4337683 so first apply patch 4337683. (If you are not sure if you already have AD.I.2 or not query AD_BUGS table)

If you are planning to merge prereq. patches, NLS patches and other functional patches with 11.5.10.2 (3480000), note that AD.I.2 4337683 should not be merged as it is not possible to merge AD patches.

If you are already on 11.5.10 and wish to upgrade to 11.5.10.2, simply apply patch u3480000.drv using adpatch utility (316366.1)


316366.1 11.5.10 Oracle E-Business Suite Consolidated Update 2 (CU2) (Use this to upgrade from 11.5.10 to 11.5.10.2)


289788.1 Upgrading Oracle Applications (Use this doc to upgrade to 11.5.10.2 from 10.7 or 11.0.3)

Sunday, July 19, 2009

OraInventory Information:

The inventory is a very important part of the Oracle Universal Installer. This is where OUI keeps all information

regarding the products installed on a specific machine.

There are two inventories with the newer releases of OUI (2.x and higher):

The inventory in the ORACLE_HOME (Local Inventory)
The central inventory directory outside the ORACLE_HOME (Global Inventory)

At startup, the Oracle Universal Installer first looks for the key (oraInst.loc) that specifies where the global

inventory is located at


this key is platform dependant


/var/opt/oracle/oraInst.loc ( Solaris )

/etc/oraInst.loc ( AIX and Linux )

HKEY_LOCAL_MACHINE -> Software -> Oracle -> INST_LOC ( Windows )

If this key is found, the directory within it will be used as the global inventory location.

If the key is not found, the inventory path will default created as follows:

UNIX : $­ORACLE_BASEoraInventory
WINDOWS : c:program filesoracleInventory

If the ORACLE_BASE environment variable is not defined, the inventory is created at the same level as the first

Oracle home.
For example, if your first Oracle home is at /export/app/oracle/ORACLEHome1, then,
the inventory is at /export/app/oracle/oraInventory



The Oracle Universal Installer inventory is the location for the Oracle Universal Installer's bookkeeping.

The inventory stores information about:
All Oracle software products installed in all Oracle homes on a machine
Other non-ORACLE_HOME specific products, such as the Java Runtime Environment (JRE)

Starting with Oracle Universal Installer 2.1, the information in the Oracle Universal Installer inventory is stored

in Extensible Markup Language (XML) format.
The XML format allows for easier diagnosis of problems and faster loading of data.
Any secure information is not stored directly in the inventory. As a result, during deinstallation of some products,

you may be prompted for required secure information, such as passwords.


Local Inventory

There is one Local Inventory per ORACLE_HOME.
It is physically located inside the ORACLE_HOME at $­ORACLE_HOME/inventory
and contains the detail of the patch level for that ORACLE_HOME.

The Local Inventory gets updated whenever a patch is applied to the ORACLE_HOME, using OUI.

If the Local Inventory becomes corrupt or is lost, this is very difficult to recover, and may result in having to

reinstall the ORACLE_HOME and re-apply all patchsets and patches.


Global Inventory

The Global Inventory is the part of the XML inventory that contains the high level list of all oracle products

installed on a machine.
There should therefore be only one per machine.
Its location is defined by the content of oraInst.loc.
The Global Inventory records the physical location of Oracle products installed on the machine,
such as ORACLE_HOMES (RDBMS and IAS) or JRE.
It does not have any information about the detail of patches applied to each ORACLE_HOMEs.
The Global Inventory gets updated every time you install or de-install an ORACLE_HOME on the machine, be it through

OUI Installer, Rapid Install, or Rapid Clone.

Note: If you need to delete an ORACLE_HOME, you should always do it through the OUI de-installer in order to keep the

Global Inventory synchronized.

OUI 2.x (11.5.7 and later):

Global inventory becomes a list of pointers to each Local Inventory
Global and local inventories are in text based XML format
XML conversion is validated and performed if needed by Rapid Clone

Prior to 2.x ( 11.5.5 or aerlier )
Global inventory was in binary format
Global inventory contained all software install information
No local inventories in ORACLE_HOMEs



oraInst.loc file may be in different locations, depending on system platform:

/var/opt/oracle/oraInst.loc file
or
/etc/oraInst.loc

---file contents---
inventory_loc=/u01/oracle/oraInventory
inst_group=oinstall
---file contents---


Required permissions for oraInst.loc

chmod 644 /var/opt/oracle/oraInst.loc



oraInst.loc contain path information to the Oracle central(also called global) Inventory directory and
group of the software owner which can be dba or oinstll as created on the system:
That is why group name should be same eg: dba for database user eg: oracle and application user eg: applmgr
as application side oracle_homes are alos registered in Global inventory.

Example:
inventory_loc=/app/oracle/product/10.2/oraInventory
inst_group=dba


Global Inventory holds information about Oracle Products on a Machine and local inventory withing the software home

hold information about that software.

To recreate lobal oraInventory content if corrrupted or missing can be done suing runInstaller or from perl script

OUIsetup.pl as shown below:

From runInstaller:

cd $ORACLE_HOME/oui/bin
./runInstaller -silent -attachHome ORACLE_HOME="/u01/oracle/product/10.1.2" ORACLE_HOME_NAME="Ora10gHome"


Note: The information of ORACLE_HOME and its name to be attached in central inventory can be obtained from the

inventory.xml file present withing local inventory.


After this check if inventory information can be listed with below command:

$ORACLE_HOME/OPatch/opatch lsinventory -detail


Also can do these verifications,

View the file /ContentsXML/inventory.xml
The ORACLE_HOME_NAME will be mentioned against the location of ORACLE_HOME

For Example
HOME NAME="OraDB10g_Home" LOC="/u01/home/oracle/product/10.2/db_1" TYPE="O" IDX="1"

Here the ORACLE_HOME_NAME is OraDB10g_Home


Invoke the runInstaller inside $ORACLE_HOME/oui/bin
Select Installed Products

1. Contents
The products (ORACLE_HOME_NAME) installed will be displayed
Put a check mark on the ORACLE_HOME_NAME and its location will be displayed

2. Environment
The installed ORACLE_HOME_NAME along with Home Path will be displayed.


To create global invetory from perl script OUIsetup.pl:

. Download Patch 5035661 (OUI 2.2) (Or Later) from Metalink.

Note:
Do not follow the readme.txt file for this patch.
Just follow the instructions on this Note.

Recreate the Global oraInventory on ALL the ORACLE_HOMEs as follows :

1) iAS ORACLE_HOME :

a. Unzip the patch into the directory
ie: unzip -od p5035661_11i_LINUX.zip

b. Source the Apps environment file (/APPSORA.env).
If the environment file is not available, please make sure
the environment variable 'APPL_TOP' is set.

c. Change directory to the /appsoui/setup

d. Execute the perl script OUIsetup.pl:
perl OUIsetup.pl

This command, will create a new oraInventory (on the location where
the oraInst.loc is pointing to) and will add one entry on the file
oraInventory/ContentsXML/inventory.xml for the iAS ORACLE_HOME
just registered.

e. Give all the Permissions to the new oraInventory create in order to
prevent permission problems that might occur during the registration
of the the next ORACLE_HOME (ie: 8i or 9i).

For Example :
cd /
chmod -R 777 oraInventory

2) RDBMS ORACLE_HOME (8i or 9i)

a. Unzip the patch into the directory
ie: unzip -od p5035661_11i_LINUX.zip

b. Source the DB environment file (/_.env)
If the environment file is not available, please make sure
the environment variable 'ORACLE_SID' is set.

c. Change directory to the /appsoui/setup

d. Execute the perl script OUIsetup.pl:
perl OUIsetup.pl

This command, will use the same oraInventory created on Step 4.1, and
will add another entry on the file oraInventory/ContentsXML/inventory.xml
for the RDBMS (8i or 9i) ORACLE_HOME just registered.


Verify oraInventory registration :

- Set the DISPLAY correctly

- Go to the directory $ORACLE_HOME/appsoui/oui/install

- Execute the command : runInstaller.sh

- Click on the button 'Installed Products'

- If you are able to see all the ORACLE_HOMEs and the products installed
on each one, then the Registration was succesfull.



If the Local Inventory is missing or corrupted, then a valid workaround is to
Re-Install the Techstack by using 'rapidwiz -techstack'.
That procedure will create a a New $ORACLE_HOME (9i or iAS) containing a valid
Local Inventory.

For detailed steps on that procedure, refer to the following Metalink notes:
Note 289786.1 : 11.5.10 Oracle applications Installation Manual' (Chapter 5, Page 5-1) and
Note 146468.1 : Installing Oracle9i Application Server 1.0.2.2.2 with Oracle Applications

Re-install would be easier.
Take cold backup.
remove the inventory pointer file.
remove the /xxx/app/oracle/product/9.2.0/* files and directories (save
tnsnames.ora, sqlnet.ora, and listener.ora if they are in normal position and see $ORACLE_HOME/cpu/. for which cpu

pathces were applied and $ORACLE_HOME/.patch_storage for which opatches are applied).

setenv ORACLE_HOME, ORACLE _SID, etc. and install, then apply patchset and CPU's to bring it back to where it was.

Sunday, November 4, 2007

CRONTAB Basics Disclosed Here...

A crontab is an unix program.
It is used as a scheduler.
Scheduling is achieved by puting corntab entries into crontab.

Few of its commands are below:

$>crontab -l

The above command displayes the entries in crontab if any.

$>crontab -e

The above command opens crontab for adding/modifying crontab entries ( ordinary file save, exit - vi commands are used to save the cron entries in cron)


Crontab entry dedais are as below:

It will have six fields, starting 5 describe schedule informations and last field , the action as in sequence show here:

* * * * * {command}
Minute(0-59) Hour(0-23) DayofMonth(1-31) Month(1-12) WeekDay(0-6) {command}

In the weekday field 0 equals sunday and in the hour field the hours are in military 24 hour time format and that an asterisk [*] is "wildcard" meaning it will match any value

Few egs to clarify:

0 * * * * cd /home/username/script.sh
cron will run this script on 0th minute of every hour, every days of the month, every month of the year and every 7 days of the week

0 0 * * * cd /home/username/script.sh
cron will run this script on 0th minute of mightnight at every days of the month, every month of the year and every 7 days of the week

0 13 * * 0 cd /home/username/script.sh
cron will run this script on 0th minute of 1 PM at every days of the month, every month of the year and every Sunday of the week

0 0 15 * * cd /home/username/script.sh
cron will run this script on 0th minute of midnight on 15th day of the month , every month of the every year 15th day of teh month can be any of the 7 days of a week.