In this Document

  Goal
  Solution
  1: How do you enable trace for an API when executed from a SQL script outside
of Oracle Applications ?
  2: How do you get debug log for an API when executed from a SQL script outside
of Oracle Applications ?
  a) For Inventory APIs
  b) For Bills of Material & Engineering APIs
  c) For Advanced Product Catalog (APC / PIM / EGO) APIs
  References

APPLIES TO:

Oracle Inventory Management - Version 11.5.10.CU2 to 12.1.3 [Release 11.5.10 to 12.1]

Oracle Bills of Material - Version 11.5.10.2 to 12.1.3 [Release 11.5 to 12.1]

Oracle Engineering - Version 11.5.10.2 to 12.1.3 [Release 11.5 to 12.1]

Oracle Product Hub - Version 11.5.10.2 to 12.1.3 [Release 11.5 to 12.1]

Information in this document applies to any platform.

This document includes all versions of 11.5.10 and R12 and later

GOAL

This document addresses the below questions: 



1. How do you enable trace for an API when executed from a SQL script outside of Oracle Applications ? 



2. How to get the debug log for APIs  when executed from a SQL script outside of Oracle Applications ? 



a) Inventory APIs

b) Bills of Material and Engineering APIs 

c) Advanced Product Catalog (APC / EGO/ PIM) APIs



Note: Debug profiles are specific to modules, but,  trace can be enabled for any API by following the steps provided here.

SOLUTION

1: How do you enable trace for an API when executed from a SQL script outside of Oracle Applications ?

-- enable trace

ALTER SESSION SET EVENTS '10046 trace name context forever, level 12';



-- Set the trace file identifier, to locate the file on the server

ALTER SESSION SET TRACEFILE_IDENTIFIER = 'API_TRACE';



-- Execute the API from the SQL script, in the same session.

EXEC <procedure name> ; 



-- Once the API completes execution, disable trace

ALTER SESSION SET EVENTS '10046 trace name context off';



-- Locate the trace file based on the tracefile identifier

SELECT VALUE FROM V$PARAMETER WHERE NAME = 'user_dump_dest'; 



-- Generate the tkprof of the trace file

tkprof <trace_File>.trc <tkprof>.out sys=no explain=apps/<apps pwd>

2: How do you get debug log for an API when executed from a SQL script outside of Oracle Applications ?

a) For Inventory APIs

i. Enable INV Debug profiles at User level for the user who would be running the API.



For example:

INV:Debug Trace = YES

INV:Debug level = 15

INV: Debug File = /tmp/invdbg_TAR.dbg  

For more information, on INV Debug profiles, Please refer to Note 148651.1



ii. Add the below declarations to the sql script calling the API outside of Oracle Applications.

-- Declarations



l_user_id NUMBER := -1;

l_resp_id NUMBER := -1;

l_application_id NUMBER := -1;

l_user_name VARCHAR2(30) := 'MFG';  -- user name

l_resp_name VARCHAR2(30) := 'Inventory'; -- responsibility name

iii. Add the below code before the API is called in the SQL script. This will initialize applications context, and will use the values of the debug profiles set for this user.

-- Get the user_id

SELECT user_id

INTO l_user_id

FROM fnd_user

WHERE user_name = l_user_name;



-- Get the application_id and responsibility_id

SELECT application_id, responsibility_id

INTO l_application_id, l_resp_id

FROM fnd_responsibility_vl

WHERE responsibility_name = l_resp_name;



FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_application_id); -- Mfg / Mfg & Dist Mgr / INV

dbms_output.put_line('Initialized applications context: '|| l_user_id || ' '|| l_resp_id ||' '|| l_application_id );

iv. Now, go ahead and execute the API from the SQL script, this willl create the debug log file with the file name as provided in the profile "INV: Debug File".

You can review step-by-step video here -  Video - Trace
and Debug INV API (2:00)
 

b) For Bills of Material & Engineering APIs

i. Initialize the below parameters to the API:

(...

p_debug => 'Y',

p_output_dir => '/usr/tmp',   -- Directory from utl_file_dir

p_debug_filename => 'bom_api_debug.log'  -- Debug log filename

);

ii. Now run the API script or procedure created, This will create the debug log in the directory as mentioned in the parameters.



For example:

Bom_Bo_Pub.process_bom (p_bo_identifier => 'BOM',

p_api_version_number => 1.0,

p_init_msg_list => TRUE,

p_bom_header_rec => l_bom_header_rec,

p_bom_revision_tbl => l_bom_revision_tbl,

p_bom_component_tbl => l_bom_component_tbl,

p_bom_ref_designator_tbl => l_bom_ref_designator_tbl,

p_bom_sub_component_tbl => l_bom_sub_component_tbl,

x_bom_header_rec => x_bom_header_rec,

x_bom_revision_tbl => x_bom_revision_tbl,

x_bom_component_tbl => x_bom_component_tbl,

x_bom_ref_designator_tbl => x_bom_ref_designator_tbl,

x_bom_sub_component_tbl => x_bom_sub_component_tbl,

x_return_status => l_return_status,

x_msg_count => l_msg_count ,

p_debug => 'Y',

p_output_dir => '/usr/tmp', 

p_debug_filename => 'bom_api_debug.log'

);

You can review step-by-step video here -  Video
Trace and Debug ECO API (2:00) 

c) For Advanced Product Catalog (APC / PIM / EGO) APIs

i. Initialize the below parameters to the API:

(...

p_debug_level => 3   -- 0 - No debug, 3 - finest debug information

);

ii. Now run the API script or procedure created, This will create the debug log in the directory (as in 'utl_file_dir' DB parameter, for ex: /usr/tmp)



For example:

 EGO_USER_ATTRS_DATA_PUB.PROCESS_USER_ATTRS_DATA(

              l_api_version

              , l_object_name

              , l_attributes_row_table

              , l_attributes_data_table

              , l_pk_column_name_value_pairs

              , l_class_code_name_value_pairs

              , l_user_privileges_on_object

              , l_entity_id

              , l_entity_index

              , l_entity_code

              , l_debug_level

              , l_init_error_handler

              , l_write_to_concurrent_log

              , l_init_fnd_msg_list

              , l_log_errors

              , l_add_errors_to_fnd_stack

              , l_commit

              , x_failed_row_id_list

              , x_return_status

              , x_errorcode

              , x_msg_count

              , x_msg_data

          );

How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?的更多相关文章

  1. Trace、Debug和TraceSource的使用以及日志设计 .

    [-] Trace 和 Debug区别 什么是Listeners 跟踪开关 使用BooleanSwitch开关 使用TraceSwitch开关 使用TraceSource代替Trace和Debug 设 ...

  2. C#学习笔记14——TRACE、DEBUG和TRACESOURCE的使用以及日志设计

    Trace.Debug和TraceSource的使用以及日志设计   .NET Framework 命名空间 System.Diagnostics 包含用于跟踪执行流程的 Trace.Debug 和 ...

  3. 【转】 C#学习笔记14——Trace、Debug和TraceSource的使用以及日志设计

    [转] C#学习笔记14——Trace.Debug和TraceSource的使用以及日志设计 Trace.Debug和TraceSource的使用以及日志设计   .NET Framework 命名空 ...

  4. Trace和Debug主要用法

    #region 日志记录 //System.Diagnostics.Trace.Listeners.Clear(); //System.Diagnostics.Trace.AutoFlush = tr ...

  5. Oracle Bills of Material and Engineering Application Program Interface (APIs)

    In this Document Goal   Solution   1. Sample Notes for BOM APIs   2. Datatypes used in these APIs   ...

  6. Oracle Inventory Management Application Program Interface ( APIs)

    In this Document   Goal   Solution   References APPLIES TO: Oracle Inventory Management - Version 12 ...

  7. Oracle Inventory Management Application Program Interface ( APIs) (Doc ID 729998.1)

    In this Document Goal Solution References APPLIES TO: Oracle Inventory Management - Version 12.0.0 a ...

  8. 如何利用RMAN Debug和10046 Trace来诊断RMAN问题?

    学习转摘:https://blogs.oracle.com/Database4CN/entry/%E5%A6%82%E4%BD%95%E5%88%A9%E7%94%A8rman_debug%E5%92 ...

  9. 如何利用RMAN Debug和10046 Trace来诊断RMAN问题?

         在做Support的这些年,我很大的收获是掌握了许多troubleshooting问题的方法和工具,对于每一类问题,都可以大体归类出一些诊断方法.无论问题多么复杂,像扒洋葱一样,一层层去掉无 ...

随机推荐

  1. 代理delegate

    1>代理的用处是什么? 监听那些不能通过addTarget监听的事件 主要用开负责在两个对象之间,发生某些事件时,传递或发送消息 当我们需要 监听某些事件时,但苹果没有提供相关监听方法(addt ...

  2. MyBatis批量新增和更新

    之前有开发任务一个接口里面有大量的数据新增和更新操作,导致十分缓慢.使用了批量操作之后速度有明显提升,几乎百倍千倍的速度提升. 博主之前统计过,通过普通接口一次数据库插入大概需要200ms,对于大量新 ...

  3. 没有JavaScript的基础,我可以学习Angular2吗?

    Can I learn and understand Angular2 without understanding JavaScript? 没有JavaScript基础我能学习和理解Angular2吗 ...

  4. 集群技术(三)MySQL集群深度解析

    什么是MySQL集群 MySQL集群是一个无共享的(shared-nothing).分布式节点架构的存储方案,其目的是提供容错性和高性能. 数据更新使用读已提交隔离级别(read-committedi ...

  5. 用Netty解析Redis网络协议

    用Netty解析Redis网络协议 根据Redis官方文档的介绍,学习了一下Redis网络通信协议.然后偶然在GitHub上发现了个用Netty实现的Redis服务器,很有趣,于是就动手实现了一下! ...

  6. Android自定义底部带有动画的Dialog

    Android自定义底部带有动画的Dialog 效果图 先看效果图,是不是你想要的呢 自定义Dialog package --.view; import android.app.Dialog; imp ...

  7. 给现有的word和pdf加水印

    iTextSharp简单生成pdf和操作pdf添加水印 给word加水印,利用的是aspose.words

  8. iOS应用启动时间

    转自:iOS 知识小集 如果我们想知道程序启动的时间,则可以在工程的scheme中添加环境变量DYLD_PRINT_STATISTICS,如图1所示.这样在调试时,可以在控制台打印出程序启动过程中各个 ...

  9. 关于前端HTML你需要知道的一切

    1.H系列标签(Header 1~Header 6) 作用: 用于给文本添加标题语义 格式: <h1>xxxxxx</h1> 注意点: H标签是用来给文本添加标题语义的, 而不 ...

  10. [Centos]openvpn 服务端的安装(easy-rsa3)

    VPN在办公和fan墙领域有着广泛的应用,  我们小办公网最近可能会用到,先学学来着 vpn的server需要有公网ip,客户端可以在多种环境下使用 概念 PKI:Public Key Infrast ...