Wednesday, February 26, 2014

General Ledger FAQ for R12 Upgrade Scripts and Known Upgrade Issues

1. Where are the R12 upgrade scripts located ?

R12 upgrade SQL scripts can be found in $GL_TOP/patch/115/sql directory.

2. Which are the most important upgrade scripts and what changes do they make?

glrrncol.sqlScript has DDL statements to rename the column set_of_books_id to ledger_id in GL tables which are having column set_of_books_id.
glraslg1.sqlUpgrades all sets of books to ledgers.
glraslg2.sqlUpdates the ledger category code to SECONDARY for Secondary Ledgers.
Generates configuration ID for Primary Ledgers.
Updates SLA accounting method code and type for Cash Ledgers.
Updates SLA columns for ALC Ledgers.
glrasgls.sqlCreates GL_LEDGERS_S sequence to start with a value larger than the maximum set of books ID.
glrbaup2.sqlScript populates chart_of_accounts_id, period_set_name columns in GL_JE_BATCHES table for all those upgraded journal batches.
In R11chart_of_accounts_id,period_set_name columns are not present in GL_JE_BATCHES table. These columns are added in R12.
glrautop.sqlUpgrades autopost criteria. Populates chart_of_accounts_id, period_set_name & accounted_period_type columns in GL_AUTOMATIC_POSTING_SETS.
glrconso.sqlUpgrades Consolidation Mapping definitions.Creates the Chart of Accounts mapping in the GL_COA_MAPPINGS table.
glrreval.sqlUpgrades Revaluation definitions. Populates chart_of_accounts_id column in GL_REVALUATIONS table.
glrrjeup.sqlUpgrades recurring journal tables.Populates chart_of_accounts_id column in GL_RECURRING_BATCHES table.
glrstinc.sql Upgrades data for summary templates. Populates data in GL_SUMMARY_HIERARCHIES table.
glrflias.sqlUpgrade script for populating the GL_ACCESS_SETS, GL_ACCESS_SET_NORM_ASSIGN, and GL_ACCESS_SET_ASSIGNMENTS tables.
Also populates the GL: Data Access Set profile option values for all applications/users/responsibilities for which GL:Set Of Books profile option is set.
glrmadef.sqlUpgrades MassAllocation definitions. Mainly populates LEDGER_ID, LEDGER_CURRENCY columns in GL_ALLOC_FORMULA_LINES table
glrstbco.sqlUpgrades Summary Template Budgetary Control Options. Populates the new GL_SUMMARY_BC_OPTIONS table
glrpdrat.sqlUpgrades GL_TRANSLATION_RATES table.
Populates daily_translation_rate_type info in GL_LEDGERS table.
Inserts converstion types data into GL_DAILY_CONVERSION_TYPES table.
Populates period rates related info in GL_DAILY_RATES table.
glrsyssu.sqlPopulates values for following new profile options 'GL_RECORDS_TO_PROCESS', 'GL_ACCOUNTS_TO_PROCESS' & 'GL_GLLEZL_ARCHIVE_ROWS'.
glrsyusg.sqlUpgrades System Usages table. Populate the new consolidation_ledger_flag and efb_upgrade_flag in GL_SYSTEM_USAGES table.
glrjiint.sqlUpdates set_od_books_id column value to -1 in GL_INTERFACE table.
glrlebsv.sqlUpgrades legal entity and balancing segment assignment. Populates data in GL_LE_VALUE_SETS table.
glrjebnm.sqlUpdates jounral batch name in GL_JE_BATCHES table to change batch naming convention.
glrbobco.sqlUpgrades Budget Organization & Budgetary Control Options. Populates the new GL_BUDORG_BC_OPTIONS table.
glrasrs2.sqlCreates Secondary ledger relationships.
glrasrs4.sqlUpdates ALC GL ledger relationships from SUBLEDGER level to JOURNAL level if it is PURE 'Thin' MRC.
Updates SLA and Primary Ledger IDs of ALC JOURNAL/BALANCE ledger relationships to be same as their Source Ledgers if their Source ledgers are Secondary/ALC.
Populates the column alc_no_rate_action_code same as their source ledgers i.e. journal/subledger level ALC ledgers.
glrarvcs.sqlUpgrade script for populating the GL_AUTOREV_CRITERIA_SETS.

3. How can I determine the cause of the issues I am facing after R12 upgrade?

  1. Find the tables related to the problem.
  2. From above upgrade scripts information find the upgrade script which is populating data in those tables.
  3. Now open upgrade log file and check whether that script has failed. Check the exact error occurred when the script is executed and fix that error.

4. Why do most of the GL transaction forms (Enter Journals, Budget Journals, etc.) not retrieve any records after the upgrade?

This issue occurs if set_of_books_id column in GL tables is not renamed to ledger_id or if ledger_id column is not populated with values.
So check the upgrade log files for any errors while executing DDL statements in upgrade script glrrncol.sql.If there are any errors fix them or log a SR with Oracle support. Once ledger_id column is populated in GL tables all transactions forms will show data properly.

5. Why journal batches created before upgrade cannot be queried in journals form?

This happens if chart_of_accounts_id column in GL_JE_BATCHES table is null for the batches created before upgrade. Check upgrade log files and see if the script glrbaup2.sql is errored out. If it has errored out please rerun glrbaup2.sql script by following below steps.
  1. Navigate to $GL_TOP/patch/115/sql directory:
    cd $GL_TOP/patch/115/sql
  2. Connect to database using sqlplus as APPS user.
  3. Execute glrbaup2.sql from sql command prompt:
    sql> @glrbaup2.sql

6. On the account inquiry form, after upgrade, when click on Show Journal button the following error occurs: "APP-FND-01347: You no longer have access to the specific information requested in this screen". How do I fix this?

This happens if chart_of_accounts_id column in GL_JE_BATCHES table is null for the batches created before upgrade. Check upgrade log files and see if the script glrbaup2.sql is errored out. If it has errored out please rerun glrbaup2.sql script by following below steps.
  1. Navigate to $GL_TOP/patch/115/sql directory:
    cd $GL_TOP/patch/115/sql
  2. Connect to database using sqlplus as APPS user.
  3. Execute glrbaup2.sql from sql command prompt:
    sql> @glrbaup2.sql

7. When open the Enter Budget amounts form after the upgrade, the following error occurs: "ORA-00942: Table or view does not exist". How do I fix this?

It occurs if the view GL_BUDGET_ASSIGNMENTS_UNIQUE_V is not created or invalid. To fix this error execute below command from $GL_TOP/patch/115/odf path:
> adodfcmp userid=apps/apps mode=views odffile=glgvw.odf touser=apps/apps priv_schema=system/manager changedb=NO
Check the log file created by above command and follow the instructions to create the missing view GL_BUDGET_ASSIGNMENTS_UNIQUE_V.
Once the view is created enter budget amounts form can be opened.

8. Why Auto post criteria form does not retrieve records after upgrade?

If chart_of_accounts_id column is null in GL_AUTOMATIC_POSTING_SETS table, auto post criteria form can not retrieve any record. Check the upgrade log file and see if the script glrautop.sql has errored out. If so rerun glrautop.sql script by following below steps.
  1. Navigate to $GL_TOP/patch/115/sql directory:
    cd $GL_TOP/patch/115/sql
  2. Connect to database using sqlplus as APPS user.
  3. Execute glrautop.sql from sql command prompt:
    sql> @glrautop.sql

9. GL Posting program after upgrade ends with error "PERF0005: Oracle error detected in glpipi() - ORA-00942: table or view does not exist". Why?

This error comes when GL_POSTING_INTERIM table is not created.
Create this table using gl_posting_interim.xdf file. After that posting program will run fine.
See note:308427.1 The XDF Comparison Utility (FndXdfCmp) and note:551325.1 How to verify or create a Database Object using a odf (adodfcmp) or xdf (FndXdfCmp) file ? 

10. After upgrade GL:Data Access Set profile option is not assigned to all GL responsibilities. How to fix this?

This can happen if the script glrflias.sql fails during upgrade.
Check upgrade log files and see whether the script glrflias.sql has failed with ora-01722 error.
If so execute below insert statement after taking the back up of FND_PROFILE_OPTION_VALUES table, then GL:Data access set profile will be assigned to all responsibilities for which GL:Set Of books profile option is set in 11i.

create table FND_PROFILE_OPTION_VALUES_BK as
select * from FND_PROFILE_OPTION_VALUES;
INSERT INTO FND_PROFILE_OPTION_VALUES pov
(APPLICATION_ID,
PROFILE_OPTION_ID,
LEVEL_ID,
LEVEL_VALUE,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_LOGIN,
PROFILE_OPTION_VALUE,
LEVEL_VALUE_APPLICATION_ID)
SELECT
pov1.application_id,
po1.profile_option_id,
pov1.level_id,
pov1.level_value,
sysdate,
1,
sysdate,
1,
0,
ldg.implicit_access_set_id,
pov1.level_value_application_id
FROM
FND_PROFILE_OPTION_VALUES pov1,
GL_LEDGERS ldg,
FND_PROFILE_OPTIONS PO,
FND_PROFILE_OPTIONS PO1
WHERE pov1.application_id = 101
AND pov1.profile_option_id = po.profile_option_id
AND PO.profile_option_name='GL_SET_OF_BKS_ID'
AND po1.profile_option_name='GL_ACCESS_SET_ID'
AND pov1.level_id <> 10004
AND to_char(ldg.ledger_id) = pov1.profile_option_value
AND ldg.implicit_access_set_id IS NOT NULL
AND NOT EXISTS
(select 1 from fnd_profile_option_values pov2
where pov2.application_id = pov1.application_id
and pov2.profile_option_id = po1.profile_option_id
and pov2.level_id = pov1.level_id
and pov2.level_value = pov1.level_value
and nvl(pov2.level_value_application_id, -1)
= nvl(pov1.level_value_application_id, -1));
commit;

How to Migrate AME to R12 During Upgrade from 11i to R12?

How to Migrate AME to R12 During Upgrade from 11i to R12?




FIX

In R12 ,The Item_Type for Payables Invoice Approval Workflow is changed from APINV to APINVAPR and this new workflow is released through file apfhanwf.wft


In-progress workflow items APINV should, in general, upgrade smoothly. However, You could consider reducing the number of in-progress workflow items by turning off Invoice Approval Workflow before starting the upgrade and validate this with testing, especially where you have customized Release 11i pre-seeded workflow processes or activities.

After Upgrade to R12 all newly Initiated Invoices will be started with New Workflow Process with Item_type=APINVAPR.

The Upgrade script in R12 will Update all Pending Workflows from 11i(APINV) which are in 'Initiated' status to 'Required' Status and resetting the approval_ready_flag to Y
Once the upgrade is Completed , User need to Re-Initiate these Workflows for Approval Again by Using Option Action> Initiate OR Running the Approval Concurrent Program.
Once Re-Initiated the Approval Status for these Invoices will be changed to 'Initiated' and new Workflow Process with Item_Type=APINVAPR will be started.

Following Table Lists wfapproval_status before and After the Upgrade to R12



Approval Status in 11i Approval status to in R12 Approval_ready_flag in R12
----------------------- ------------------------- -------------------------

INITIATED REQUIRED Y
APPROVED same as 11i same as 11i
MANUALLY APPROVED same as 11i same as 11i
NOT REQUIRED same as 11i same as 11i
REJECTED same as 11i same as 11i
REQUIRED same as 11i same as 11i
WFAPPROVED same as 11i same as 11i


However, depending on how did you setup your rules, as datamodel changed between 11i and R12, the setup might need to be reviewed/ revisited after upgrade- as there is nothing like automated upgrade, the rules / approval groups are the same

Wednesday, February 19, 2014

Monitoring User Activity with “Sign-On: Audit Level” Profile Option in Oracle E-Business Suite R12

1.      Overview:
Users Activity in Oracle E-Business Suite can be monitored online (using a given form) or via reports available in the system administration responsibility.

The online monitoring of user activity within Oracle Applications is achieved via the Monitor Users form (Form Name: FNDSCMON.fmx). In order to use this form and also to use the reports the profile option Sign-On: Audit Levelmust be set to an appropriate value. The available options are: - 
  • NONE: No monitoring performed on users’ activity.
  • USER: Only show a list of logged in users.
  • RESPONSIBILITY: Will show the users logged in and the responsibility they are using.
  • FORM: show the most detailed level, it will show the User, Responsibility and Form being accessed.

The general overview of the process of monitoring user activity in Oracle Applications R12 is:
  1. Enabling users tracking by setting the profile option “Sign-On: Audit level” to take the value for example “Form”.
  2. Viewing Users online using “Monitor Users” form.
  3. Viewing Monitoring Reports about users and their activity.
  4. If not used disable tracking users by changing the “Sign-On: Audit level” to take the value for example “None”.
2.      Enable User Tracking – Setting the Sign-On: Audit Level profile option:
To enable user tracking by changing the value of “Sign-On: Audit Level” profile option use the following steps (we will use the value Form):
  1. Log in to Oracle APPS with system administrator responsibility
  2. Navigate to Profile > System
  3. Make sure the Site option is checked.
  4. Navigate to Profile and search for sign > Click Find
  5. Select the “Sign-On: Audit Level” > Click Find
  6. Change its value to be Form
  7. From the Menu bar click File > Save
 
3.      Viewing Users Online Using the “Monitor Users” form:
To monitor users online we use the “Monitor Users” screen or form. To display current users and their information using Monitor Users form:
  1. Log in with System Administrator Responsibility
  2. Navigate to Security: Users > Monitor
  3. Click (CTL + F11) keys to display the result.
The screen shot below indicates what you would see if you had chosen the FORM option for the profile option in question.
 
 
This is a very useful screen since it tells you exactly which users are logged in and what are they doing in the system at any point in time. One may check this screen before bouncing or restarting the system to make sure all users are logged out.

It is a good practice to set the Sign-On: Audit Level profile option to “Form” since it gives the most detailed information above other choices but it will impact the system performance since it collects a lot of information, so you have keep that in mind.
 
4.      Viewing Monitoring Reports about Users and their activity:
Depending on what audit level you have selected for the profile option under discussion you may also generate various reports as indicated below: –
  • Sign-On Audit Concurrent Requests: View information about who is requesting what concurrent requests and from which responsibilities and forms.
  • Sign-On Audit Forms:View who is navigating to what form and when they do it.
  • Sign-On Audit Responsibilities: Used to view who is selecting what responsibility and when they are doing it.
  • Sign-On Audit Users:Used to view who signs on and for how long.
  • Sign-On Audit Unsuccessful: Show audit information about unsuccessful logins to Oracle Applications.
To view any of the given reports monitoring user activity use following steps:
  1. Navigate to System Administrator Responsibility > Concurrent > Requests Or from the Menu Bar go to View > Requests
  2. Choose Submit New Request > Single Request
  3. Select report you want from the 4 requests given above.
  4. Click Submit > Find
  5. Select report you choose and click View output button to view the report.
5.      Notifying Users of Unsuccessful Logins to their accounts:
 
Sign-On Audit can track user logins and provide users with a warning message if anyone has made an unsuccessful attempt to sign on with their application username since their last sign-on. This warning message appears after a user signs on. You do not have to audit the user with Sign-On Audit to use this notification feature.

To inform users about unsuccessful logins to their account, you can set the “Sign-On: Notification” profile option to Yes. To do that from System Administrator Responsibility > Profile > System > Find the profile option “Sign-On: Notification” and change its value to Yes.
 

Queries to get the SESSION INFORMATION

Queries to get the SESSION INFORMATION



Checking  Timing details, Client PID of associated oracle SID

set head off
set verify off
set echo off
set pages 1500
set linesize 100
set lines 120
prompt
prompt Details of SID / SPID / Client PID
prompt ==================================
select /*+ CHOOSE*/
'Session  Id.............................................: '||s.sid,
'Serial Num..............................................: '||s.serial#,
'User Name ..............................................: '||s.username,
'Session Status .........................................: '||s.status,
'Client Process Id on Client Machine ....................: '||'*'||s.process||'*'  Client,
'Server Process ID ......................................: '||p.spid Server,
'Sql_Address ............................................: '||s.sql_address,
'Sql_hash_value .........................................: '||s.sql_hash_value,
'Schema Name ..... ......................................: '||s.SCHEMANAME,
'Program  ...............................................: '||s.program,
'Module .................................................: '|| s.module,
'Action .................................................: '||s.action,
'Terminal ...............................................: '||s.terminal,
'Client Machine .........................................: '||s.machine,
'LAST_CALL_ET ...........................................: '||s.last_call_et,
'S.LAST_CALL_ET/3600 ....................................: '||s.last_call_et/3600
from v$session s, v$process p
where p.addr=s.paddr and
s.sid=nvl('&sid',s.sid) and
p.spid=nvl('&spid',p.spid) and
nvl(s.process,-1) = nvl('&ClientPid',nvl(s.process,-1));


To Find Session Information Details based on SID or SPID or CLIENTPID

col program for a15F
col machine for a15
col terminal for a15
set lines 152

select s.sid,
s.serial#,
'*'||s.process||'*'  Client,
p.spid Server,
s.sql_address,
s.sql_hash_value,
s.username,
s.action,
s.program || s.module,
s.terminal,
s.machine,
s.status,
--s.last_call_et
s.last_call_et/3600
from gv$session s, gv$process p
where p.addr=s.paddr and
s.sid=nvl('&sid',s.sid) and
p.spid=nvl('&spid',p.spid) and
nvl(s.process,-1) = nvl('&ClientPid',nvl(s.process,-1));



Checking Timing details, Client PID of associated oracle SID

undefine spid
set pagesize 40
col INST_ID for 99
col spid for a10
set linesize 150
col action format a10
col logon_time format a16
col module format a13
col cli_process format a7
col cli_mach for a15
col status format a10
col username format a10
col last_call_et for 9999.99
col sql_hash_value for 9999999999999
select p.INST_ID,p.spid,s.sid, s.serial#, s.status, s.username, s.action,
to_char(s.logon_time, 'DD-MON-YY, HH24:MI') logon_time,
s.module,s.program,s.last_call_et/3600 last_call_et ,s.process cli_process,s.machine
cli_mach,s.sql_hash_value
from gv$session s, gv$process p
where p.addr=s.paddr and p.spid in(&SPID);

Checking Timing Details of SID and event waiting for

select a.sid, a.serial#, a.status, a.program, b.event,to_char(a.logon_time, 'dd-mon-yy hh24:mi') LOGON_TIME,
to_char(Sysdate, 'dd-mon-yy--hh24:mi') CURRENT_TIME, (a.last_call_et/3600) "Hrs connected" from v$session a,
v$session_wait b where a.sid in(&SIDs) and a.sid=b.sid;

Checking for active transactions SID

select username,t.used_ublk,t.used_urec from v$transaction t,v$session s where t.addr=s.taddr and s.sid in(&SIDs);


Checking what is the Last SQL (input multiple sids)

undefine sid
col "Last SQL" for a70
select s.username, s.sid, s.serial#,t.sql_text "Last SQL"
from gv$session s, gv$sqlarea t
where s.sql_address =t.address and
s.sql_hash_value =t.hash_value and
s.sid in (&SIDs);

All Active and Inactive connections

col program for a15F
col machine for a15
col terminal for a15
set lines 152

select s.sid,
s.serial#,
'*'||s.process||'*'  Client,
p.spid Server,
s.sql_address,
s.sql_hash_value,
s.username,
s.action,
s.program || s.module,
s.terminal,
s.machine,
s.status,
--s.last_call_et
s.last_call_et/3600
from gv$session s, gv$process p
where p.addr=s.paddr and s.type != 'BACKGROUND';

col program for a15F
col machine for a15
col terminal for a15
set lines 152

select s.sid,
s.serial#,
'*'||s.process||'*'  Client,
p.spid Server,
s.sql_address,
s.sql_hash_value,
s.username,
s.action,
s.program || s.module,
s.terminal,
s.machine,
s.status,
--s.last_call_et
s.last_call_et/3600
from gv$session s, gv$process p
where p.addr=s.paddr and
s.sid=nvl('&sid',s.sid) and
p.spid=nvl('&spid',p.spid) and
s.status='ACTIVE' and
--(s.last_call_et/3600)<1 and="" br="">nvl(s.process,-1) = nvl('&ClientPid',nvl(s.process,-1));


Active sessions

select p.spid "Thread", s.sid "SID-Top Sessions",
substr(s.osuser,1,15) "OS User", substr(s.program,1,25) "Program Running"
from v$process p, v$session s
where p.addr=s.paddr
order by substr(s.osuser,1,15);


Session details from Session long ops

select SID,SERIAL#,OPNAME,SOFAR,TOTALWORK,START_TIME,LAST_UPDATE_TIME,username from
v$session_longops where sid=&SID and serial#=&SERIAL


To list the nodes

set head off
set verify off
set echo off
set pages 1500
set linesize 70
prompt
prompt Environment sketch
prompt ==================================
select /*+ CHOOSE*/
'NODE_NAME.................: '||NODE_NAME,
'CREATION_DATE.............: '||CREATION_DATE,
'CREATED_BY ...............: '||CREATED_BY,
'SUPPORT_CP ...............: '||SUPPORT_CP,
'SUPPORT_FORMS ............: '||SUPPORT_FORMS,
'SUPPORT_WEB ..............: '||SUPPORT_WEB,
'SUPPORT_ADMIN ............: '||SUPPORT_ADMIN,
'STATUS ...................: '||STATUS,
'HOST.DOMAIN ..... ........: '||HOST||'.'||DOMAIN,
'SUPPORT_DB  ..............: '||SUPPORT_DB
from  apps.fnd_nodes;

Session details thru SPID

select sid, serial#, USERNAME, STATUS, OSUSER, PROCESS,
MACHINE, MODULE, ACTION, to_char(LOGON_TIME,'yyyy-mm-dd hh24:mi:ss')
from v$session where paddr in (select addr from v$process where spid = '11533')






Checking  Timing details, Client PID of associated oracle SID

set head off
set verify off
set echo off
set pages 1500
set linesize 100
set lines 120
prompt
prompt Details of SID / SPID / Client PID
prompt ==================================
select /*+ CHOOSE*/
'Session  Id.............................................: '||s.sid,
'Serial Num..............................................: '||s.serial#,
'User Name ..............................................: '||s.username,
'Session Status .........................................: '||s.status,
'Client Process Id on Client Machine ....................: '||'*'||s.process||'*'  Client,
'Server Process ID ......................................: '||p.spid Server,
'Sql_Address ............................................: '||s.sql_address,
'Sql_hash_value .........................................: '||s.sql_hash_value,
'Schema Name ..... ......................................: '||s.SCHEMANAME,
'Program  ...............................................: '||s.program,
'Module .................................................: '|| s.module,
'Action .................................................: '||s.action,
'Terminal ...............................................: '||s.terminal,
'Client Machine .........................................: '||s.machine,
'LAST_CALL_ET ...........................................: '||s.last_call_et,
'S.LAST_CALL_ET/3600 ....................................: '||s.last_call_et/3600
from v$session s, v$process p
where p.addr=s.paddr and
s.sid=nvl('&sid',s.sid) and
p.spid=nvl('&spid',p.spid) and
nvl(s.process,-1) = nvl('&ClientPid',nvl(s.process,-1));


To list count of connections from other machines

select count(1),machine from gv$session where inst_id=2 group by machine;

To get total count of sessions and processes

select count(*) from v$session;

select count(*) from v$process;

select (select count(*) from v$session) sessions, (select count(*) from v$process) processes from dual;

To find sqltext thru sqladdress

select sql_address from v$session where sid=1999;

select sql_text from v$sqltext where ADDRESS='C00000027FF00AF0' order by PIECE;

To find sqltext for different sql hashvalue

select hash_value,sql_text from v$sql where hash_value in (1937378691,1564286875,
248741712,2235840973,2787402785)

To list long running forms user sessions

select s.sid,s.process,p.spid,s.status ,s.action,s.module, (s.last_call_et/3600) from
v$session s, v$process p where round(last_call_et/3600) >4 and action like '%FRM%' and
p.addr=s.paddr ;

To list inactive Sessions respective username

SELECT username,count(*) num_inv_sess
FROM v$session
where last_call_et > 3600
and username is not null
AND STATUS='INACTIVE'
group by username
order by num_inv_sess DESC;

SELECT count(*) FROM v$session where last_call_et > 43200 and username is not null AND
STATUS='INACTIVE';
SELECT count(*) FROM v$session where last_call_et > 3600 and username is not null AND
STATUS='INACTIVE';

To find session id with set of SPIDs

select sid from v$session, v$process where addr=paddr and spid in ('11555','26265','11533');

To find Sql Text given SQLHASH & SQLADDR

select piece,sql_text from v$sqltext where HASH_VALUE = &hash and ADDRESS ='&addr' order by piece;
select piece,sql_text from v$sqltext where  ADDRESS ='&addr' order by piece;

To find Undo Generated For a given session

select  username,
t.used_ublk ,t.used_urec
from    gv$transaction t,gv$session s
where   t.addr=s.taddr and
s.sid='&sessionid';


***APPS 11i*****

To Find Forms User Session Details Given ClientProcess id

SELECT /*+ ORDERED FULL(fl) FULL(vp) USE_HASH(fl vp) */
( SELECT SUBSTR ( fu.user_name, 1, 20 )
FROM apps.fnd_user fu
WHERE fu.user_id = fl.user_id
) user_name,
TO_CHAR ( fl.start_time, 'DD-MON-YYYY HH24:MI' ) login_start_time,
SUBSTR ( fl.process_spid, 1, 6 ) spid,
SUBSTR ( TO_CHAR ( fl.pid ), 1, 3 ) pid,
SUBSTR ( vs.process, 1, 8 ) f60webmx,
SUBSTR ( TO_CHAR ( rf.audsid ), 1, 6 ) audsid,
SUBSTR ( TO_CHAR ( vs.sid ), 1, 3 ) sid,
SUBSTR ( TO_CHAR ( vs.serial#), 1, 7 ) serial#,
SUBSTR ( vs.module || ' - ' ||
( SELECT SUBSTR ( ft.user_form_name, 1, 40 )
FROM apps.fnd_form_tl ft
WHERE ft.application_id = rf.form_appl_id
AND ft.form_id = rf.form_id
and ft.language='US'
), 1, 40 ) form
FROM apps.fnd_logins fl,
gv$process vp,
apps.fnd_login_resp_forms rf,
gv$session vs
--fnd_form_tl ft
WHERE fl.end_time IS NULL
AND fl.start_time > sysdate - 31 /* login within last 7 days */
AND fl.login_type = 'FORM'
AND fl.process_spid = vp.spid
AND fl.pid = vp.pid
AND fl.login_id = rf.login_id
AND rf.end_time IS NULL
AND rf.audsid = vs.audsid
AND vs.process='&1'
ORDER BY
user_name,
login_start_time,
spid,
pid,
f60webmx,
sid,
serial#;

Checking Timing Details of SID and event waiting for

select a.sid, a.serial#, a.status, a.program, b.event,to_char(a.logon_time, 'dd-mon-yy hh24:mi')
LOGON_TIME,
to_char(Sysdate, 'dd-mon-yy--hh24:mi') CURRENT_TIME, (a.last_call_et/3600) "Hrs connected" from
v$session a,
v$session_wait b where a.sid=&sid and a.sid=b.sid;

Checking for active transactions SID

select username,t.used_ublk,t.used_urec from v$transaction t,v$session s where t.addr=s.taddr and
s.sid='&sessionid';
SQL> SQL> Enter value for sessionid: 219
old   1: select username,t.used_ublk,t.used_urec from v$transaction t,v$session s where
t.addr=s.taddr and s.sid='&sessionid'
new   1: select username,t.used_ublk,t.used_urec from v$transaction t,v$session s where
t.addr=s.taddr and s.sid='219';


Checking rollback/Undo segment info used by SID

column rr heading 'RB Segment' format a18
column us heading 'Username' format a15
column os heading 'OS User' format a10
column te heading 'Terminal' format a10
SELECT r.name rr, nvl(s.username,'no transaction') us,s.sid, s.osuser os, s.terminal te, rs.rssize,
rs.xacts, rs.rssize/1048576 Rssize
FROM v$lock  l, v$session  s,v$rollname  r , v$rollstat rs
WHERE l.sid = s.sid(+) AND trunc(l.id1/65536) = r.usn AND l.type = 'TX' AND
l.lmode = 6   AND r.usn=rs.usn  and s.sid in (&sid_list_comma_sep);

Checking what is the Last SQL

undefine sid
col "Last SQL" for a70
select s.username, s.sid, t.sql_text "Last SQL"
from gv$session s, gv$sqlarea t
where s.sql_address =t.address and
s.sql_hash_value =t.hash_value and
s.sid = '&sid';

Killing inactive sessions for more than 48hrs

set heading off
set feedback off
spool /PENVI/applcsf/prevent/scripts/kill_session.sql
SELECT 'ALTER SYSTEM KILL SESSION '||''''||sid ||','|| serial#||''''||' immediate;'
FROM v$session
where last_call_et > 43200 and username is not null AND STATUS='INACTIVE';
spool off
exit

Session details complete (Input sid)

set echo off
set linesize 132
set verify off
set feedback off
set serveroutput on;
declare
SID number := 0 ;
inst_id number := 0 ;
SERIAL number := 0 ;
username varchar(20) := '';
Status varchar(8) := '';
machine varchar(10) := '';
terminal varchar(25) := '';
program varchar(30) := '';
Module varchar(30) := '';
Action varchar(20) := '';
sql_hash_value number := 0 ;
logontime varchar(30) := '';
last_call_et number := 0 ;
proc number := 0 ;
spid number := 0 ;
event varchar(30) := '';
state varchar(30) := '';
sql_texts varchar(1000) := '';
undo_size varchar (100) := 'N/A';
cursor cur1 is
select a.inst_id,a.sid sid,
a.serial# serial,
a.username username,
a.status status ,
a.machine machine,
a.terminal terminal,
a.program program,
a.module module,
a.action action,
a.sql_hash_value sql_hash_value,
to_char(a.logon_time,'DD-Mon-YYYY HH24:MI:SS') logontime,
round((a.last_call_et/60),2) last_call_et,
a.process proc,
b.spid spid,
event event,
state state
from gv$session a, gv$process b, gv$session_wait sw
where a.paddr=b.addr and a.inst_id=b.inst_id
and a.sid in (75)
and a.inst_id=sw.inst_id
and a.sid=sw.sid;
begin
for m in cur1
loop
DBMS_OUTPUT.ENABLE(25000);
DBMS_OUTPUT.PUT_LINE(' ');
DBMS_OUTPUT.PUT_LINE('INSTANCE ID....................... : ' || m.inst_id );
DBMS_OUTPUT.PUT_LINE('SID............................... : ' || m.sid );
DBMS_OUTPUT.PUT_LINE('SERIAL#........................... : ' || m.serial );
DBMS_OUTPUT.PUT_LINE('USERNAME.......................... : ' || m.username );
DBMS_OUTPUT.PUT_LINE('STATUS............................ : ' || m.status );
DBMS_OUTPUT.PUT_LINE('Client Machine.....................: ' || m.machine );
DBMS_OUTPUT.PUT_LINE('Terminal.......................... : ' || m.terminal);
DBMS_OUTPUT.PUT_LINE('Program........................... : ' || m.program );
DBMS_OUTPUT.PUT_LINE('Module............................ : ' || m.module );
DBMS_OUTPUT.PUT_LINE('Action............................ : ' || m.action );
DBMS_OUTPUT.PUT_LINE('SQL Hash Value.................... : ' || m.sql_hash_value );
DBMS_OUTPUT.PUT_LINE('Logon Time........................ : ' || m.logontime );
DBMS_OUTPUT.PUT_LINE('Last Call Et...................... : ' || m.last_call_et||' '||'min' );
DBMS_OUTPUT.PUT_LINE('ClientPID......................... : ' || m.proc );
DBMS_OUTPUT.PUT_LINE('ServerPID......................... : ' || m.spid );
DBMS_OUTPUT.PUT_LINE('Session Waiting for Event..........: ' || m.event );
DBMS_OUTPUT.PUT_LINE('Session state .....................: ' || m.state);
for rec_undo in (select nvl(t.used_ublk,0)||' '||'Blocks' undo_size from v$session s,v$transaction t where
s.taddr=t.addr(+) and
s.sid=m.sid )
loop
dbms_output.put_line('Undo Generation for sid is.........: ' ||rec_undo.undo_size);
end loop;
dbms_output.put_line('SQL_TEXT is..........:');
for rec in ( select sql_text sql_texts from v$session s,v$sqltext v where
s.sql_hash_value=v.hash_value and
s.sql_address=v.address and s.sid=m.sid order by piece)
loop
dbms_output.put_line(' '||rec.sql_texts);
end loop;
for n in ( select t.DISK_READS DISK_READS from gv$session s, gv$sqlarea t
where s.sql_hash_value =t.hash_value and s.sid=m.sid)
loop
dbms_output.put_line('Disk reads due to above SQL execution ' || n.DISK_READS);
end loop;
DBMS_OUTPUT.PUT_LINE(' ' );
DBMS_OUTPUT.PUT_LINE(':------------------------------------------------: ' );
DBMS_OUTPUT.PUT_LINE(' ' );

end loop;
end;

Session details complete (Input SPID)

set echo off
set linesize 132
set verify off
set feedback off
set serveroutput on;
declare
inst_id number := 0 ;
SID number := 0 ;
SERIAL number := 0 ;
username varchar(20) := '';
Status varchar(8) := '';
machine varchar(10) := '';
terminal varchar(25) := '';
program varchar(30) := '';
Module varchar(30) := '';
Action varchar(20) := '';
sql_hash_value number := 0 ;
logontime varchar(30) := '';
last_call_et number := 0 ;
proc number := 0 ;
spid number := 0 ;
event varchar(30) := '';
state varchar(30) := '';
sql_texts varchar(1000) := '';
undo_size varchar (100) := 'N/A';
cursor cur1 is
select a.inst_id, a.sid sid,
a.serial# serial,
a.username username,
a.status status ,
a.machine machine,
a.terminal terminal,
a.program program,
a.module module,
a.action action,
a.sql_hash_value sql_hash_value,
to_char(a.logon_time,'DD-Mon-YYYY HH24:MI:SS') logontime,
round((a.last_call_et/60),2) last_call_et,
a.process proc,
b.spid spid,
event event,
state state
from gv$session a, gv$process b, gv$session_wait sw
where a.paddr=b.addr and a.inst_id=b.inst_id
and b.spid in ( '&spid')
and a.inst_id=sw.inst_id
and a.sid=sw.sid;
begin
for m in cur1
loop
DBMS_OUTPUT.ENABLE(25000);
DBMS_OUTPUT.PUT_LINE(' ');
DBMS_OUTPUT.PUT_LINE('INSTANCE ID....................... : ' || m.inst_id );
DBMS_OUTPUT.PUT_LINE('SID............................... : ' || m.sid );
DBMS_OUTPUT.PUT_LINE('SERIAL#........................... : ' || m.serial );
DBMS_OUTPUT.PUT_LINE('USERNAME.......................... : ' || m.username );
DBMS_OUTPUT.PUT_LINE('STATUS............................ : ' || m.status );
DBMS_OUTPUT.PUT_LINE('Client Machine.....................: ' || m.machine );
DBMS_OUTPUT.PUT_LINE('Terminal.......................... : ' || m.terminal);
DBMS_OUTPUT.PUT_LINE('Program........................... : ' || m.program );
DBMS_OUTPUT.PUT_LINE('Module............................ : ' || m.module );
DBMS_OUTPUT.PUT_LINE('Action............................ : ' || m.action );
DBMS_OUTPUT.PUT_LINE('SQL Hash Value.................... : ' || m.sql_hash_value );
DBMS_OUTPUT.PUT_LINE('Logon Time........................ : ' || m.logontime );
DBMS_OUTPUT.PUT_LINE('Last Call Et...................... : ' || m.last_call_et||' '||'min' );
DBMS_OUTPUT.PUT_LINE('ClientPID......................... : ' || m.proc );
DBMS_OUTPUT.PUT_LINE('ServerPID......................... : ' || m.spid );
DBMS_OUTPUT.PUT_LINE('Session Waiting for Event..........: ' ||m.event );
DBMS_OUTPUT.PUT_LINE('Session state .....................: ' ||m.state);
for rec_undo in (select nvl(t.used_ublk,0)||' '||'Blocks' undo_size from v$session s,v$transaction t where
s.taddr=t.addr(+) and
s.sid=m.sid )
loop
dbms_output.put_line('Undo Generation for sid is.........: ' ||rec_undo.undo_size);
end loop;
dbms_output.put_line('SQL_TEXT is..........:');
for rec in ( select sql_text sql_texts from v$session s,v$sqltext v where
s.sql_hash_value=v.hash_value and
s.sql_address=v.address and s.sid=m.sid order by piece)
loop
dbms_output.put_line(' '||rec.sql_texts);
end loop;
for n in ( select t.DISK_READS DISK_READS from gv$session s, gv$sqlarea t
where s.sql_hash_value =t.hash_value and s.sid=m.sid)
loop
dbms_output.put_line('Disk reads due to above SQL execution ' || n.DISK_READS);
end loop;
DBMS_OUTPUT.PUT_LINE(' ' );
DBMS_OUTPUT.PUT_LINE(':------------------------------------------------: ' );
DBMS_OUTPUT.PUT_LINE(' ' );
end loop;end;

Count of JDBC thin client sessions grouped by status

col program for a15F
col machine for a15
col terminal for a15
set lines 152
select count(s.sid),s.status from gv$session s, gv$process p where p.addr=s.paddr and s.program || s.module like ('%JDBC Thin Client%') group by status;

JDBC Session count

select count(s.sid) from gv$session s where s.program || s.module like ('%JDBC Thin Client%');

Inactive sessions count

SELECT username,count(*) num_inv_sess
FROM v$session
where last_call_et > 1800
and username is not null
and module like '%JDBC Thin Client%'
AND STATUS='INACTIVE'
group by username
order by num_inv_sess DESC;

SELECT username,count(*) num_inv_sess
FROM v$session
where last_call_et > 43200
and username is not null
and module like '%JDBC Thin Client%'
AND STATUS='INACTIVE'
group by username
order by num_inv_sess DESC;


JDBC Sessions count

SELECT username,count(*) sess
FROM v$session
where username is not null
and module like '%JDBC Thin Client%'
group by username
order by sess DESC;

Machine wise count

select MACHINE, PROCESS,COUNT(*)
from V$SESSION
where program like '%JDBC%'
and username = 'APPS'
and process is not null
group by MACHINE, PROCESS
order by MACHINE ;

Inactive sessions count

SELECT count(*),module FROM v$session where last_call_et > 43200 and username is not null AND
STATUS='INACTIVE' group by module;

SELECT username,status,count(*)sesion FROM v$session where username is not null and module
like '%JDBC Thin Client%' group by username ,status;

select count(status) Count, status, machine, program from v$session where program like '%JDBC%'
group by status, machine,program having status = 'INACTIVE' order by 1;

ACTIVE / INACTIVE Sessions

set linesize 132
set pagesize 100
col machine format a15
col OSuser format a12
col program format a30
SQL> select count(*) from v$session;

SQL> select count(*) from v$session where status='INACTIVE';

SQL> select count(*) from v$session where status='ACTIVE';

SQL> select machine, osuser, program, count(*) from v$session
group by machine, osuser, program order by 4 desc;

SQL> select count(status) Count, status, machine, program from v$session
where program like '%JDBC%' group by status, machine, program;

SQL> select count(status) Count, status, machine, module from v$session
where program = 'JDBC Thin Client' group by status, machine, module;

Logon time of JDBC

SQL> SELECT serial#, substr(program,1,20) program, status,
to_char(logon_time,'DD-MON-YY HH24:SS') Login_Time,
to_char(sysdate-last_call_et/86400,'DD-MON-YY HH24:SS') Last_Activity FROM
v$session
WHERE program like 'JDBC%' order by 4;

Session distribution

select to_char(sysdate,'DD/MM HH24:MI') "DATE",inst_id,count(inst_id) total_ses,sum(decode(status,'INACTIVE',1,0) ) inactive_ses from gv$session group by inst_id;

Program grouped by count of user connection

select unique s.program,s.osuser ,count(1) from v$session s, v$process p where s.username
is not null and s.paddr = p.addr and s.status='INACTIVE' group by s.program,s.osuser;

TOTAL Sessions/Inactive Sessions

select to_char(sysdate,'DD/MM HH24:MI') "DATE", inst_id, count(inst_id) total_ses,
sum(decode(status,'INACTIVE',1,0) )inactive_ses from gv$session group by inst_id

Thru Os user

col program for a15F
col machine for a15
col terminal for a15
set lines 152

select s.sid,
s.serial#,
'*'||s.process||'*'  Client,
p.spid Server,
s.sql_address,
s.sql_hash_value,
s.username,
s.action,
s.program || s.module,
s.terminal,
s.machine,
s.status,
--s.last_call_et
s.last_call_et/3600
from gv$session s, gv$process p
where p.addr=s.paddr
and s.osuser='&osuser';

Session accessing an object

select b.sql_text,a.sid,a.serial#,b.users_executing, b.rows_processed,a.last_call_et/3600 Hrs from v$sqlarea b,v$session a where b.sql_text like '&object_name' and a.sql_address=b.address;


select b.sql_text,a.sid,a.serial#,b.users_executing, b.rows_processed,a.last_call_et/3600 Hrs from gv$sqlarea b,gv$session a where sql_text like '%DTEA_PA_REPORTING_AGT_HISTO%' and a.sql_address=b.address;

Select
a.session_id, b.sql_text,
count(*)
from
v$active_session_history a,v$sql b
where
a.session_state= 'ON CPU' and
a.SAMPLE_TIME > sysdate - (120/(24*60)) and a.sql_id=b.sql_id and b.sql_text like '%WF_ITEM_ATTRIBUTE_VALUES%'
group by a.session_id,b.sql_text
order by
count(*) desc;

Listing out details of program thru SQLID

Select
a.session_id, b.sql_text,a.program,a.module,a.action
from
v$active_session_history a,v$sql b
where
a.sql_id=b.sql_id and b.sql_id like '%fk9qzystpcazs%';

 How to find apps user when you know the o/s  pid in 11i for Forms users (f60webmx 100% CPU)


 You have to pass the UNIX process id to this script

 column "User Name" format a20
 column "ClPID" format a8
 select
 d.user_name "User Name",
 b.sid SID,b.serial# "Serial#", c.spid "srvPID", a.SPID "ClPID",
 to_char(START_TIME,'DD-MON-YY HH:MM:SS') "STime"
 from
 fnd_logins a, v$session b, v$process c, fnd_user d
 where
 b.paddr = c.addr
 and a.pid=c.pid
 and a.spid = b.process
 and d.user_id = a.user_id
 and (d.user_name = 'USER_NAME' OR 1=1)
 and a.SPID = &PID;

Friday, February 14, 2014

mod_oc4j: Failed to find a failover oc4j process for session request for destination

Error Noticed in the log file 


$LOG_HOME/ora/10.1.3/Apache

mod_oc4j: Failed to find a failover oc4j process for session request for destination


Solution -

1. Noticed the When we have started the Application Services the load average was 1.
2. When executed ps -ef  |grep applmgr  noticed many processes.
3. Killed the process via 
ps -ef |grep applmgr|grep -v grep |awk '{print $2}'|xargs kill -9

Issue got resolved.

a. Started the services.
b. Via forms fixed restart and all the concurrent managers are up.



Regards
Mohammed Abdul Muqeet