Saturday, July 30, 2011

Request ***** can no longer be cancelled

Unable to cancel the request. Getting error "Request ***** can no longer be cancelled."

Its safe to cancel from backend as below :

UPDATE fnd_concurrent_requests
SET phase_code = 'C', status_code = 'X'
WHERE request_id = 'request_id';
commit;

UR's Key Run ;-) 

Analyse Conc Request - ANALYZEREQ.SQL & BDE_REQUEST.sql

ANALYZEREQ.SQL - gives a detailed info of the request

sqlplus apps/pwd @analyzereq request_id

Get analyzereq.sql  from Note ID:134035.1

BDE_REQUEST.sql - To get the process and session info

sqlplus apps/pwd @START bde_request.sql request_id

Get bde_request.sql from Note ID : 187504.1

UR's Key Run ;-) 

Linux Error: 24: Too many open files

Issue could be losf count by applmgr is more than ulimit -n


lsof -u applmgr | wc -l >  ulimit -n

need to change hard and soft in /etc/security/limits.conf and restart server

Ref : 577291.1


UR's Key Run ;-) 

Inactive Nomanager


Request goinging Inactive Nomanager



- Check ICM up and Running
- Check the manager that id supposed to run this request is up and running ( FInd the specialization rules include/exclude this prog exists )

select 'Concurrent program '||fcp.concurrent_program_name||' is ' ||
decode(fcqc.include_flag,'I','included in ','E','excluded from ')||fcqv.user_concurrent_queue_name
specialization_rule_details from fnd_concurrent_queues_vl fcqv,fnd_concurrent_queue_content fcqc,fnd_concurrent_programs fcp
where fcqv.concurrent_queue_id=fcqc.concurrent_queue_id and fcqc.type_id=fcp.concurrent_program_id
and fcp.concurrent_program_name='<PROGRAM_SHORT_NAME>';


If above are are fine but still facing issue.. you can try this
   - Deactivate the desired Mgr
   - Go 2 Specialization Rules of that manager and delete the entries ( Conc -> Mgr -> Define )
   - Activate the Mgr
   - Add d specialization rules back


- If still not working follow note 1311526.1


UR's Key Run ;-) 

Request Pending Normal for Long Time


Some time requests will b in Pending Normal status  for long time before it comes in to Running Normal Status.
This can be fixed by setting Process and Sleep para's appropriately depending on Business requirement  for Standard Manager.

Lets say you set Process = 5 and Sleep = 3 it means each of these 5 Procs will check the Conc Queue for pending requests for every 3 sec.

UR's Key Run ;-) 

How to create FNDSM ??????


Some time after cloning Service Mgr "FNDSM" might be missing.

In that case, create FNDSM as below

as applmgr user

Run @$FND_TOP/patch/115/sql/afdcm037.sql - Creates necessary libs for FNDSM and Mgr for pre existing nodes.

Note : FNDSM can not be created from Conc -> Mgr -> Define form

UR's Key Run ;-) 

OPP - Output Post Processor


OPP ( Output Post Processor ) [ When BI Publisher is setup ]

The standard Oracle reports are not much user friendly where as XML Publisher reports are very user friendly and easy to understand as it allows you to have
report in the form of graphs,Statistics etc etc

When ever you run a report request once processig the report the Conc Mgr contacts OPP to apply the XML Publisher template and finally creates the o/p

To activate OPP keep in mind these things

- Set Profile Concurrent: GSM Enabled to 'Y'

-  While defining Work Shift's of the OPP

    Set
            Processes = 2
    and
            Parameters = oracle.apps.fnd.cp.opp.OPPServiceThread:2:0:max_threads=5
    and
            Sleep Second = 30

( Note here Processes = 2 and Threads =5 means it can handle 2*5=10 requests in parallel )


Profiles controlling OPP timeout

Concurrent:OPP Response Timeout - Specifies the amount of time a manager waits for OPP to respond to its request for post processing. [ Default 120 seconds (2 min.) ]

Concurrent:OPP Process Timeout - Specifies the amount of time the manager waits for the OPP to actually process the request. [ Default  300 seconds (5 min.) ]


This depends on


size of the XML Data File
complexity of the template
performance of the server
....

Key Pts :

For OPP to run  as told before profile "Concurrent: GSM Enabled to 'Y'" needs to be set which means Service Manager needs to be up and running.

When ever you see that OPP is not up check for Service Mgr is up or not. This is common issue after cloning.

UR's Key Run ;-) 

Temp Issues


ERROR
ORA-20100: File o0669194.tmp creation for FND_FILE failed.

Make sure the following are set up properly:

1) utl_file_dir parameter in v$parameter has the same value as $APPLPTMP, $APPLTMP and $REPORTS60_TMP ( Make sure they all set to first directory of utl_file_dir )
2) Permission on directory of utl_file_dir parameter shows 777 - full read/write

Wht happens if APPLTMP is not set to 1st dir of utl_file_dir ?

FND_FILE pkg write the file to 1st directory in utl_file_dir and application look for the file in APPLTMP location.
If both are different there comes the conflict.

APPLPTMP is a directory used only for PLSQL temporary files
FND_FILE uses the UTL_FILE which writes to utl_file_dir

SQL> exec FND_FILE.PUT_LINE(FND_FILE.LOG, 'Check it Out');

You should b able to c the file in APPLPTMP

Get the first dir in utl_file_dir

Ref Notes :

Concurrent Processing - Troubleshooting Concurrent Request ORA-20100 errors in the request logs [ID 261693.1]
Build Formula Package Fails: ORA-20100: File "*.tmp" creation for FND_FILE failed [ID 458742.1]



UR's Key Run ;-) 

Friday, July 29, 2011

Conc Request Info:


Conc Request Info:

SELECT logfile_name, logfile_node_name, outfile_name, outfile_node_name,
controlling_manager
FROM fnd_concurrent_requests
WHERE request_id = &&request_id

Internal Concurrent Manager log file and node name:

SELECT logfile_name "Filename", node_name "Nodename"
FROM (SELECT   *
FROM fnd_concurrent_processes
   WHERE queue_application_id = 0 AND concurrent_queue_id = 1
ORDER BY concurrent_process_id DESC)
WHERE ROWNUM = 1

Scheduled Reqs Info :


select request_id from fnd_concurrent_requests
where status_code in ('Q','I')
and requested_start_date > SYSDATE
and hold_flag = 'N';


UR's Key Run ;-) 

Script to generate ddl script of table and its index/trigger:

Script to generate ddl script of table and its index/trigger:

set long 1000000
SET PAGESIZE 3000
set lines 200
SET HEADING OFF
SET VERIFY OFF
SET FEEDBACK OFF
set echo on
set timing off
set wrap On

ACCEPT TABLE_NAME CHAR PROMPT 'Enter Table Name : '
ACCEPT TABLE_OWNER CHAR PROMPT 'Enter Table Owner : '

select DBMS_METADATA.GET_DDL('TABLE',OBJECT_NAME,OWNER)
FROM Dba_objects
where owner = UPPER('&TABLE_OWNER') and object_name = UPPER('&TABLE_NAME')
and object_type = 'TABLE'
union all
select dbms_metadata.GET_DEPENDENT_DDL ('COMMENT', TABLE_NAME, OWNER )
FROM (select table_name,owner
from Dba_col_comments
where owner = UPPER('&TABLE_OWNER')
and table_name = UPPER('&TABLE_NAME')
and comments is not null
union
select table_name,owner
from sys.Dba_TAB_comments
where owner = UPPER('&TABLE_OWNER')
and table_name = UPPER('&TABLE_NAME')
and comments is not null)
union all
select DBMS_METADATA.GET_DEPENDENT_DDL('INDEX',TABLE_NAME, TABLE_OWNER)
FROM (select table_name,table_owner
FROM Dba_indexes
where table_owner = UPPER('&TABLE_OWNER')
and table_name = UPPER('&TABLE_NAME')
and index_name not in (select constraint_name
from sys.Dba_constraints
where table_name = table_name
and constraint_type = 'P' )
and rownum = 1)
union all
select dbms_metadata.GET_DDL ('TRIGGER', trigger_name ,owner )
from Dba_triggers
where table_owner = UPPER('&TABLE_OWNER')
and table_name = UPPER('&TABLE_NAME')
.
SET CONCAT +
spool &TABLE_NAME+_ddl.txt
/
spool off

Ref : How To Generate A DDL Script For A Table [ID 1320598.1]


UR's Key Run ;-) 

Wt all Jobs Running.................when Performance is tooooo Bad

To knw what all Jobs running @ particular time interval where you r experiencing major performance issue:

PROMPT Enter the start_time and end_time when prompted
PROMPT Date format example for start_time 1-JUL-2011 10:00:00
PROMPT Date format example for end_time 1-JUL-2011 11:00:00
PROMPT The example above will find all requests that launched between 10 am and 11 am on 16-DEC-2008

select /*+ ORDERED USE_NL(x fcr fcp fcptl)*/
fcr.request_id "Request ID",
fcr.requested_by "User",
substr(DECODE (FCR.DESCRIPTION, NULL,
FCPTL.USER_CONCURRENT_PROGRAM_NAME,
FCR.DESCRIPTION||' ('||FCPTL.USER_CONCURRENT_PROGRAM_NAME||')'),1,80)"Program Name",
fcr.phase_code "Phase",
fcr.status_code "Status",
to_char(fcr.request_date,'DD-MON-YYYY HH24:MI:SS') "Submitted",
(fcr.actual_start_date - fcr.request_date)*1440 "Delay",
to_char(fcr.actual_start_date,'DD-MON-YYYY HH24:MI:SS') "Start Time",
to_char(fcr.actual_completion_date, 'DD-MON-YYYY HH24:MI:SS') "End Time",
(fcr.actual_completion_date - fcr.actual_start_date)*1440 "Elapsed Time",
oracle_process_id "Trace File ID" ,
fcr.argument_text "Parameters"
from fnd_concurrent_requests fcr,
fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcptl
where fcr.concurrent_program_id = fcp.concurrent_program_id
and fcr.program_application_id = fcp.application_id
and fcp.application_id = fcptl.application_id
and fcp.concurrent_program_id = fcptl.concurrent_program_id
and fcptl.language = 'US'
and fcr.actual_start_date
between
to_date('&start_time','DD-MON-YYYY HH24:MI:SS') --ENTER FROM DATE/TIME like 16-DEC-2008 10:00:00
and
to_date('&end_time','DD-MON-YYYY HH24:MI:SS') -- ENTER TO DATE/TIME like 16-DEC-2008 11:00:00
-- AND FCP.APPLICATION_ID in (724,723) -- isolates ASCP (MSC, MSO) programs -- use 722 for MSD, 704 for MRP
-- AND fcr.requested_by = &user_id
order by 8;


UR's Key Run ;-) 

To check Conc Req Status

To check Conc Req Status :

set linesize 120
set pagesize 50
col phase_code for a20
col status_code for a20
select request_id,
decode(phase_code,'C','Completed','I','Inactive','P','Pending','R', 'Running ') PHASE_CODE,decode(status_code,
'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') STATUS_CODE from apps.fnd_concurrent_requests where request_id='&REQUESTID';

REQUEST_ID PHASE_CODE           STATUS_CODE
---------- -------------------- --------------------
    123456 Completed            Normal

UR's Key Run ;-) 

Thursday, July 28, 2011

2 ways 2 clear Cache:

2 ways 2 clear Cache:

 1) Restart Apache

or

2) Manually clear Java Cache using the "Functional Administrator" responsibility

Login with 'Functional Administrator' responsibility
Navigate to Core Service -> Caching Framework -> Global Configuration
Click on 'Clear All Cache'

UR's Key Run ;-) 

User Info


Responsibilities assigned to USER

set linesize 155;
set pagesize 200;
set verify off;

column USER_ID format 9999999999;
column RESP_ID format 9999999999;
column RESP_NAME format a60;
column RESP_APP_ID format 9999999999;
column SEC_GRP_ID format 9999999999;

select fu.user_id, fo.RESPONSIBILITY_ID resp_id, RESPONSIBILITY_NAME resp_name, fo.RESPONSIBILITY_APPLICATION_ID resp_app_id, fo.SECURITY_GROUP_ID sec_grp_id
from fnd_user_resp_groups fo, fnd_responsibility_vl fv, fnd_user fu
where fu.user_id=fo.user_id
and fu.user_name='&USER_NAME'
and fo.RESPONSIBILITY_ID=fv.RESPONSIBILITY_ID
and fo.RESPONSIBILITY_APPLICATION_ID=fv.APPLICATION_ID;

UR's Key Run ;-) 

Increment date parameters each run


Navigation : Concurrent -> Request -> Run --- Click on "Schedule" Tab

Option : "Increment date parameters each run" while scheduling a Conc Request.

Some time we will get a requirement to schedule Conc Requests that take "Date" as one of the parameters.
By default when we schedule such requests Data filed defaults to SYSDATE. But we need the date to be always the system date at that point of time when ever the scheduled prog  runs. Then we need to check this option. Otherwise, its an optional option.

For eg : Today I am scheduling a Conc Request "Close WIP Jobs" to run every Sunday Mid Night 01:00 am and the Conc Request takes "Date" as one of the arguments as this prog is to close all open WIP jobs till that time since last run. ie. For eg  if this needs runs on 2nd July, 9th Jul, 16th Jul weekly and when even it runs it has to take the current date ie when it run on 2nd then it has to automatically increment date parameter to 2nd so that it can close the WIP jobs till that day and when its runs on 9th..it has to again automatically increment date as 9th Jul instead of 2nd July so that it call close all that WIP jobs till that date and time.

In such cases this option helps you.

Ref Note : 1245684.1


UR's Key Run ;-) 

Primary Key

Steps of find the type of Primary Key Involved :

1. Find out the type of the object

select object_name, object_type from all_objects where object_name = upper('<p_object_name>');

2. To fetch the primary key name corresponding to the index/table name from the error message.

Index

select primary_key_name
from fnd_primary_keys
where application_id=283
and table_id = (select table_id from fnd_indexes
where application_id=283 and index_name = upper('<p_object_name>'));

or

Table

select primary_key_name
from fnd_primary_keys
where application_id=283
and table_id = (select table_id from fnd_tables
where application_id=283 and table_name = upper('<p_object_name>'));

3. Check the involved primary key
select primary_key_type
from fnd_primary_keys where primary_key_name = upper('<p_primary_key_name>');


To get Primary Keys info on set of tables:

select pk.primary_key_type TYPE,
pk.application_id APPID,
pk.primary_key_name
from fnd_primary_keys pk,fnd_tables t
where t.application_id >= 0
and t.table_name in ('ABC','DEF',
'GHI','KLM')
and pk.application_id = t.application_id
and pk.table_id = t.table_id;

TYPE    APPID         PRIMARY_KEY_NAME             
____   _______         ___________________    
S           123             PQR_PK    
D           123             LMN_PK
D           123             XYZ_PK 
D           123             123_PK

If in case required to change/update the type of  key

UPDATE fnd_primary_keys
SET primary_key_type = 'D'
WHERE primary_key_name = upper('PQR_PK');

COMMIT;

UR's Key Run ;-) 

100% Mount Pt

Commands tht Helps :

cd <source directory>
find . -type f -mtime +30 | cpio -pd <destination directory>    
- Copies 30days above old files to <destination directory> 

find . -type f -mtime +90 -exec mv {} <destination directory> \;
-    Moves all the 90+ days old data to <destination directory> 

find . -type f -mtime +30 -exec rm -f {} \;          - Deletes 30days Old files

Scenario:

Mount pt reaching 100% full

[oraplayers21:ORAPLAYERS:applmgr]$df -h /oraplayers/common

ora-players:/oraplayers-common
                       150G   148G   2G    99%    /oraplayers/common

-    Moved all the 90+ days old data in “$APPLCSF/log” to a temp location  “/oplayers/admin/kiran/applcsf_log_90daysold” using the below cmd

[oraplayers21:ORAPLAYERS:applmgr]$ find . -type f -mtime +90 -exec mv {} /oplayers/admin/kiran/applcsf_log_90daysold \;
[oraplayers21:ORAPLAYERS:applmgr]$

ora-players:/oraplayers-common   150G   138G    13G    92%    /oraplayers/common

UR's Key Run ;-) 

Printers @ OS Level

To check printer available or not : lpstat -l -p printername

[oraplayers:ORAPLAYERS:apploplayers]$ lpstat -lp PRINTER_NAME
printer PRINTER_NAME is idle. enabled since Thu Apr 28 04:42:04 2011. available.
        Form mounted:
        Content types: application/octet-stream
        Description:
        Printer types: unknown
        Connection: direct
        Interface: /usr/lib/lp/model/netstandard
        After fault: continue
        Users allowed:
                (all)
        Forms allowed:
                (none)
        Media supported:
                (none)
        Banner page never printed
        Character sets:
                (none)
        Default pitch:
        Default page size:
        Default port setting:
        Options: dest= oraplayers.blog.com:9100, protocol=tcp, timeout=60

[oraplayers:ORAPLAYERS:apploplayers]$

Status : lpc status printername

[oraplayers:ORAPLAYERS:apploplayers]$ lpc status PRINTER_NAME
PRINTER_NAME:
        queueing is enabled
        printing is disabled
        0 entries in spool area
[oraplayers:ORAPLAYERS:apploplayers]$

To list the printer Jobs : lpstat -o printername

[oraplayers:ORAPLAYERS:apploplayers]$ lpstat -o PRINTER_NAME
PRINTER_NAME-3619          apploplayers@oraplayers    1001   Jul 22 03:29
PRINTER_NAME-3649          apploplayers@oraplayers    1001   Jul 22 03:31
PRINTER_NAME-3693          apploplayers@oraplayers    1001   Jul 22 03:35
PRINTER_NAME-3725          apploplayers@oraplayers    1001   Jul 22 03:38
PRINTER_NAME-3760          apploplayers@oraplayers    1001   Jul 22 03:41
PRINTER_NAME-3853          apploplayers@oraplayers    1001   Jul 22 03:56
PRINTER_NAME-3908          apploplayers@oraplayers    1001   Jul 22 04:02
PRINTER_NAME-3931          apploplayers@oraplayers    1001   Jul 22 04:05
PRINTER_NAME-3953          apploplayers@oraplayers    1001   Jul 22 04:08
PRINTER_NAME-3978          apploplayers@oraplayers    1001   Jul 22 04:11
PRINTER_NAME-4013          apploplayers@oraplayers    1001   Jul 22 04:17
PRINTER_NAME-4082          apploplayers@oraplayers    1001   Jul 22 04:28
PRINTER_NAME-4107          apploplayers@oraplayers    1001   Jul 22 04:35
PRINTER_NAME-4213          apploplayers@oraplayers    1001   Jul 22 04:50
PRINTER_NAME-4343          apploplayers@oraplayers    1001   Jul 22 05:05
PRINTER_NAME-4364          apploplayers@oraplayers    1001   Jul 22 05:08
PRINTER_NAME-4411          apploplayers@oraplayers    1001   Jul 22 05:14
PRINTER_NAME-4433          apploplayers@oraplayers    1001   Jul 22 05:20
PRINTER_NAME-4446          apploplayers@oraplayers    1001   Jul 22 05:23
PRINTER_NAME-4470          apploplayers@oraplayers    1001   Jul 22 05:26
PRINTER_NAME-4496          apploplayers@oraplayers    1001   Jul 22 05:29
PRINTER_NAME-4521          apploplayers@oraplayers    1001   Jul 22 05:32
PRINTER_NAME-4571          apploplayers@oraplayers    1001   Jul 22 05:41
PRINTER_NAME-4597          apploplayers@oraplayers    1001   Jul 22 05:44
PRINTER_NAME-4613          apploplayers@oraplayers    1001   Jul 22 05:47
PRINTER_NAME-5021          apploplayers        133050   Apr 27 11:11
PRINTER_NAME-5022          apploplayers        133050   Apr 27 11:51
[oraplayers:ORAPLAYERS:apploplayers]$

Cancel Printer Job: cancel JOBID

[oraplayers:ORAPLAYERS:apploplayers]$ cancel PRINTER_NAME-3649
PRINTER_NAME-3649: cancelled

To cancel multiple jobs/ stuck jobs : cancel <jobid 1> <jobid 2>

[oraplayers:ORAPLAYERS:apploplayers]$ cancel PRINTER_NAME-3725 PRINTER_NAME-3760 PRINTER_NAME-3853 PRINTER_NAME-3908 PRINTER_NAME-3931 PRINTER_NAME-3953 PRINTER_NAME-3978 PRINTER_NAME-4013 PRINTER_NAME-4082 PRINTER_NAME-4107 PRINTER_NAME-4213 PRINTER_NAME-4343 PRINTER_NAME-4364 PRINTER_NAME-4411 PRINTER_NAME-4433 PRINTER_NAME-4446 PRINTER_NAME-4470 PRINTER_NAME-4496 PRINTER_NAME-4521 PRINTER_NAME-4571 PRINTER_NAME-4597 PRINTER_NAME-4613
PRINTER_NAME-3725: cancelled
PRINTER_NAME-3760: cancelled
PRINTER_NAME-3853: cancelled
PRINTER_NAME-3908: cancelled
PRINTER_NAME-3931: cancelled
PRINTER_NAME-3953: cancelled
PRINTER_NAME-3978: cancelled
PRINTER_NAME-4013: cancelled
PRINTER_NAME-4082: cancelled
PRINTER_NAME-4107: cancelled
PRINTER_NAME-4213: cancelled
PRINTER_NAME-4343: cancelled
PRINTER_NAME-4364: cancelled
PRINTER_NAME-4411: cancelled
PRINTER_NAME-4433: cancelled
PRINTER_NAME-4446: cancelled
PRINTER_NAME-4470: cancelled
PRINTER_NAME-4496: cancelled
PRINTER_NAME-4521: cancelled
PRINTER_NAME-4571: cancelled
PRINTER_NAME-4597: cancelled
PRINTER_NAME-4613: cancelled
[oraplayers:ORAPLAYERS:apploplayers]$

To give print from OS level:

Create a file with some text for testing. In this case file is “a”

[oraplayers:ORAPLAYERS:apploplayers]$ lp -d PRINTER_NAME a
request id is PRINTER_NAME-5031 (1 file(s))

-    Check the print is cmg or not?

Note :

[oraplayers:ORAPLAYERS:apploplayers]$ lpstat -o|grep PRINTER_NAME
[oraplayers:ORAPLAYERS:apploplayers]$

-    This cmd only list the printer name..if any job of that printer in Q. So always to check whether printer is there are not @ OS level below cmd

Best way to Check Printer Configured/Status @ OS Level

lpstat -lp PRINTER_NAME

UR's Key Run ;-) 

Wednesday, July 27, 2011

TOKEN in Concurrent -> Program -> Define -> Parameters


"TOKEN" field will be enabled by default for programs whose Executable Method is "Oracle Reports" or "Java Concurrent Program" in the  Concurrent -> Program -> Define -> Parameters screen.

This helps in passing/linking the the aguments passed in the submit screen to the executable/script.


UR's Key Run ;-) 

Tuesday, July 26, 2011

Locks & Only Locks


LOCKS :

To Checks the Locks @ Instance Level:

set linesize 300
set pagesize 300
SELECT lh.inst_id Locking_Inst, lh.sid Locking_Sid, lw.inst_id Waiting_Inst,
lw.sid Waiter_Sid,
 decode ( lh.type, 'MR', 'Media_recovery', 'RT', 'Redo_thread', 'UN', 'User_name', 'TX', 'Transaction',
'TM', 'Dml', 'UL', 'PLSQL User_lock', 'DX', 'Distrted_Transaxion', 'CF', 'Control_file', 'IS',
'Instance_state', 'FS', 'File_set', 'IR', 'Instance_recovery', 'ST', 'Diskspace Transaction',
'IV', 'Libcache_invalidation', 'LS', 'LogStaartORswitch', 'RW', 'Row_wait', 'SQ', 'Sequence_no', 'TE', '
Extend_table', 'TT', 'Temp_table', 'Nothing-' ) Waiter_Lock_Type,
decode ( lw.request, 0, 'None', 1, 'NoLock', 2, 'Row-Share', 3, 'Row-Exclusive', 4,
'Share-Table', 5, 'Share-Row-Exclusive', 6, 'Exclusive', 'Nothing-' ) Waiter_Mode_Req
FROM gv$lock lw, gv$lock lh
WHERE lh.id1=lw.id1 AND lh.id2=lw.id2
AND lh.request=0 AND lw.lmode=0
AND (lh.id1,lh.id2) in
    ( SELECT id1,id2 FROM gv$lock WHERE request=0 INTERSECT SELECT id1,id2 FROM gv$lock WHERE lmode=0 )
/


Above query gives you the SID's of the Locks.

Now U need to get the SPID's/Unix OS ID's for the same using the below Query:

select spid from v$process where addr
=(select paddr from v$session where sid =&sid)
/


Now, give the SPID as input for the next query to get detailed info of the Locks.

Details Like :

SID, Serial#
Session Info : Is that a Form Session or SQL
User Info
STATUS : Active / Inactive


set echo off
set serveroutput on size 999999
set verify off
set feedback off
accept uxproc prompt 'Enter Unix process id: '
DECLARE
  v_sid number;
  vs_cnt number;
  s sys.v_$session%ROWTYPE;
  p sys.v_$process%ROWTYPE;
  cursor cur_c1 is select sid from sys.v_$process p, sys.v_$session s  where  p.addr  = s.paddr and  (p.spid =  &uxproc or s.process = '&uxproc');
BEGIN
    dbms_output.put_line('=====================================================================');
select nvl(count(sid),0) into vs_cnt from sys.v_$process p, sys.v_$session s  where  p.addr  = s.paddr and  (p.spid =  &uxproc or s.process = '&uxproc');
dbms_output.put_line(to_char(vs_cnt)||' sessions were found with '||'&uxproc'||' as their unix process id.');
dbms_output.put_line('=====================================================================');
open cur_c1;
LOOP
      FETCH cur_c1 INTO v_sid;  
   EXIT WHEN (cur_c1%NOTFOUND);
select * into s from sys.v_$session where sid  = v_sid;
  select * into p from sys.v_$process where addr = s.paddr;
dbms_output.put_line('SID/Serial  : '|| s.sid||','||s.serial#);
  dbms_output.put_line('Foreground  : '|| 'PID: '||s.process||' - '||s.program);
  dbms_output.put_line('Shadow      : '|| 'PID: '||p.spid||' - '||p.program);
  dbms_output.put_line('Terminal    : '|| s.terminal || '/ ' || p.terminal);
  dbms_output.put_line('OS User     : '|| s.osuser||' on '||s.machine);
  dbms_output.put_line('Ora User    : '|| s.username);
dbms_output.put_line('Details     : '|| s.action||' - '||s.module);
  dbms_output.put_line('Status Flags: '|| s.status||' '||s.server||' '||s.type);
  dbms_output.put_line('Tran Active : '|| nvl(s.taddr, 'NONE'));
  dbms_output.put_line('Login Time  : '|| to_char(s.logon_time, 'Dy HH24:MI:SS'));
  dbms_output.put_line('Last Call   : '|| to_char(sysdate-(s.last_call_et/60/60/24), 'Dy HH24:MI:SS') || ' - ' || to_char(s.last_call_et/60, '99990.0') || ' min');
  dbms_output.put_line('Lock/ Latch : '|| nvl(s.lockwait, 'NONE')||'/ '||nvl(p.latchwait, 'NONE'));
  dbms_output.put_line('Latch Spin  : '|| nvl(p.latchspin, 'NONE'));
  dbms_output.put_line('Current SQL statement:');
for c1 in ( select * from sys.v_$sqltext  where HASH_VALUE = s.sql_hash_value order by piece)
loop
    dbms_output.put_line(chr(9)||c1.sql_text);
  end loop;
dbms_output.put_line('Previous SQL statement:');
  for c1 in ( select * from sys.v_$sqltext  where HASH_VALUE = s.prev_hash_value order by piece)
loop
    dbms_output.put_line(chr(9)||c1.sql_text);
  end loop;
dbms_output.put_line('Session Waits:');
  for c1 in ( select * from sys.v_$session_wait where sid = s.sid)
loop
    dbms_output.put_line(chr(9)||c1.state||': '||c1.event);
  end loop;
--  dbms_output.put_line('Connect Info:');
--  for c1 in ( select * from sys.v_$session_connect_info where sid = s.sid) loop
--    dbms_output.put_line(chr(9)||': '||c1.network_service_banner);
--  end loop;
  dbms_output.put_line('Locks:');
  for c1 in ( select  /*+ RULE */ decode(l.type,
          -- Long locks
                      'TM', 'DML/DATA ENQ',   'TX', 'TRANSAC ENQ',
                      'UL', 'PLS USR LOCK',
          -- Short locks
                      'BL', 'BUF HASH TBL',  'CF', 'CONTROL FILE',
                      'CI', 'CROSS INST F',  'DF', 'DATA FILE   ',
                      'CU', 'CURSOR BIND ',
                      'DL', 'DIRECT LOAD ',  'DM', 'MOUNT/STRTUP',
                      'DR', 'RECO LOCK   ',  'DX', 'DISTRIB TRAN',
                      'FS', 'FILE SET    ',  'IN', 'INSTANCE NUM',
                      'FI', 'SGA OPN FILE',
                      'IR', 'INSTCE RECVR',  'IS', 'GET STATE   ',
                      'IV', 'LIBCACHE INV',  'KK', 'LOG SW KICK ',
                      'LS', 'LOG SWITCH  ',
                      'MM', 'MOUNT DEF   ',  'MR', 'MEDIA RECVRY',
                      'PF', 'PWFILE ENQ  ',  'PR', 'PROCESS STRT',
                      'RT', 'REDO THREAD ',  'SC', 'SCN ENQ     ',
                      'RW', 'ROW WAIT    ',
                      'SM', 'SMON LOCK   ',  'SN', 'SEQNO INSTCE',
                      'SQ', 'SEQNO ENQ   ',  'ST', 'SPACE TRANSC',
                      'SV', 'SEQNO VALUE ',  'TA', 'GENERIC ENQ ',
                      'TD', 'DLL ENQ     ',  'TE', 'EXTEND SEG  ',
                      'TS', 'TEMP SEGMENT',  'TT', 'TEMP TABLE  ',
                      'UN', 'USER NAME   ',  'WL', 'WRITE REDO  ',
                      'TYPE='||l.type) type,
         decode(l.lmode, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',
                       4, 'S',    5, 'RSX',  6, 'X',
                       to_char(l.lmode) ) lmode,
          decode(l.request, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',
                         4, 'S', 5, 'RSX', 6, 'X',
                         to_char(l.request) ) lrequest,
        decode(l.type, 'MR', o.name,
                      'TD', o.name,
                      'TM', o.name,
                      'RW', 'FILE#='||substr(l.id1,1,3)||
                            ' BLOCK#='||substr(l.id1,4,5)||' ROW='||l.id2,
                      'TX', 'RS+SLOT#'||l.id1||' WRP#'||l.id2,
                      'WL', 'REDO LOG FILE#='||l.id1,
                      'RT', 'THREAD='||l.id1,
                      'TS', decode(l.id2, 0, 'ENQUEUE', 'NEW BLOCK ALLOCATION'),
                      'ID1='||l.id1||' ID2='||l.id2) objname
        from  sys.v_$lock l, sys.obj$ o
        where sid   = s.sid
          and l.id1 = o.obj#(+) )
loop
  dbms_output.put_line(chr(9)||c1.type||' H: '||c1.lmode||' R: '||c1.lrequest||' - '||c1.objname);
  end loop;
dbms_output.put_line('=====================================================================');
END LOOP;
dbms_output.put_line(to_char(vs_cnt)||' sessions were found with '||'&uxproc'||' as their unix process id.');
dbms_output.put_line('Please scroll up to see details of all the sessions.');
dbms_output.put_line('=====================================================================');
  close cur_c1;
exception
    when no_data_found then
      dbms_output.put_line('Unable to find process id &&uxproc!!!');
 dbms_output.put_line('=====================================================================');
      return;
    when others then
      dbms_output.put_line(sqlerrm);
      return;
END;
/
undef uxproc
set heading on
set verify on
set feedback on
set echo on


Now U can kill the inactive session using below query:

alter system kill session 'SID,Serial#';

before doing this you can send mail to user creating lock to logout his session so that Locks are released.

If any one confirms that this can be killed...using the above query you can do that.

UR's Key Run ;-) 

Monday, July 25, 2011

Opatch Roll Back Issues


Issue : opatch rollback failed because files under patch_storage are missing

Error :

Archive Action: Source file "/ora-players/oracle/product/102/.patch_storage/4966417_Mar_12_2007_03_46_16/files/lib/libgeneric10.a/kgl.o" does not exist.

'oracle.rdbms, 10.2.0.3.0': Cannot update file '/ora-players/oracle/product/102/lib/libgeneric10.a' with '/kgl.o'

RollbackSession failed during prerequisite checks: Prerequisite check
"CheckRollbackable" failed.
System intact, OPatch will not attempt to restore the system

OPatch failed with error code 74

Fix:

Try roll backing the patch as below
opatch rollback -id <sub-set patch#> -no_sysmod

-no_sysmod options just removes the patch updating the inventory with out updating the files in the File System.

UR's Key Run ;-) 

Sunday, July 24, 2011

/where/is/d/logs.log



Daemon's nd their Logs :

Cluster Ready Services Daemon (crsd)                  $CRS_HOME/log/host_name/crsd
Oracle Cluster Registry (OCR)                              $CRS_HOME/log/host_name/client
Oracle Process Monitor Daemon (OPROCD)        /etc/oracle/host_name.oprocd.log
Cluster Synchronization Services (CSS)                 $CRS_HOME/log/host_name/cssd
Event Manager (EVM) logs                                   $CRS_HOME/log/host_name/evmd

UR's Key Run ;-) 

SRVCTL

Add/ Start/ Knw the Services using SRVCTL :

2 Add Service :

$srvctl add service -d ORAPLAYERS -s SERVICE_NAME -r ORAPLAYERS1,ORAPLAYERS2 -a ORAPLAYERS3

Note : Here -r indicate the instance(s) the services will preferably directs to where as -a indicates the Instance where it will direct to if preferred instances are not accessible.

Tip : Using -r -a options you can make certain jobs to run on a particular instance by assigning them to a service defined in the way you like.

2 Start Service :

$srvctl start service -d ORAPLAYERS -s SERVICE_NAME

2 know the Services running per instance in detail:

$srvctl config service -d ORAPLAYERS

2 knw the running Jobs

dba_scheduler_jobs

2 knw where they r running

dba_scheduler_running_jobs

UR's Key Run ;-) 

Query to check d Code Levels Application Level

Query to check d Code Levels @ Application Level

Run


@$AD_TOP/sql/adutconf.sql

A file will be generated as adutconf.lst

Tip : If you r facing any issue in an upgraded instance and you would like to have exact data of difference @ Instance level, best way is to generate adutconf.lst in both upgraded and non-upgraded instances and compare.

UR's Key Run ;-) 

Identify Request Trace file


Get Ur Conc Req Trace File as below :

sql>select value from v$parameter where name='user_dump_dest';

Run the following sql:--

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;

select oracle_id from fnd_concurrent_requests where request_id = &req_id;


UR's Key Run ;-) 

OHASD Daemon 4m 11g R2 RAC


Oracle High Availability Services (OHAS) is a new process introduced in 11g RAC ( 11g R2 ). Implemented via a new demon Oracle High Availability Services Daemon ( OHASD ).


The background proc involved are :-
Grid Plug and Play (GPNPD): 
Grid Interprocess Communication (GIPC)
Multicast Domain Name Service (mDNS)
Oracle Grid Naming Service (GNS


Health Check :
$crsctl check has
CRS-4638: Oracle High Availability Services is online



UR's Key Run ;-) 

Friday, July 1, 2011

Learning Process or Teaching Process for Oracle Apps Learners


What is an ERP?
Why we need ERP?  - Evolution


Oracle Apps ( called as E-Business Suite )

- Main Versions available  11i/R12
- Architecture (  3 Tier Arch - Desktop Tier, Middle Tier, DB Tier )

  - Explain each Tier and its Components
 
Desktop Tier ( Browser, Jinitiator )
Middle Tier  ( Web Server, Forms Server, Reports Server, Concurrent Manager Server, Admin Server, Discoverer Server )
DB Tier      ( Database )
    - Also add Listener serviecs in MT ( Web Listener T Application Listener ) & DB  ( DB Listerner )
- Listener Importance

  - Explain here Request flow and how its processed briefly
  - Explain how Servers Communicates Other

- File System [ Apps Tier ( APPL_TOP, COMMON_TOP, ORA_TOP ), DB Tier ( DB_TOP )]

  - Explain each TOP and y they are named like that? Logic behind d grouping

  - Oracle Homes ( Total 3 : Middle Tier 2 ( iAS Oracle Home or 9i Home & 8.0.6 Oracle Home or Developer Home ) DB Tier 1 ( DB Oracle Home )

  - Explain each Home

  - Files  Types of Files ( Environment Files, Configuration Files, Executables, Templates, Drivers, XML files, Script Files ( .sh files to control services ) )
 
- Here you can add point of Executables for each services like Apache/Web - httpd, Reports - rwmts60, Conc Mgr - FNDLIBR, Forms - f60webmx, f60srvm
- Also tell abt tnsfiles ( tnsnames.ora, listener.ora )

  - Explain each type of Files

Installation of 11i

- Space Requirement
- OS Requirement
- Users
- Stage ( Wt is stage? and How to create stage ? )
- Installation ( Single node or Multi Node Env ? Diff ? )

Additionally

- MD120 ( Wht is it ? nd How its Useful )
- Also u can tell here abt SLA ( Service Level Agreement )
- Serverity Priority of Tickets.

Explain Elaborately Conc MGR ( if possible )

- like Type of Conc Mgr ( Standard, ICM, Txn Mgr, CRM etc )


- Administration of E Business Suite

- AD tools ( adadmin, adconfig.sh, adpatch.sh, adlicmgr.sh etc )
- Service Control Scripts ( adapcctl.sh, adfrmctl.sh, adrepctl.sh etc )
- Autoconfig ( What & How )

Bug Fixes/ Enhancements

- Patching ( Y nd Wt? )
- Types of Patches ( One Off, Min Pack, Familiy Pack, Maintenance Pack Patches, Diagnoistic Patches & Database Patches )
- How to apply ( adpatch in MT , opatch.sh in DB )
- Where we get patches ? support.oracle.com

Cloning

- Y nd What ?
- Rapid Clone ( adpreclone.pl & adcfgclone.pl )
- Manual Clone

Backup

- Cold Backup
- Hot Backup

UR's Key Run ;-)