Showing posts with label query. Show all posts
Showing posts with label query. Show all posts

Wednesday, July 6, 2016

JRAD doc queries

Very useful which can help you find lot of issues related to missing intl txt or publication issue or identify corrupted ui template

--Debug the missing intl_text_id, find it in attribute values
select * from JDR_ATTRIBUTES where att_value like '%8581175%';

--use above component id to get document name
select jdr_mds_internal.getdocumentname(95614) from dual;

--use this to find the template element causing issue by checking sequence id
select * from jdr_components where comp_docid in (95614);

--use above jdr document name to find the content template
select * from cz_ui_templates where jrad_doc='/oracle/apps/cz/runtime/oa/webui/templates/regions/6448_162';

--check which page is referring this template
select * from cz_ui_page_elements where ctrl_template_id=6448;


select * from cz_localized_texts where localized_str like '%';

select * from cz_ui_defs where ui_Def_id in (62791);

select * from cz_ui_templates where ui_Def_id in (62791);

select * from fnd_new_messages where message_text like '%Message Text Here%';

Saturday, November 30, 2013

Update Java Extension ClassName for Configurator CX rules using query

Following query will update the java classname (from xxcz.cx.MyOldClass to xxcz.cx.MyNewClass ) for all the models which are under repository folder name 'Models - In Process'

UPDATE cz_rules ru
SET ru.class_name        = 'xxcz.cx.MyNewClass'
WHERE exists(SELECT
  rpf.name folder_name,
  p.name model_name,
  p.devl_project_id,
  r.name rule_name,
  r.rule_id,
  r.class_name
FROM cz_rules r,
  cz_devl_projects p,
  cz_rp_entries rpp,
  cz_rp_entries rpf
WHERE r.devl_project_id=p.devl_project_id
AND r.rule_type = 300 -- CX rules
AND rpp.object_id       =p.devl_project_id
and rpp.enclosing_folder = rpf.object_id
AND rpp.object_type     ='PRJ'
AND R.DISABLED_FLAG=0  --update only enabled rules
AND rpf.object_type = 'FLD'
--AND P.DEVL_PROJECT_ID=1037298 --add this if you want to update specific model only
AND class_name LIKE 'xxcz.cx.MyOldClass'
AND RPF.NAME LIKE 'Models – In Process'
AND r.rule_id=ru.rule_id
);

Friday, August 30, 2013

BOM: Enable/Disable Bill Item Deletion Constraint

When we want to delete some times from BOM structure, we may get error that BOM is actively used in open orders and cannot be deleted. There are few constraints which restricts BOM item deletion. Once you get that constraint name, you can disable them temporarily from back-end using SQL queries and enable them again once deletion is complete. Of course it will create problems when the orders are referring them, but who cares when you are really in testing phase and want to delete few items from BOM before going live. This will be handy in such cases.

UPDATE  BOM_DELETE_SQL_STATEMENTS 
SET ACTIVE_FLAG=1
WHERE (SQL_STATEMENT_NAME LIKE 'CMP_CON5');

Set ACTIVE FLAG=1 for Enabling the constraint
Set ACTIVE FLAG=2 for Disabling the constraint
You can get sql_statement_name from the constraint error that you have received.

Sunday, June 2, 2013

Configurator: Query to get list of published models

In Configurator publication target instance, we can use following query to get list of all models published to this instance which are currently active.

SELECT si.segment1 item_name, 
   mp.publication_id,
   mp.remote_publication_id,
   mp.model_id,
   mp.top_item_id,
   mp.organization_id,
   mp.last_update_date,
   mp.product_key,
   round((sysdate - mp.last_update_date), 2) as days_ago,
   round((sysdate - mp.last_update_date)*24, 2) as hours_ago,
   round((sysdate - mp.last_update_date)*24*60, 2) as mins_ago
FROM cz_model_publications mp,
   mtl_system_items_b si
WHERE 1 =1
   AND mp.top_item_id = si.inventory_item_id
   AND si.organization_id = mp.organization_id
   AND deleted_flag =0
   AND disabled_flag =0
   AND sysdate BETWEEN applicable_from AND applicable_until
   AND export_status ='OK'
   AND object_type ='PRJ'
   AND source_target_flag ='T'  --only target publications
   AND publication_mode ='p'  --list publications in Production model, replace with 't' for Test mode
   --and mp.server_id=1700  --you would need this if multiple sources were publishing to current instance in past
   --and round((sysdate - mp.last_update_date)*24, 2) < 5 --to restrict the result to last N days publications
   --and si.segment1 like 'Laptop55%' --uncomment to get details for specific models
ORDER BY last_update_date desc;

Wednesday, April 24, 2013

Query to extract Oracle Configurator CX rule information - 2

Earlier post regarding CX query did not list method name. Following query can be used to find out all CX binding in the instance (you can filter by other parameters as required). Most important thing is to find all CX binding for postValueChange event for Global scope - These can cause performance issues and instance crash.

SELECT DISTINCT
  p.devl_project_id,
  p.name,
  RU.RULE_ID,
  RU.NAME,
  ev.NAME AS EVENTNAME,
  CLASS_NAME,
  mtd.name method_name,
  DECODE(EN.EVENT_EXECUTION_SCOPE, 1, 'Global', 2, 'Base Node SubTree', 4, 'Base Node', 'Unknown') AS SCOPE,
  EN.DATA_VALUE oncommandEventName
FROM CZ_RULES RU,
  CZ_EXPRESSION_NODES EN,
  CZ_SIGNATUREs EV,
  cz_signatures mtd,
  cz_devl_projects p
WHERE 1                       =1
  --AND p.DEVL_PROJECT_ID          IN (1097200) --for given devl_project_id
  AND RU.RULE_ID                =EN.RULE_ID
  AND ev.SIGNATURE_ID           =EN.ARGUMENT_SIGNATURE_ID
  AND RU.RULE_TYPE              =300       --for CX rules
  AND EN.ARGUMENT_SIGNATURE_ID IS NOT NULL --with valid event
  AND RU.DELETED_FLAG           =0         --ignore deleted nodes
  AND EN.DELETED_FLAG           =0
  AND p.deleted_flag            =0
  and ru.disabled_flag=0
  and en.expr_type=216
  and en.param_signature_id=mtd.signature_id
  and en.expr_parent_id is null
  AND EN.EXPR_PARENT_ID        IS NULL --definition is only on parent node of expression tree
  --AND ev.NAME                  = 'postValueChange'
  --and EVENT_EXECUTION_SCOPE=1  -- to check which all are global events
  --and mtd.name='myProcess' --- to check CX for given method
  AND ru.devl_project_id        =p.devl_project_id
  ;

Friday, January 25, 2013

CZ: Query to get property values associated with model node

Query to get all property values associated with all model names for given property.

SELECT DISTINCT D.NAME MODEL_NAME,
N.NAME NODE_NAME, P.NAME PROP_NAME, v.data_value text_value, v.data_num_value numeric_value
FROM cz_ps_prop_vals V, CZ_PROPERTIES P, CZ_PS_NODES N, CZ_DEVL_PROJECTS D
WHERE 1=1
AND V.DELETED_FLAG=0
AND N.DELETED_FLAG=0
AND D.DELETED_FLAG=0
AND P.DELETED_FLAG=0
AND V.PROPERTY_ID = P.PROPERTY_ID
AND V.PS_NODE_ID = N.PS_NODE_ID
AND N.DEVL_PROJECT_ID = D.DEVL_PROJECT_ID
AND P.name like '%LENGTH%' --property filter criteria
order by 1;

Wednesday, September 12, 2012

UI Templates used by Configurator UI

Following query returns the list of templates used by given UI. Replace ui_def_id in following query.


SELECT DISTINCT templ_ui_def_id,
  templ_id
FROM
  (SELECT ctrl_template_ui_def_id AS templ_ui_def_id,
     ctrl_template_id AS templ_id
   FROM cz_ui_page_elements pe
   WHERE ui_def_id = 113607
   AND deleted_flag = 0
   AND ctrl_template_id IS NOT NULL
   AND ctrl_template_ui_def_id IS NOT NULL
   AND EXISTS
    (SELECT 1
     FROM cz_ui_templates
     WHERE seeded_flag = 0
     AND deleted_flag = 0
     AND template_id = pe.ctrl_template_id
     AND ui_def_id = pe.ctrl_template_ui_def_id)
  UNION ALL
   SELECT page_status_templ_uidef_id AS templ_ui_def_id,
     page_status_template_id AS templ_id
   FROM cz_ui_pages pg
   WHERE ui_def_id = 113607
   AND deleted_flag = 0
   AND page_status_templ_uidef_id IS NOT NULL
   AND page_status_template_id IS NOT NULL
   AND EXISTS
    (SELECT 1
     FROM cz_ui_templates
     WHERE seeded_flag = 0
     AND deleted_flag = 0
     AND template_id = pg.page_status_template_id
     AND ui_def_id = pg.page_status_templ_uidef_id)
  UNION ALL
   SELECT ref_template_ui_def_id AS templ_ui_def_id,
     ref_template_id AS templ_id
   FROM cz_ui_ref_templates r
   WHERE deleted_flag = 0 START WITH deleted_flag = 0
   AND ref_templ_seeded_flag = 0
   AND(EXISTS
    (SELECT 1
     FROM cz_ui_page_elements pe
     WHERE pe.ui_def_id = 113607
     AND pe.deleted_flag = 0
     AND pe.ctrl_template_ui_def_id = r.template_ui_def_id
     AND pe.ctrl_template_id = r.template_id) OR EXISTS
      (SELECT 1
       FROM cz_ui_pages pg
       WHERE pg.ui_def_id = 113607
       AND pg.deleted_flag = 0
       AND pg.page_status_templ_uidef_id = r.template_ui_def_id
       AND pg.page_status_template_id = r.template_id)
    )
  CONNECT BY deleted_flag = 0
   AND ref_templ_seeded_flag = 0
   AND template_ui_def_id = PRIOR ref_template_ui_def_id
   AND template_id = PRIOR ref_template_id) ;
 

Friday, July 27, 2012

Configurator Model Size - Node count of the model

Usually its a common question in Configurator Development like how large the model is. Model size is usually determined by number of nodes created under it and its referenced models. When model performance is raised as a question, first question asked by analyzer would be how big the model is. Here is the query you can use for the same. This query returns the node count of all the models which are under given folder. You can modify the query to get node count for given project.

Q1) Count of nodes in model which are directly created under model

SELECT rpf.name folder_name,
  p.name model_name,
  p.devl_project_id,
  COUNT(*) node_count
FROM cz_devl_projects p,
  cz_ps_nodes pn,
  cz_rp_entries rpp,
  cz_rp_entries rpf
WHERE 1                  =1
AND rpp.object_id        =p.devl_project_id
AND rpp.enclosing_folder = rpf.object_id
AND pn.devl_project_id   = p.devl_project_id
AND p.deleted_flag       =0
AND pn.deleted_flag      =0
AND rpp.object_type      ='PRJ'
AND rpf.object_type      = 'FLD'
  --AND P.DEVL_PROJECT_ID=1037298
AND RPF.NAME LIKE 'Division A Models'
GROUP BY rpf.name ,
  p.name,
  p.devl_project_id;

Q2) Count of nodes in model which are directly created under this model + nodes created in all the referenced models of this model

SELECT rpf.name folder_name,
  p.name model_name,
  p.devl_project_id,
  COUNT(*) node_count
FROM cz_devl_projects p,
  cz_ps_nodes pn,
  cz_rp_entries rpp,
  cz_rp_entries rpf
WHERE 1                  =1
AND rpp.object_id        =p.devl_project_id
AND rpp.enclosing_folder = rpf.object_id
AND pn.devl_project_id  IN
  (SELECT component_id
  FROM cz_model_ref_expls mr
  WHERE mr.model_id  =p.devl_project_id
  AND mr.deleted_flag=0
  )
AND p.deleted_flag  =0
AND pn.deleted_flag =0
AND rpp.object_type ='PRJ'
AND rpf.object_type = 'FLD'
  --AND P.DEVL_PROJECT_ID=1037298
AND RPF.NAME LIKE ' Division A Models'
GROUP BY rpf.name ,
  p.name,
  p.devl_project_id
  --order by node_count desc
  ;

Saturday, March 24, 2012

Oracle: Find locking session and Kill

Usually you will see some query taking a lot of time and sometime never returns. Well, if it returns ever, you nee d to improve the explain plan of the query.
But if it never returns (usually update query) then it could be a deadlock in the system somewhere. To find out that particular session and query, following query will give more fruitful information for it.

I found if useful for debugging few issues in Oracle Configurator when some page does not return on Apply button click. Well, but in general following queries are not specific to oracle applications, you can use it anywhere to find locking sessions and eventually kill them.

SELECT sq.*, ses.*
FROM   v$sql sq, v$session ses
WHERE  sq.sql_id = ses.sql_id
 and ses.sid IN (SELECT sid
            FROM   v$lock
            WHERE  (id1,id2,TYPE) IN (SELECT id1,
                                             id2,
                                             TYPE
                                         FROM   v$lock
                                         WHERE  request > 0))
;

Find "BLOCKING_SESSION", analyze and kill if required.

select * from v$session where sid=310;


ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;


ALTER SYSTEM KILL SESSION '276,2323' IMMEDIATE;

Wednesday, March 7, 2012

Assign different property to node and keep the value as it is


Although same can be done by updating property name directly if the old property is not required at all.


Backup table created as
CREATE TABLE CZ_PS_PROP_VALS_BKUP_6MAR12 AS SELECT * FROM CZ_PS_PROP_vALS;


Current count of this property usage of our models in RMT%In%Process folder

SELECT count(*), P.NAME
FROM cz_ps_prop_vals V, CZ_PROPERTIES P
WHERE P.deleted_flag=0
AND V.DELETED_FLAG=0
AND V.PROPERTY_ID = P.PROPERTY_ID
AND P.name like '%OFFERING%'
AND V.ps_node_id   IN
  (SELECT ps_node_id
  FROM cz_ps_nodes
  WHERE deleted_flag=0
  and devl_project_id IN
    (SELECT object_id
    FROM cz_rp_entries
    WHERE enclosing_folder = 136906
    AND deleted_flag       =0
    )
    )
  GROUP BY P.NAME;



Update query executed to update 394 rows
UPDATE CZ_PS_PROP_VALS
SET PROPERTY_ID = 5302 -- MYOFFERING
WHERE PROPERTY_ID = 5522 --YOUROFFERING
AND DELETED_FLAG=0
AND PS_NODE_ID IN (SELECT ps_node_id
  FROM cz_ps_nodes
  WHERE deleted_flag=0
  and devl_project_id IN
    (SELECT object_id
    FROM cz_rp_entries
    WHERE enclosing_folder = 136906
    AND deleted_flag       =0
    )
    );

Monday, December 12, 2011

PLSQL block for Publication process

If there is any issue entering parameters for Concurrent program or if you want to automate your publishing process, go for following plsql block:

DECLARE
  P_API_VERSION NUMBER;
  P_PUBLICATION_ID NUMBER;
  P_USER_ID NUMBER;
  P_RESP_ID NUMBER;
  P_APPL_ID NUMBER;
  X_RUN_ID NUMBER;
  X_STATUS NUMBER;
BEGIN
  P_API_VERSION := 1.0;
  P_PUBLICATION_ID := 64689;
  P_USER_ID := 1001530;  --EBUSINESS
  P_RESP_ID := 22687;  --Oracle Configurator Administrator
  P_APPL_ID := 708; --Configurator

  CZ_MODELOPERATIONS_PUB.PUBLISH_MODEL(
    P_API_VERSION => P_API_VERSION,
    P_PUBLICATION_ID => P_PUBLICATION_ID,
    P_USER_ID => P_USER_ID,
    P_RESP_ID => P_RESP_ID,
    P_APPL_ID => P_APPL_ID,
    X_RUN_ID => X_RUN_ID,
    X_STATUS => X_STATUS
  );
  DBMS_OUTPUT.PUT_LINE('X_RUN_ID = ' || X_RUN_ID);
  DBMS_OUTPUT.PUT_LINE('X_STATUS = ' || X_STATUS);
END;

Ensure you enable dbms output to check the return status.
Successful submission would return 0 as x_status.
You can also check in Configurator Developer  >  Publication tab for this publication, it should show as Complete.

P.S. All Configurator process APIs are listed in Implementation Guide of Configurator.
Change user_id, resp_id, appl_id as per your requirement.
For errors, refer cz_db_logs table.

Tuesday, December 6, 2011

Query to extract Oracle Configurator CX rule information


We can use following query to find out all the CX rules in the Configurator model. The query will display the information for the rules like rule_name, java class associated with it, event name, event scope, and oncommand event name.

SELECT DISTINCT RU.RULE_ID, 
  RU.NAME, 
  (SELECT NAME FROM CZ_SIGNATURES WHERE SIGNATURE_ID=EN.ARGUMENT_SIGNATURE_ID) AS EVENTNAME, 
  CLASS_NAME, 
  DECODE(EN.EVENT_EXECUTION_SCOPE, 1, 'Global', 2, 'Base Node SubTree', 4, 'Base Node', 'Unknown') AS SCOPE, 
  EN.DATA_VALUE oncommandEventName
FROM CZ_RULES RU, 
  CZ_EXPRESSION_NODES EN
WHERE DEVL_PROJECT_ID IN (131343) --for given devl_project_id
  AND RU.RULE_ID=EN.RULE_ID
  AND RU.RULE_TYPE=300 --for CX rules
  AND EN.ARGUMENT_SIGNATURE_ID IS NOT NULL --with valid event
  AND RU.DELETED_FLAG=0 --ignore deleted nodes
  AND EN.DELETED_FLAG=0
  AND EN.EXPR_PARENT_ID IS NULL --definition is only on parent node of expression tree
;

This query is useful at times to find out all CX rules with base node subtree event scope which may usually cause performance issue if its unwanted. You can always add other parameters/clauses to filter information as per your need.