How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
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 ?
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 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.
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.
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:
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:
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 ?的更多相关文章
- Trace、Debug和TraceSource的使用以及日志设计 .
[-] Trace 和 Debug区别 什么是Listeners 跟踪开关 使用BooleanSwitch开关 使用TraceSwitch开关 使用TraceSource代替Trace和Debug 设 ...
- C#学习笔记14——TRACE、DEBUG和TRACESOURCE的使用以及日志设计
Trace.Debug和TraceSource的使用以及日志设计 .NET Framework 命名空间 System.Diagnostics 包含用于跟踪执行流程的 Trace.Debug 和 ...
- 【转】 C#学习笔记14——Trace、Debug和TraceSource的使用以及日志设计
[转] C#学习笔记14——Trace.Debug和TraceSource的使用以及日志设计 Trace.Debug和TraceSource的使用以及日志设计 .NET Framework 命名空 ...
- Trace和Debug主要用法
#region 日志记录 //System.Diagnostics.Trace.Listeners.Clear(); //System.Diagnostics.Trace.AutoFlush = tr ...
- 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 ...
- Oracle Inventory Management Application Program Interface ( APIs)
In this Document Goal Solution References APPLIES TO: Oracle Inventory Management - Version 12 ...
- 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 ...
- 如何利用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 ...
- 如何利用RMAN Debug和10046 Trace来诊断RMAN问题?
在做Support的这些年,我很大的收获是掌握了许多troubleshooting问题的方法和工具,对于每一类问题,都可以大体归类出一些诊断方法.无论问题多么复杂,像扒洋葱一样,一层层去掉无 ...
随机推荐
- MongoDB 删除文档
ongoDB remove()函数是用来移除集合中的数据. MongoDB数据更新可以使用update()函数.在执行remove()函数前先执行find()命令来判断执行的条件是否正确,这是一个比较 ...
- Gradle 1.12用户指南翻译——第四十七章. Build Init 插件
本文由CSDN博客貌似掉线翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...
- [Matlab+C/C++] 读写二进制文件
introduction 因为Matlab操作简单.方便,它被应用于很多领域:音频处理,图像处理,数值计算等.尽管MATLAB容易操作,但受限于他的语言解释机制,MATLAB的执行速度通常较低.C/C ...
- 使用kprobes查看内核内部信息
前言:使用printk打印变量等方法,是调试内核的有效方法之一,但是这种方法必须重新构建并用新内核启动,调试效率比较低.以内核模块的方式使用kprobes.jprobes,就可以在任意地址插入侦测器, ...
- 前端CSS技术全解(一)
一.概述 1)用HTML完成样式工作 哪个标签有哪个属性难以记忆 需求变更影响较大(例如像修改成功法则以下的文字颜色需要修改4个地方) <h1 align="center"& ...
- 本人正竞选CSDN博客之星,欢迎各位来访的朋友能为我投上一票
投票网址:http://blog.csdn.net/vote/candidate.html?username=morixinguan&from=timeline 谢谢各位!
- 采购订单状态更改处理API
--PO采购订单状态更改处理API PO_Document_Control_PUB.control_document( p_api_version IN NUMBER, p_init_msg_list ...
- 2.Lucene3.6.2包介绍,第一个Lucene案例介绍,查看索引信息的工具lukeall介绍,Luke查看的索引库内容,索引查找过程
1 Lucen目录介绍 2 lucene-core-3.6.2.jar是lucene开发核心jar包 contrib 目录存放,包含一些扩展jar包 3 案例 建立第一个Lucene项目 ...
- 深入理解CoordinatorLayout.Behavior
要研究的几个问题 一.Behavior是什么?为什么要用Behavior? 二.怎么使用Behavior? 三.从源码角度看为什么要这么使用Behavior? 一.Behavior是什么?为什么要用B ...
- 关于GCJ02和WGS84坐标系的一点实验
大家都知道,在兲朝的电子地图的坐标都是经过了一个坐标偏移,叫GCJ_02的东西.在网上发现了将WGS84经纬度转成GCJ02的一个代码,写了个小程序测试了下看看全国各地的偏移量有多大. 关于WGS84 ...