Tuesday, August 28, 2012

Making Read-Only responsibilities OKS

For decommissioning work one may require to change transactional responsibilities to Read-Only or Inquiry
Below are steps that can be followed for Order Contracts module i.e OKS

_______________________________________________
MAKING existing OKS responsibility to read-only
_______________________________________________

Using "Service Contracts XX Manager" responsibility

    1)Navigate > Setup > Contract  > Categories and Sources > Define Categories
    2)Enter Query (F11)  and category "Warranty and Extended Warranty"
    3)Crtl - F11 (This will query the Warranty and Extended Warranty categories)
    4) Click on the Responsibilities Tab
    5) Click on the Access Level Dropdown for "OKS XX Manager" responsibility
    6) Update the level to "Read Only"
    7) Save the Record.

Using "System Administrator" responsibility
       1) Navigation Responsibility > Define > Query "OKS XX Manager"
       2) Add Menu Exclusion for function "Update Online" 
       3)Save the changes


Sunday, June 17, 2012

Query Performance

Do you know columns in selection list affect use of index on table..??

I couldn't  believe this..I was always under impression that query plan is decided based on from and where clause and select clause has no impact on index usage. I was proved wrong in the Smoke Test for INT2 at midnight yesterday..

See how...

select trx_number, org_id, interface_header_attribute1      
          from ra_customer_trx_all
          where org_id = 112 
         
Plan
SELECT STATEMENT  ALL_ROWSCost: 1,947  Bytes: 219,538  Cardinality: 9,979     
    1 TABLE ACCESS FULL TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1,947  Bytes: 219,538  Cardinality: 9,979 



select trx_number, org_id      
          from ra_customer_trx_all
          where org_id = 112
         
Plan
SELECT STATEMENT  ALL_ROWSCost: 551  Bytes: 129,727  Cardinality: 9,979     
    1 INDEX SKIP SCAN INDEX AR.RA_CUSTOMER_TRX_N1 Cost: 551  Bytes: 129,727  Cardinality: 9,979 
        
Ultimately the solution to this performance issue was add one more table to query... Interesting huh?

bad query
select trx_number
          from ra_customer_trx_all
          where 1=1
          and interface_header_attribute1 = to_char(pin_order_number)
          and org_id = v_Header_Rec_Type.org_id
          and rownum = 1;

Good query

select trx_number      
          from apps.ra_customer_trx_all rct, apps.ra_customer_trx_lines_all rctl
          where rct.customer_trx_id = rctl.customer_trX_id
            and rctl.sales_order = to_char(66000120)
            and rct.org_id = 112
            and rownum < 2;

Wednesday, June 13, 2012

Materialized View with Fast Refresh idea

Complete refresh for materialized views may not be time effective in all cases. Moreover if the changes to data are minimal Fast refresh should be used and scheduled frequently using cron job or dbms_job.

I faced issue as there was no primary key on underlying table to create materialized view. I was under impression that there must be primary key. However there is an idea to beat this..

We can create materialized view based on rowid column as well

Below are the scripts

---------------- on Web DB  -------------------

create materialized view log on subscription.xxrh_subscription with rowid excluding new values;

grant select on subscription.MLOG$_xxrh_subscription to web;



----------------- On R12EBS environment in Web Schema  ---------------

CREATE MATERIALIZED VIEW web.xxrh_subscription_mv tablespace web_data
    REFRESH FAST ON DEMAND WITH ROWID AS
    SELECT *
    FROM subscription.xxrh_subscription@WEB_LINK;

CREATE INDEX web.XXRH_SUBSCRIPTION_MV_IDX1 ON web.XXRH_SUBSCRIPTION_MV(ORACLE_ACCOUNT_NUMBER) tablespace web_indx;

ThanksAnil Prodduturi for this knowledge!

Tuesday, June 12, 2012

ORA-04021 Timeout when compiling package

Sometimes we face timeout error ORA-04021 when trying to compile existing package.

Following steps can help to get rid of the error.
1) Find who is accessing the object using below sql
     SELECT * FROM v$access WHERE object = 'XXRH_SUPX_ORCL_PKG';

2) Check session details using below query. SID will be from the result of above query
    SELECT * FROM V$SESSION WHERE SID IN (1040,1529,1016)

3) Kill the session which is accessing the package . Ensure that you inform osuser of these session before you kill them!
   ALTER SYSTEM KILL SESSION '1016,58335'

Go ahead with package compilation!




Thursday, May 31, 2012

Unix Find and Replace

Find and replace particular text from script .
This is useful in any install shell scripts which need paths in LDT to be changed based on instance 

mv testfindrep.sh testfindrep.old
sed 's/ebstdev/ebstst1/g' testfindrep.old > testfindrep.sh

Here
s means substitute
ebstdev expr to find
ebstst1 expr to replace with

g means globally - find all

> redirects output to the file


What are default parameters for Concurrent Program / Request Set

Use below queries to get all programs with specific default value, set as parameter value. i.e. You know default value and need to search programs using it
This is useful to find programs having paths defaulted

--- Query to get default parameters for all concurrent programs

SELECT fcp.user_concurrent_program_name, fcp.concurrent_program_name,
       fdfcu.end_user_column_name, fdfcu.DEFAULT_VALUE
  FROM fnd_descr_flex_column_usages fdfcu, fnd_concurrent_programs_vl fcp
 WHERE fcp.concurrent_program_name =
                          REPLACE (fdfcu.descriptive_flexfield_name, '$SRS$.')
   AND fdfcu.DEFAULT_VALUE LIKE '/opt/apps%'   
  
-- Query to get default parameters for all concurrent request sets
SELECT frsv.user_request_set_name, frspa.descriptive_flexfield_name,
       fdfcu.end_user_column_name, frspa.DEFAULT_VALUE
  FROM fnd_request_set_program_args frspa,
       fnd_request_sets_vl frsv,
       fnd_descr_flex_column_usages fdfcu
 WHERE 1 = 1
   AND frspa.DEFAULT_VALUE LIKE '/opt%'
   AND frspa.request_set_id = frsv.request_set_id
   AND fdfcu.descriptive_flexfield_name = frspa.descriptive_flexfield_name
   AND frspa.application_column_name = fdfcu.application_column_name

Setting Operating Unit Mode mo_global.get_current_org_id

In R12 Development, we are using mo_global.get_current_org_id profile in parameters to get default value based on operating unit.
But Most of the cases these values returning null.

Ex: techwah, techwah HK/CN programs.
 
Application Way of doing it is
 
 
Please go to System Administration --Concurrent programs-- Go to Request tab --Select Operating Unit value as Single or Multiple.

This will stamp multi_org_category in fnd_concurrent_programs . 



In case of some restrictions.. backend update also can be used

For this, from back end  we need to run below query or from application  we need to update multi org category from system administration responsibility for that particular concurrent program .

update fnd_concurrent_programs 
set multi_org_category = 'S'
where concurrent_program_name = <conc prog name>