How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?

來源:互聯網
上載者:User

標籤:visio   rev   log   list   tracking   status   note   oracl   pop   

In this Document

?

_afrLoop=525552911636365&id=869386.1&_afrWindowMode=0&_adf.ctrl-state=zdhsqj28k_25#GOAL">Goal

?

_afrLoop=525552911636365&id=869386.1&_afrWindowMode=0&_adf.ctrl-state=zdhsqj28k_25#FIX">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.

SOLUTION1: 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?

id=148651.1">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 -?

attachid=778.1:VIDEOLOGO&clickstream=yes" border="0" hspace="0" vspace="0" align="middle" />?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)?

attachid=778.1:ICONHELP&clickstream=yes" border="0" title="Trouble seeing this video?" hspace="0" align="bottom" />

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 ?

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.