Most Oracle database connects are made through the use of an Oracle process called the LISTENER which monitors a certain machine and port for connection requests to one or more database instances. There are times when a DBA or SA will want to monitor connects being made through the listener for various reasons. This article covers the setup of USER level tracing of you Oracle Listener and will work on UNIX, Linux, and Windows based machines.
1. Logon to your Oracle database server as the Oracle software owner.
2. Open up the LSNRCTL utility.
myhpux:>lsnrctl
LSNRCTL for HPUX: Version 10.2.0.4.0 – Production on 21-OCT-2009 18:17:05
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Welcome to LSNRCTL, type “help” for information.
LSNRCTL>
3. If you are not using the default name of the Oracle listener (LISTENER) then define the Oracle listener name with the following command: set current_listener LSNRCTL> set current_listener listener_orcl 4. If you have established a password for your oracle listener set it in the LSNRCTL session with the following command: set password LSNRCTL> set password oracle 5. Turn on user level tracing by specifying 4 or user as the level with the following command: set trc_level LSNRCTL> set trc_level 4 or LSNRCTL> set trc_level user 6. Define the name of the trace file that will be produced by the listener process upon establishment of user connection with the command below: set trc_file LSNRCTL> set trc_file user_access_trace NOTE: You do not have to set a trace directory by default the trace files for the listener are placed under: $ORACLE_HOME/network/trace 7. Save the changes made to the listener.ora file with the following command: save_config LSNRCTL> save_config 8. Exit out of LSNRCTL utility, change directories to $ORACLE_HOME/network/trace, and list the files present and you will see that the trace has already begun. LSNRCTL> exit 9. Logon to the RDBMS as a normal user and exit. mylinux:> sqlplus ljcatt/ljcatt@orcl SQL*Plus: Release 10.2.0.4.0 – Production on Wed Oct 21 18:31:26 2009 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to: SQL> exit 10. Perform another listing of the files under directory mylinux:> ls -lrt 11 This information can be used to show where connections in you database are coming from and other statistical information about the network connection being established. Larry J. Catt, OCP 91, 10g
Current Listener is listener_orcl
LSNRCTL>
The command completed successfully
LSNRCTL>
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.110)(PORT=1521)))
listener_orcl parameter “trc_level” set to user
The command completed successfully
LSNRCTL>
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.110)(PORT=1521)))
listener_orcl parameter “trc_level” set to user
The command completed successfully
LSNRCTL>
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.110)(PORT=1521)))
listener_orcl parameter “trc_file” set to user_access_trace.trc
The command completed successfully
LSNRCTL>
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.110)(PORT=1521)))
Saved listener_orcl configuration parameters.
Listener Parameter File /opt/app/oracle/10.2.0/network/admin/listener.ora
Old Parameter File /opt/app/oracle/10.2.0/network/admin/listener.bak
The command completed successfully
LSNRCTL>
mylinux:> cd $ORACLE_HOME/network/trace
mylinux:> ls -lrt
-rw-r—– 1 oracle dba 3010 Oct 21 18:26 user_access_trace.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 –
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
mylinux:>
$ORACLE_HOME/network/admin and you will see that the file user_access_trace.trc has grown by recording the connection
from user in step 9.
-rw-r—– 1 oracle dba 6810 Oct 21 18:31 user_access_trace.trc
oracle@allcompute.com
www.allcompute.com