Oracle跟蹤會話

尛樣兒發表於2010-06-15

1.客戶端跟蹤:
PERFORMING A CLIENT-SIDE SQL*NET TRACE

(1) Open the SQLNET.ORA file typically found in the following location:

ORACLE_BASE\ORACLE_HOME\Network\Admin (7.3.x, 8.1.x or later)
ORACLE_BASE\ORACLE_HOME\Net80\Admin (8.0.x)

(2) Add the following parameters at the end of the file:

#CLIENT-SIDE SQL*NET TRACE PARAMETERS
#====================================
TRACE_UNIQUE_CLIENT = ON
TRACE_LEVEL_CLIENT = 16
TRACE_DIRECTORY_CLIENT = C:\temp
TRACE_FILE_CLIENT = SQLNetTrace
TRACE_TIMESTAMP_CLIENT = ON
#TRACE_FILELEN_CLIENT = 2048
#TRACE_FILENO_CLIENT = 2

Parameters prefixed with a “#” are interpreted as comments and will not
affect tracing.

If you want to change the location where the trace file will be saved
modify the following two parameters:

(a) TRACE_DIRECTORY_CLIENT

Set this parameter to the folder where you want the trace file to be
saved.

WARNING: Do not end the path with a “\”. This is not necessary and may
prevent the trace file from being generated.

(b) TRACE_FILE_CLIENT

Set this parameter to the filename of the trace file that will be
created. The actual trace filename may contain additional information
appended to the end of the filename such as

SQLNetTrace_ _.trc

where is the application’s process id while it was running and
distinguishes different client connections established from the
same process id (or session) to the database. This occurs since the
parameter TRACE_UNIQUE_CLIENT is set to ON.

The parameter TRACE_LEVEL_CLIENT=16 ensures that maximum trace
information is logged.

NOTE: If you think the size of the trace file will exceed the free space
on the drive where TRACE_DIRECTORY_CLIENT is saving the file, then
uncomment the last two parameters which will have the following
affect:

(a) TRACE_FILELEN_CLIENT - will create trace files of the size
specified in kilobytes (KB)

(b) TRACE_FILENO_CLIENT - will write to multiple trace files up
to the maximum size specified by
TRACE_FILELEN_CLIENT and then cycle
through the files again overwriting
previously written trace information

The default values specified above for these two paramters will
cycle the trace output between two trace files with a maximum size
of 2MB each.

Once you have made the appropriate changes to the SQLNET.ORA file be
sure to SAVE the file.

NOTE: If the application you are tracing is running from inside a web
server environment, such as Microsoft’s Internet Information
Server (IIS), you will need to RESTART THE WEB SERVER at this
point in order for these changes to be seen by the web server.
This is due to the fact that web servers may cache the SQLNET.ORA
file.

(3) Immediately run the application that uses one of the programmatic
interfaces and generate the error.

(4) Immediately go back to the SQLNET.ORA file and turn tracing off by using
any of the following methods:

(a) Modify the following parameter:

TRACE_LEVEL_CLIENT = OFF

(b) Remove all the tracing parameters you added to this file or

(c) Comment all the tracing parameters out by placing the “#”
character before each one.

Save the changes to the SQLNET.ORA file.

(5) Retrieve the “.trc” file(s) from the location “C:\temp\SQLNetTrace\” or
wherever you have saved the file(s) based on what was specified in the
parameters TRACE_DIRECTORY_CLIENT and TRACE_FILE_CLIENT. If you did not
specify a location please check the location of the directory where the
application was run from or search your hard drive for all “.trc” files.
Check the size of the “.trc” file(s) and make sure they do not have a
size of 0 bytes but do have the current time and date. Zip the file up
and upload it to support.

2.伺服器跟蹤:
$lsnrctl
LSNRCTL> status
LSNRCTL> trace user 注意rac中節點LISTENER的名稱是LISTENER_

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23135684/viewspace-665383/,如需轉載,請註明出處,否則將追究法律責任。

相關文章