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. ACM 排列2

    Ray又对数字的列产生了兴趣: 现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数.  Input每组数据占一行,代表四张卡片上的数字(0<=数字<=9 ...

  2. 实验与作业(Python)-03 Python程序实例解析

    截止日期: 要求: 下周实验课前上交,做好后在实验课上检查可获取平时分. 做出进阶或选做的的请用清晰的标致标识出来,方便老师批改 本次作业:可提交也可不提交.作业算平时成绩. 本次作业内容量较大,请组 ...

  3. 编写高性能的Lua代码

    编写高性能的Lua代码 Posted on2014/04/18· 10 Comments 前言 Lua是一门以其性能著称的脚本语言,被广泛应用在很多方面,尤其是游戏.像<魔兽世界>的插件, ...

  4. 拾遗与填坑《深度探索C++对象模型》3.2节

    <深度探索C++对象模型>是一本好书,该书作者也是<C++ Primer>的作者,一位绝对的C++大师.诚然该书中也有多多少少的错误一直为人所诟病,但这仍然不妨碍称其为一本好书 ...

  5. android 自定义view之侧滑效果

    效果图: 看网上的都是两个view拼接,默认右侧的不显示,水平移动的时候把右侧的view显示出来.但是看最新版QQ上的效果不是这样的,但给人的感觉却很好,所以献丑来一发比较高仿的. 知识点: 1.Vi ...

  6. Android开发之手把手教你写ButterKnife框架(二)

    欢迎转载,转载请标明出处: http://blog.csdn.net/johnny901114/article/details/52664112 本文出自:[余志强的博客] 上一篇博客Android开 ...

  7. 在做自动化测试之前你需要知道的,转自:http://www.cnblogs.com/fnng/p/3653793.html

    什么是自动化测? 做测试好几年了,真正学习和实践自动化测试一年,自我感觉这一个年中收获许多.一直想动笔写一篇文章分享自动化测试实践中的一些经验.终于决定花点时间来做这件事儿. 首先理清自动化测试的概念 ...

  8. HTTP状态码总结

    HTTP状态码(HTTP Status Code)是用以表示网页服务器HTTP响应状态的3位数字代码.有些 App 端接口与 HTML 接口用的是同一个,所以做移动端开发也有必要了解一下HTTP状态码 ...

  9. Bootstarp-table入门

    介绍 介绍什么的,大家自己去下面的网站看 Bootstrap中文网:http://www.bootcss.com/        Bootstrap Table Demo:http://issues. ...

  10. Android开发艺术探索——第二章:IPC机制(上)

    Android开发艺术探索--第二章:IPC机制(上) 本章主要讲解Android的IPC机制,首先介绍Android中的多进程概念以及多进程开发模式中常见的注意事项,接着介绍Android中的序列化 ...