This chapter discusses diagnostic techniques and aids for determining and resolving problems with data conversion, truncation, and conversation startup. It also describes how to collect the data when the debugging (trace) option is on.
You will want to trace the PL/SQL stored procedures only when you suspect problems. Do not run with tracing enabled during normal operations, because it will affect performance.
This chapter contains the following sections:
TIP definition errors occur when a TRANSACTION
, CALL
, or DATA
entry in the PG DD is not properly defined.
Use the REPORT
with DEBUG
statement to list the PG DD contents and GENERATE DIAGNOSE(PKGEX(DR))
option to include corresponding ID numbers in the TIP.
Table 8-1 shows the mnemonic used to represent ID numbers and their correspondence with the following:
PG DD tables and columns from which ID numbers are selected
Oracle sequence objects from which ID numbers originate
Table 8-1 PG DD ID Numbers in Correspondence
PGAU REPORT/TIP | PDGG table(col) | Sequence Object |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
These ID numbers can be used to associate the conversions performed in the TIP with the definitions stored in the PG DD.
The PG DD diagnostic references appear in TIPs generated with the PKGEX(DR)
option as single line Comments:
-- PG DD type idno=nnn ...
The PG DD diagnostic references appear in REPORT
with DEBUG
listings before or to the right of their related definition entry as end-delimited Comments:
/* idno=nnn */
Refer to Appendix A, "Database Gateway for APPC Data Dictionary" for more information about PG DD, including a complete list of dictionary tables.
TIPs should be generated by the PGAU GENERATE
command with the PKGEX(DR)
diagnostic option, to include PG DD reference Comments in the TIP. These diagnostic references are Comments only and do not affect the runtime overhead of the TIP. Refer to GENERATE in Chapter 2, "Procedural Gateway Administration Utility" for a description of the PKGEX (DR)
parameter.
Before defining the PL/SQL package, identify the transaction name, ID number (t#
), and version (v#
) from the TIP specification within the TIP.
Invoke PGAU REPORT WITH DEBUG
specifying the same transaction name and version.
REPORT
selects definitions from the PG DD and produces a listing showing the DATA
, CALL
, and TRANSACTION
definitions and the ID number of each user-supplied definition.
Compare the reported definitions with those used in the remote transaction program and identify all corresponding exchanges and the data formats transmitted.
Look for and investigate any mismatches, such as:
different numbers of send/receive calls
different sequence of send/receive calls
different parameter lists on send/receive calls
different data fields within each exchanged parameter
different lengths for each exchanged parameter
unsupported datatypes for each exchanged parameter
improperly initialized control fields for:
repeating group counts
IBMVSCOBOLII
affected clauses include
OCCURS n TIMES DEPENDING ON
field
remapped group criteria
IBMVSCOBOLII
affected clauses include
REDEFINES field1 WHEN field2 =
criteria
PGAU GENERATE
error messages and TRACE(OC)
entries reference SQL SELECT
statements. Refer to Table 8-2 for the meaning of the name designations for each entry.
Table 8-2 Meaning of TRACE(OC) Output
Name | Entry |
---|---|
|
Select Environment Data |
|
Select Transaction (latest version) |
|
Select Transaction (specific version) |
|
Select Transaction Calls |
|
Select Parameter Data |
|
Select Fields |
|
Select Field Attributes |
|
Select conversion Formats |
|
Select Attribute conversions |
The SQL*Plus test scripts in Table 8-3 are provided to perform the identical SELECTS
as GENERATE
performs to determine which PG DD rows are being used when the TIP is generated. These files are loaded into the %ORACLE_HOME%\\dg4appc\\admin
directory on Microsoft Windows or into the $ORACLE_HOME/dg4appc/admin
directory on UNIX based systems, during installation.
Table 8-3 SQL*Plus Test Scripts and Their Corresponding Entries
Script | Entry |
---|---|
|
Select Environment Data |
|
Select Transaction (latest version) |
|
Select Transaction (specific version) |
|
Select Transaction Calls |
|
Select Parameter Data |
|
Select Fields |
|
Select Field Attributes |
|
Select Conversion Formats |
|
Select Attribute conversions |
The scripts are shown in the same order used by GENERATE
and each script prompts the SQL*Plus user for the required input. The information retrieved from a previous select is often used as input to a subsequent select. If a you suspect that a PG DD field entry has produced inaccurate data, browse the .sql
files listed above to determine the source of the problem. These files are loaded into the %ORACLE_HOME%\\dg4appc\\admin
directory on Microsoft Windows or $ORACLE_HOME/dg4appc/admin
directory on UNIX based systems, during installation.
Data conversion errors are usually the result of:
incorrect determination of datatype
or
incorrect specification of data position.
PGAU determination of the datatype is based on the values found in the PG DD, pga_fields
(mask)
, and pga_fields
(maskopts)
columns. PGAU generates PL/SQL code to perform conversions based on the mask value:
Character datatype is presumed for all PIC X
and PIC G
mask values and conversion errors are more likely the result of position, length, and justification errors.
Determination of numeric datatype depends on several factors, including the combination of mask and maskopts values and how they apply to the actual remote host data in its internal format. Values for mask, maskopts, and data might conflict in unexpected ways. For example, an option such as USAGE IS COMP
might be overridden if the data is in display format. While compilers occasionally perform such overrides correctly, they can cause unexpected results when exchanging data with systems coded in other languages.
To notify the user of such overrides, a warning function has been included in the following UTL_PG
functions:
MAKE _NUMBER_TO_RAW_FORMAT
MAKE_RAW_TO_NUMBER_FORMAT
NUMBER_TO_RAW
RAW_TO_NUMBER
TIPs should be generated by the PGAU GENERATE
command with the PKGEX(DC)
diagnostic option to include TIP data conversion trace logic in the TIP. TIP function call trace logic is always included in every TIP. This is runtime trace instrumentation and has some overhead when tracing is enabled, but negligible overhead when tracing is disabled. Refer to GENERATE in Chapter 2, "Procedural Gateway Administration Utility" for more information.
Regenerate TIPs with the PKGEX(DC, DR)
options and recompile the TIP body file, tipname
.pkb
. Avoid recompiling the TIP specification.
Revise the application that calls the TIP initialization function (tipname
_init
) to pass the trace flags parameter with data conversion and function call tracing enabled. Refer to "Controlling TIP Runtime Data Conversion Tracing".
If the problem causes an exception to be raised in the TIP and the application contains an exception handler, the application exception handler should be Commented out to prevent it from handling the exception and preventing the exception point of origin from being reported. When the TIP exception is next raised, its source line number in the TIP is reported. Record this information.
Execute the application with diagnostic TIP initialization.
If the TIP trace pipe inlet overflows due to the application calls causing the TIP to write trace messages in the TIP trace pipe inlet, you have one minute from the start of the overflow condition to begin Step 4 and empty the TIP trace pipe.
Otherwise, exception "ORA-20703 PGA-TIP: pipe send error
" is issued, ending the diagnostic session, possibly before any relevant trace information is generated.
Retrieve and record the TIP trace message stream.
Use SQL*Plus to connect to the same Oracle user ID executing the application or the user ID under which the TIP is executed. This establishes a second session from which the trace pipe outlet can be read, preventing the TIP trace pipe from overflowing at the TIP trace pipe inlet.
Issue the command:
set serveroutput on size nnnnn
Issue the command to record the trace output:
spool tipname.trc
Issue the command to retrieve the trace stream:
exec rtrace('tipname');
If the application is long-running, repeat this command as often as needed until all trace messages have been retrieved.
If any exceptions are raised, note their prefix, number, and full message text.
Analyze the TIP trace message stream. A normal trace is shown for the pgadb2i
TIP in Appendix F, "Administration Utility Samples".
Runtime trace control is the second parameter specified on a TIP initialization call. It is a CHAR(8)
datatype of the following form:
rc := yourtip_init(trannum,'wxyz0000');
Table 8-4 describes the value of positions one to four:
Table 8-4 Values of Positions 1 through 4 on Second Parameter of TIP Call
Item | Description |
---|---|
position 1 ( |
controls |
position 2 ( |
controls the function entry/exit tracing. A value of 0 suppresses the function entry/exit tracing; a value of 1 enables the function entry/exit tracing. |
position 3 ( |
controls data conversion tracing. A value of 0 suppresses data conversion tracing; a value of 1 enables data conversion tracing. |
position 4 ( |
controls gateway exchange tracing. A value of 0 suppresses gateway exchange tracing; a value of 1 enables gateway exchange tracing. |
Positions 5 through 8 are reserved and ignored.
Use PGAU to regenerate the TIP and specify the GENERATE
parameter DIAGNOSE(PKGEX(DC))
. This includes runtime PL/SQL code in the TIP which tests for and displays warnings of correct, but possibly unexpected NUMBER_TO_RAW
and RAW_TO_NUMBER
conversions.
Refer to GENERATE in Chapter 2, "Procedural Gateway Administration Utility" for more information about this parameter.
Recompile the TIP body under SQL*Plus. Avoid recompiling the TIP specification.
After the TIP has been regenerated, the issuance of runtime warnings is under control of the application. By default, warnings are suppressed and are only issued when they are enabled.
Errors and exceptions are always issued if they occur.
To enable the issuance of warnings, an additional parameter must be supplied when calling the TIP initialization function. This parameter is a CHAR(8)
datatype and each character position controls a particular TIP runtime diagnostic function.
To enable warnings in yourtip
, the client application should call the TIP initialization function with the statement:
rc := yourtip_init(trannum,'10000000');
The following is input to the TIP trace pipe inlet at initialization time:
"UTL_PG warnings enabled"
To enable function entry/exit tracing in yourtip
, the client application should call the TIP initialization function with the statement:
rc := yourtip_init(trannum,'01000000');
The following is input to the TIP trace pipe inlet at initialization time:
'function entry/exit trace enabled' 'tipname_init entered' 'time date/time stamp'
To enable data conversion tracing in yourtip
, the client application should call the TIP initialization function with the following statement:
rc := yourtip_init(trannum,'00100000');
The following is input to the TIP trace pipe inlet at initialization time:
'data conversion trace enabled'
To enable runtime gateway exchange tracing in yourtip
, the client application should call the TIP initialization function with the following statement:
rc := yourtip_init(trannum,'00010000');
The following is input to the TIP trace pipe inlet at initialization time:
'gateway exchange trace enabled'
After debugging is finished, there are two ways to suppress the following:
data conversion tracing
conversion warnings
function entry/exit tracing
gateway exchange tracing
You can:
Call the TIP initialization function without passing any diagnostic control parameters:
rc := yourtip_init(trannum);
Call the TIP initialization function passing a revised diagnostic control parameter which disables all tracing and warnings:
rc := yourtip_init(trannum,'00000000');
A third method, described in Method C, removes the logic for:
data conversion tracing
conversion warnings
Generate the TIP again without:
PKGEX(DC)
Or you can recompile the previous version of the TIP body if it was saved.
Methods A and B allow you to use the same TIP without alteration, but without tracing or warnings. These methods are reversible without alteration or replacement of the TIP. Tracing and warnings can be redisplayed should a problem recur.
Method C also suppresses data conversion tracing and warnings and incurs reduced overhead by avoiding tests, but is not reversible without regenerating the TIP or recompiling an alternate version with data conversion tracing and warning diagnostics imbedded.
The logic for function entry/exit and gateway exchange tracing is included in every TIP and cannot be removed. It can be disabled by method A or B.
Oracle Database Gateway for APPC data lengths are limited by PL/SQL to 32,763 bytes per APPC exchange and PL/SQL variable.
The following steps can be used to diagnose data conversion or truncation errors.
Refer to Chapter 3, "Creating a TIP" to review the proper values and definitions referenced in items 1 through 4 below:
Ensure that the COBOL definitions used in the RHT match the input to PGAU;
Ensure the RHT transmission buffers are of sufficient length;
If your gateway uses SNA: Ensure the RHT APPC call addresses the correct transmission buffer and uses the correct data length;
If your gateway uses TCP/IP: Ensure the RHT I/O PCB call addresses the correct transmission buffer and uses the correct data length
Ensure the client application has declared the correct TIP datatypes used as arguments in the TIP calls.
Ensure that the client application is calling the TIP functions in the proper sequence (init, user-defined..., term), and that any input data to the RHT is correct. Also ensure that if multiple user-defined functions exist, they are being called in the proper sequence and passed the correct input values, if any.
DBMS_OUTPUT
calls can be inserted in the client application to trace its behavior.
For more information about calling TIP functions in proper sequence, refer to the chapter on configuring the Oracle database for first time installations, in the Oracle Database Gateway for APPC Installation and Configuration Guide for IBM AIX on POWER Systems (64-Bit), Linux x86-64, Oracle Solaris on SPARC (64-Bit), and HP-UX Itanium or Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windows.
Optionally, regenerate the TIP with diagnostic traces included and enable them. The following traces are particularly useful:
data conversion trace
function entry/exit trace
gateway exchange trace
Refer to "Problem Analysis with TIP Runtime Traces" for more information about traces; refer also to GENERATE in Chapter 2, "Procedural Gateway Administration Utility".
Note that the output of the trace is different for a gateway using SNA than for a gateway using TCP/IP. However, the method of invoking the trace is the same regardless of which communication protocol you are using.
On Microsoft Windows, the gateway server tracing must also be enabled in %ORACLE_HOME%\\dg4appc\\admin\initsid.ora
. Set the parameters SET TRACE_LEVEL=255
and SET LOG_DESTINATION=C:\oracle\pga\12.1\dg4appc\log
On UNIX based systems, the gateway server tracing must also be enabled in $ORACLE_HOME/dg4appc/admin/initsid.ora
. Set the parameters SET TRACE_LEVEL=255
and SET LOG_DESTINATION=/oracle/pga/12.1/dg4appc/log
Refer to "Gateway Server Tracing" in this guide for more information about tracing.
If your gateway is using SNA: Refer to Appendix A, "Gateway Initialization Parameters for SNA Protocol" in your Oracle Database Gateway for APPC Installation and Configuration Guide for more information about these parameters;
If your gateway is using TCP/IP: Refer to Appendix B, "Gateway Initialization Parameters for TCP/IP Communication Protocol" in the Oracle Database Gateway for APPC Installation and Configuration Guide for IBM AIX on POWER Systems (64-Bit), Linux x86-64, Oracle Solaris on SPARC (64-Bit), and HP-UX Itanium or Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windows. for more information about these parameters.
Rerun the client application and examine the trace (see the next step for details).
To disable the trace, reset
SET TRACE_LEVEL=0
Examine the trace output.
The TIP trace output can be saved in a spool file, such as:
spool tipname.trc
TIP trace output is written to a named DBMS_PIPE
and can be retrieved under SQL*Plus by issuing the following command:
exec rtrace('tipname');
or it can be purged by issuing the following command:
exec ptrace('tipname');
Note:
tipname
is case-sensitive and must be specified exactly as it is in the TIP.Gateway server trace output is written to a log file in a default directory path specified by the SET LOG_DESTINATION
gateway parameter in %ORACLE_HOME%\\dg4appc\\admin\initsid.ora
for Microsoft Windows and in $ORACLE_HOME/dg4appc/admin/initsid.ora
for UNIX based systems. For example, on Microsoft Windows:
SET LOG_DESTINATION=C:\oracle\pga\12.1\dg4appc\log
On UNIX based systems:
SET LOG_DESTINATION=$ORACLE_HOME/dg4appc/log/
Refer to "Gateway Server Tracing" for more information.
The gateway server log file can be viewed be editing the file or by issuing other system commands that display file contents. The log file can also be copied and saved to document problem symptoms.
The gateway contains extensive tracing logic in the gateway remote procedural calls (RPCs), and the APPC-specific code. Tracing is enabled through gateway initialization parameters or dynamic RPC calls to the gateway. The trace provides information about the execution of the gateway RPC functions and about the execution of the APPC interface. The trace file contains a text stream written in chronological sequence of events. The trace is designed to assist application programmers with the debugging of their OLTP transaction programs and Oracle applications that communicate with those transaction programs through the gateway.
A single trace file is created for an entire gateway session from the time the database link is opened until it is closed. The trace can be directed to a specific path/filename or to a path (directory) only. In the first case, the file is overwritten each time a new session begins for the gateway being traced. When the trace target is a directory, a separate file with a generated name (containing the operating system process ID) is written for each gateway session. The latter approach must be used whenever the gateway to be traced might be the target of new sessions after the desired trace is written but before it can be copied and saved. Conversely, in some situations you might choose to create a distinct gateway system identifier used solely for tracing, and direct its trace to a single specific filename. This avoids the problem of an ever-increasing set of trace files when, for example, repeated attempts are necessary to reproduce or debug a problem. A fixed filename should never be used if there is any chance that an unexpected gateway session could overlay a useful trace.
This section describes how to define the destination of trace files to the gateway, and how to cause the gateway to create the trace files during initialization. Note that this does not enable any gateway tracing, it merely defines the destination of any trace output produced when the gateway tracing is enabled.
Choose a gateway system identifier to trace. Decide whether you will be tracing an existing gateway system identifier or a new one created specifically for tracing. If a new system identifier will be used, configure the new system identifier exactly the same as the old one by creating a new initsid.ora
(a copy of the old), entries in listener.ora
as necessary, and a new Oracle database link.
Test the new system identifier to ensure it works before proceeding.
For Microsoft Windows, in %ORACLE_HOME%\\dg4appc\\admin
, edit the initsid.ora
file so it contains the following:
SET TRACE_LEVEL=255 SET LOG_DESTINATION=logdest
For UNIX based systems, in $ORACLE_HOME/dg4appc/admin
, edit the initsid.ora
file so it contains the following:
SET TRACE_LEVEL=255 SET LOG_DESTINATION=logdest
where logdest
is the directory path for the trace output. The logfile is usually in %ORACLE_HOME%\dg4appc\log
for Microsoft Windows and $ORACLE_HOME/dg4appc/log
for UNIX based systems. Refer to the earlier discussion about "Problem Analysis of Data Conversion and Truncation Errors" for more information.
Note:
Misspelled parameter names in initsid.ora are not detected. The parameter is ignored.Once these two steps are completed, the gateway opens the specified trace file during initialization. Each session on this system identifier writes a trace file as specified by the SET
LOG_DESTINATION
parameter described in Step 2 above.
If a directory path was specified, each trace file has a name of the form:
sid_pid.log
where sid
is the gateway sid and pid
is the operating system process ID of the gateway server expressed in decimal.
There are two ways to enable the gateway server tracing. The first is to set the tracing options in the gateway initialization file, initsid.ora
. The second is to use the additional PGA remote procedural call (RPC) function, PGATCTL
, to dynamically control the tracing from within the Oracle application. The first method causes tracing to be performed for all users of the gateway system identifier and is recommended only when the use of the gateway system identifier can be limited to users actually needing the trace. The second method is more flexible and allows the application programmer to selectively trace events on a single gateway session without affecting the operation of other users' gateway sessions.
Before the gateway server trace is enabled, perform the tasks listed in "Defining the Gateway Trace Destination".
Edit the initsid.ora
file, and add the following line at the end of the file (or, if a SET TRACE_LEVEL
parameter is already specified, modify it):
SET TRACE_LEVEL=trace
where trace
is a numeric value from 1 to 255 indicating which traces are to be enabled. For further information on the use of this parameter, refer to "PGA Parameters" in Appendix A, "Gateway Initialization Parameters for SNA Protocol" of the Oracle Database Gateway for APPC Installation and Configuration Guide for IBM AIX on POWER Systems (64-Bit), Linux x86-64, Oracle Solaris on SPARC (64-Bit), and HP-UX Itanium or Oracle Database Gateway for APPC Installation and Configuration Guide for Microsoft Windows
Once this step is completed, tracing is enabled for the desired gateway system identifier.
The following is only needed for user-written TIPs. PGAU-generated TIPs automatically include the following facilities. Refer to "Controlling TIP Runtime Gateway Exchange Tracing" for more information.
Make the following changes to the PL/SQL application that calls the Transaction Interface Package(s) to execute remote transaction(s).
Add a call to PGATCTL
before any calls to TIP initialization functions are made:
PGATCTL@dblink(convid, traceF, traceS);
Where Table 8-5 describes the parameters in PGATCTL
:
This call sets the trace flags for all new conversations started after the call to the value specified by traceS
.
Recompile the PL/SQL application to pick up the new trace call.