TKPROF in Oracle Apps

 

1. What is the use of TKPROF utility

The TKPROF is a utility used to convert the Oracle trace file generated during SQL Trace in to a readable format.

TKPROF is a program that you invoke at the operating system command prompt in order to reformat the trace file into a format that is much easier to comprehend. Each SQL statement is displayed in the report, along with counts of how many times it was parsed, executed, and fetched. CPU time, elapsed time, logical reads, physical reads, and rows processed are also reported, along with information about recursion level and misses in the library cache. TKPROF can also optionally include the execution plan for each SQL statement in the report, along with counts of how many rows were processed at each step of the execution plan.

The SQL statements can be listed in a TKPROF report in the order of how much resource they used, if desired. Also, recursive SQL statements issued by the SYS user to manage the data dictionary can be included or excluded, and TKPROF can write SQL statements from the traced session into a spool file.


2. what Levels the SQL Trace file for TKPROF would have been generated?

Either it would have been done at Instance level by setting SQL_TRACE=TRUE or setting at session level the same.At session level it can be set back to false and at instance level bouncing db back twice At initial and at final after finishing trace.

3. Where is SQL Trace file located used in the TKPROF?

This is Located in the UDUMP directory in oracle database file structure or the path specified in the USER_DUMP_DEST

4. What should be take care before Using TKPROF utility?

Without fail try to close the SQL_TRACE=False before converting the trace file to redable format.Other wise it may not reflect a proper result.

TIMED_STATISTICS=True
-------------------------------

Set this parameter in init.ra or for a particular session level if you require the CPU time calculations for each phase.

5. How to find the respective trace file from UDUMP directory?

The latest trace file could be found by the latest time of creation of the file.Dont output the old files.Better clear the UDUMP directory before using the SQL Trace.

6. How to start of with TKPROF utility??

Simply type from command prompt TKPROF and the options as mentioned below.

A general Syntax of TKPROF
---------------------------------

TKPROF trace_file output_file
[SORT = parameter]
[PRINT = number]
[EXPLAIN = username/password]
[INSERT = stat_file_name]
[SYS = yes/no]
[AGGREGATE=[Y|N]]
[RECORD = sql_file_name]
[TABLE = schema.table_name]

7. A sample syntax for formating a trace file using TKPROF
-----------------------------------------------------------------

>tkprof explain=user_name/pwd

Under Standing various Options used in TKPROF Utility
--------------------------------------------------------------

Tracefile==>The name of the Trace output file

Outputfile==>The name of the formatted file

Sort=option==>The order in which to sort the statements

Print=n==>Print the first n statements

Explain=Username/pwd==>Run the Explain Plan in the specified user name

Insert=filename==>Generate INSERT statements

Sys=no==>Ignore recursive SQL statements run as sys user.

Aggregate=[Y|N]==>If specified as NO then TKPROF does not aggregate multiple users of the same SQL text

Record=filename==>Record statements found int he trace file

Table=schema.tablename==>Putting execution plan in to specified table(rather than the default PLAN_TABLE).

8. Under Standing trace file Outputs returned by TKPROF Utility?

After all the sql statement you may find the following values

Call==>PARSE,EXCUTE,FETCH

COUNT==>How many times the statement was parsed or executed and the no of fetch calls issued for the part stat.

CPU==>Process time for each phase in seconds. if the stat was found in the shared pool it is 0 for the parse phase.

ELAPSED==>This is not much useful since other process also affect ellapsed time.

QUERY==>Logical Buffers retrieved for Consistent read normally for a select stat.

CURRENT==>Logical buffers retry in current mode.

ROWS==>Rows processed by the outer stat.Select stat this is shown for the fetch phase and for DML stat it is shown in the execute phase.

DISK==>Phy data blocks read from the DB files. This stst may be very low if the data was buffered.

Libr cache misses==>this states that no of times the stat was not found in the Lib Cache in the parse and execute phase.if there was no miss then this statistcis wont appear.

User==>Id of the last user to parse the statement.

Execution Plan==> when you specify the EXPLAIN parameter with TKPROF it then works out the access path for each sql statement traced and included in the output.

Optimizer Hint==>used to indicate the Optim hint which was used during the execution of the stat.If there was no hint it will show optimizer mode was used.

Recursive SQL==>Sometimes in order to execute a SQL statement issued by a user, Oracle must issue additional statements. Such statements are called recursive calls or recursive SQL statements.

For example, if you insert a row into a table that does not have enough space to hold that row, Oracle makes recursive calls to allocate the space dynamically. Recursive calls are also generated when data dictionary information is not available in the data dictionary cache and must be retrieved from disk.

If recursive calls occur while the SQL trace facility is enabled,
TKPROF produces statistics for the recursive SQL statements and marks them clearly as recursive SQL statements in the output file. You can suppress the listing of recursive calls in the output file by setting the SYS statement-line parameter to NO. The statistics for a recursive SQL statement are included in the listing for that statement, not in the listing for  the SQL statement that caused the recursive call. So when you are calculating the total resources required to process a SQL statement, you should consider the statistics for that statement as well as those for recursive calls caused by that statement.

A Question for a Practice
-----------------------------
When TKPROFING, I set the argument sys=n so that system sql statement statisticts would not be shown.

 

Trace Files and TKPROF in Oracle Apps

How to enable Trace:

  • Enable the SQL Trace facility for the session by using one of the following DBMS_SESSION.SET_SQL_TRACE procedure
ALTER SESSION SET SQL_TRACE = TRUE|FALSE;
  • Diagnostics Link > "Set Trace Level" > Go button > Choose the Trace Level.
  • In situations where you cannot invoke an ALTER SESSION command from the session you wish to trace—as with prepackaged applications, for example—you can connect to the database as a DBA user and invoke the dbms_system built-in package in order to turn on or off SQL trace in another session. You do this by querying v$session to find the SID and serial number of the session you wish to trace and then invoking the dbms_system package with a command of the form:EXECUTE SYS.dbms_system.set_sql_trace_in_session (, , TRUE|FALSE);
Where to get Trace FileWhen you enable SQL trace in a session for the first time, the Oracle server process handling that session will create a trace file in the directory on the database server designated by the user_dump_dest initialization parameter. As the server is called by the application to perform database operations, the server process will append to the trace file.

select name,value from V$PARAMETER where name = 'user_dump_dest'; 

TKPROF

Trace a Concurrent Request And Generate TKPROF File

Enable Tracing For The Concurrent Manager Program
Responsibility: System Administrator
Navigate: Concurrent > Program > Define
Query Concurrent Program
Select the Enable Trace Checkbox
Turn On Tracing
Responsibility: System Administrator
Navigate: Profiles > System
Query Profile Option Concurrent: Allow Debugging
Set profile to Yes
Run Concurrent Program With Tracing Turned On
Logon to the Responsibility that runs the Concurrent Program
In the Submit Request Screen click on Debug Options (B)
Select the Checkbox for SQL Trace

Find Trace File Name

Run the following SQL to find out the Raw trace name and location for the concurrent program. The SQL prompts the user for the request id
SELECT ’Request id: ’||request_id , ‘Trace id: ’||oracle_Process_id, ‘Trace Flag: ’||req.enable_trace, ‘Trace Name: ‘||dest.value||’/’||lower(dbnm.value)||’_ora_’||oracle_process_id||’.trc’,
‘Prog. Name: ’||prog.user_concurrent_program_name, ‘File Name: ’||execname.execution_file_name|| execname.subroutine_name , ‘Status : ’||decode(phase_code,’R’,’Running’) ||’-’||decode(status_code,’R’,’Normal’), ‘SID Serial: ’||ses.sid||’,’|| ses.serial#, ‘Module : ’||ses.module from fnd_concurrent_requests req, v$session ses, v$process proc, v$parameter dest,
v$parameter dbnm, fnd_concurrent_programs_vl prog, fnd_executables execname where req.request_id = &request and req.oracle_process_id=proc.spid(+) and proc.addr = ses.paddr(+)
and dest.name=’user_dump_dest’ and dbnm.name=’db_name’ and req.concurrent_program_id = prog.concurrent_program_id and req.program_application_id = prog.application_id
and prog.application_id = execname.application_id and prog.executable_id=execname.executable_id;

TKPROF Trace File

Once you have obtained the Raw trace file you need to format the file using TKPROF.
$tkprof raw_trace_file.trc output_file explain=apps/ sort=(exeela,fchela) sys=no
Where: raw_trace_file.trc: Name of trace file
output_file: tkprof out file
explain: This option provides the explain plan for the sql statements
sort: his provides the sort criteria in which all sql statements will be sorted. This will bring the bad sql at the top of the outputfile.
sys=no:Disables sql statements issued by user SYS
Another example: To get (TKPROF) sorted by longest running queries first and limits the results to the “Top 10″ long running queries
$ tkprof raw_trace_file.trc output_file sys=no explain=apps/ sort=’(prsela,exeela,fchela)’ print=10
Usage: tkprof tracefile outputfile [explain= ] [table= ]
[print= ] [insert= ] [sys= ] [sort= ]
table=schema.tablename Use ‘schema.tablename’ with ‘explain=’ option.
explain=user/password Connect to ORACLE and issue EXPLAIN PLAN.
print=integer List only the first ‘integer’ SQL statements.
aggregate=yes|no
insert=filename List SQL statements and data inside INSERT statements.
sys=no TKPROF does not list SQL statements run as user SYS.
record=filename Record non-recursive statements found in the trace file.
sort=option Set of zero or more of the following sort options:
prscnt number of times parse was called
prscpu cpu time parsing
prsela elapsed time parsing
prsdsk number of disk reads during parse
prsqry number of buffers for consistent read during parse
prscu number of buffers for current read during parse
prsmis number of misses in library cache during parse
execnt number of execute was called
execpu cpu time spent executing
exeela elapsed time executing
exedsk number of disk reads during execute
exeqry number of buffers for consistent read during execute
execu number of buffers for current read during execute
exerow number of rows processed during execute
exemis number of library cache misses during execute
fchcnt number of times fetch was called
fchcpu cpu time spent fetching
fchela elapsed time fetching
fchdsk number of disk reads during fetch
fchqry number of buffers for consistent read during fetch
fchcu number of buffers for current read during fetch
fchrow number of rows fetched
userid userid of user that parsed the cursor

 


TKPROF Example#1
----------------------
If you are processing a large trace file using a combination of SORT parameters and the PRINT parameter, then you can produce a TKPROF output file containing only the highest resource-intensive statements. For example, the following statement prints the 10 statements in the trace file that have generated the most physical I/O:

TKPROF ora53269.trc ora53269.prf SORT = (PRSDSK, EXEDSK, FCHDSK) PRINT = 10

TKPROF Example#2
----------------------
This example runs TKPROF, accepts a trace file named dlsun12_jane_fg_sqlplus_007.trc, and writes a formatted output file named outputa.prf:

TKPROF dlsun12_jane_fg_sqlplus_007.trc OUTPUTA.PRF
EXPLAIN=scott/tiger TABLE=scott.temp_plan_table_a INSERT=STOREA.SQL SYS=NO
SORT=(EXECPU,FCHCPU)

enable trace in Oracle

How to enable trace in Oracle



1. Enable trace at instance level

Put the following line in init.ora. It will enable trace for all sessions and the background
processes

sql_trace = TRUE

to disable trace:

sql_trace = FALSE

- or -

to enable tracing without restarting database run the following command in sqlplus

SQLPLUS> ALTER SYSTEM SET trace_enabled = TRUE;

to stop trace run:

SQLPLUS> ALTER SYSTEM SET trace_enabled = FALSE;


2. Enable trace at session level

to start trace:

ALTER SESSION SET sql_trace = TRUE;

to stop trace:

ALTER SESSION SET sql_trace = FALSE;

- or - 

EXECUTE dbms_session.set_sql_trace (TRUE);
EXECUTE dbms_session.set_sql_trace (FALSE);

- or -

EXECUTE dbms_support.start_trace;
EXECUTE dbms_support.stop_trace;


3. Enable trace in another session

Find out SID and SERIAL# from v$session. For example:

SELECT * FROM v$session WHERE osuser = OSUSER;

to start trace:

EXECUTE dbms_support.start_trace_in_session (SID, SERIAL#);

to stop trace:

EXECUTE dbms_support.stop_trace_in_session (SID, SERIAL#);

- or -

EXECUTE dbms_system.set_sql_trace_in_session (SID, SERIAL#, TRUE);
EXECUTE dbms_system.set_sql_trace_in_session (SID, SERIAL#, FALSE);

- or -

-- Oracle 10.1
EXECUTE DBMS_SYSTEM.set_sql_trace_in_session(sid=>SID, serial#=>SERIAL, sql_trace=>TRUE);
EXECUTE DBMS_SYSTEM.set_sql_trace_in_session(sid=>SID, serial#=>SERIAL, sql_trace=>FALSE);


-- to trace session with wait events
alter session set events '10046 trace name context forever, level 8';

-- to see wait events and bind variables
alter session set events '10046 trace name context forever, level 12';
 
 
 

Tracing Techniques within the Oracle Applications 11i/R12

A trace file is a log of SQL run in a particular session or sesesions  focused on selects, inserts, updates, and deletes.  A trace file can be used in many circumstances including reviewing performance,  finding tables and views referenced, or finding the root of an error. 
 
How does one enable trace in the Oracle Application screens / forms?


One can enable trace through the forms by using the Help menu, choosing the daignostics menu,trace and then selecting the appropriate trace for your needs .
Most commonly if debugging an error, you should at least provide trace with binds When debugging a performance issue, you may consider using trace with binds and waits.


For example, the following is the navigation to enable trace in a form:

Goto the Oracle Applications -->Login -->Open the form where the error occurs but do not yet cause the error.
Enable SQL*Trace by choosing Help > Diagnostics > Trace > Trace with binds

A message appears indicating that the trace will be recorded
Note the file name and location of the file
Now reproduce the error.
Once the error occurs, disable trace as soon as possible.

Disable SQL*Trace by choosing Help > Diagnostics > Trace > Trace off
The same file name and location will be noted in case you need it again.
Retrieve the trace file.
How does one enable trace for a concurrent program?


A simple way to enable trace in a concurrent program is to review the concurrent program definition and select trace enabled. This will enable trace without binds for all users that run the program. 

For example, the following steps could be used. 
Goto Sysadmin > Concurrent > Program > Define 
Query the concurrent program 
Check the trace box to enable trace 






How does one find a trace file for a concurrent program?


In 11G:

Set Serveroutput ON

DECLARE 
DB_Version VARCHAR2(2);
Trace_location VARCHAR2(240);
BEGIN 
SELECT SUBSTR(vi.version, 1, INSTR(vi.version, '.')-1) INTO DB_Version FROM v$instance vi;

IF TO_NUMBER(DB_Version) >= 11 THEN
/* Following Line included as Execute Immediate as V$DIAG_INFO does not exist in DB Versions prior to 11g */
EXECUTE IMMEDIATE 'SELECT value FROM V$DIAG_INFO WHERE NAME = ''Diag Trace''' INTO Trace_location ;
ELSE 
SELECT value INTO Trace_location FROM v$parameter WHERE name = 'user_dump_dest';
END IF ;
dbms_output.put_line('Trace File should be located in the directory :- '|| trace_location);
END;
/

 Before 11G:

SQL> 

prompt 
accept request prompt 'Please enter the concurrent request id for the appropriate concurrent program:' 
prompt 

column traceid format a8 
column tracename format a80 
column user_concurrent_program_name format a40 
column execname format a15 
column enable_trace format a12 
set lines 80 
set pages 22 
set head off 

SELECT 'Request id: '||request_id , 
'Trace id: '||oracle_Process_id, 
'Trace Flag: '||req.enable_trace, 
'Trace Name: 
'||dest.value||'/'||lower(dbnm.value)||'_ora_'||oracle_process_id||'.trc', 
'Prog. Name: '||prog.user_concurrent_program_name, 
'File Name: '||execname.execution_file_name|| execname.subroutine_name , 
'Status : '||decode(phase_code,'R','Running') 
||'-'||decode(status_code,'R','Normal'), 
'SID Serial: '||ses.sid||','|| ses.serial#, 
'Module : '||ses.module 
from fnd_concurrent_requests req, v$session ses, v$process proc, 
v$parameter dest, v$parameter dbnm, fnd_concurrent_programs_vl prog, 
fnd_executables execname 
where req.request_id = &request 
and req.oracle_process_id=proc.spid(+) 
and proc.addr = ses.paddr(+) 
and dest.name='user_dump_dest' 
and dbnm.name='db_name' 
and req.concurrent_program_id = prog.concurrent_program_id 
and req.program_application_id = prog.application_id 
and prog.application_id = execname.application_id 
and prog.executable_id=execname.executable_id;

 

Listener Configuration for Oracle 11g Database(NETCA)

  Configuration and Administration Tools Overview

This chapter introduces the various administration tools of Oracle Net Services. It discusses the main administration application, Oracle Net Manager, and describes how to launch and navigate through it. It also introduces the command line control utilities.
This chapter contains these topics:

Oracle Net Manager

Oracle Net Manager is a graphical user interface tool that combines configuration abilities with Oracle Names component control to provide an integrated environment for configuring and managing Oracle Net. It can be used on either the client or server. Oracle Net Manager is also integrated with Oracle Enterprise Manager.
You can use Oracle Net Manager to configure the following network components:
  • Naming--Define simple names, connect identifiers, and map them to connect descriptors to identify the network location and identification of a service. Oracle Net Manager supports configuration of connect descriptors in local tnsnames.ora files, a centralized LDAP-compliant directory service, or an Oracle Names server.
  • Naming Methods--Configure the different ways in which connect identifiers are resolved into connect descriptors.
  • Profiles--Configure preferences for enabling and configuring Oracle Net features on the client or server.
  • Listeners--Create and configure listeners to receive client connections.
If an Oracle Names server is configured, you can start, stop, tune, or gather statistics for it with Oracle Net Manager.
This section introduces you to the features of Oracle Net Manager. However, the primary documentation for using Oracle Net Manager is the accompanying online help. This section contains these topics:

Starting Oracle Net Manager

You can start Oracle Net Manager using the Oracle Enterprise Manager Console or as an independent application.
To start Oracle Net Manager from the Oracle Enterprise Manager console, on the Oracle Enterprise Manager console, choose Tools > Service Management > Oracle Net Manager.
To start Oracle Net Manager as standalone application:
  • On UNIX, run netmgr from $ORACLE_HOME/bin
  • On Windows NT, choose Start > Programs > Oracle - HOME_NAME > Configuration and Migration Tools > Net Manager

Navigating Oracle Net Manager

The Oracle Net Manager interface includes two panes, a toolbar, and various menu items.

Figure 5-1 Oracle Net Manager Interface

Text description of admintoa.gif follows

Panes

The Oracle Net Manager interface has two panes: the navigator pane and the right pane.
Navigator Pane
The navigator pane provides a graphical tree view of network objects and the objects they contain, organized in hierarchies of folders. You can use the navigator pane to view, modify, add, or delete objects in each folder.
The navigator pane functions the same way as it does in other Oracle Enterprise Manager applications. That is, the navigator pane lets you:
  • Expand and contract folders so that you can navigate to the network object you want to monitor or manage. Examples of objects are connect identifiers, listeners, profiles, and Oracle Names servers.
  • Right-click an object to perform operations on the object.
When you expand a folder, you see a nested list of objects and folders. When a object is selected, information about the object is displayed in the right pane of the Oracle Net Manager.
Table 5-1 lists the main folders in the navigator pane.
Table 5-1  Oracle Net Manager Navigator Pane Folders
Option Description
Local
Displays networking elements configured in local configuration files:
Net service names in the tnsnames.ora file
Listeners in the listener.ora file
Profiles in the sqlnet.ora file
Directory
Displays connect identifiers configured in a directory server
Local
Displays networking elements configured in local configuration files:
Net service names in the tnsnames.ora file
Listeners in the listener.ora file
Profiles in the sqlnet.ora file
Oracle Names Servers
Displays Oracle Names servers
Right Pane
The right pane contains property sheets that enable you to configure network components. Figure 5-2 shows the Service Attributes property sheet used for connect identifier configuration.

Figure 5-2 Service Attributes Property Sheet

Text description of adminto2.gif follows

Toolbar

The toolbar contains buttons that correspond to the network objects in the folder hierarchies. The toolbar buttons are enabled depending on the objects viewed or selected in a pane. Move the mouse cursor over a toolbar button to display the description of the button's function. The toolbar buttons are:

Create

This button creates new connect identifiers, listeners, and Oracle Names servers objects under the Directory or Local > Service Naming, Listeners, and Oracle Names Servers folders.

Delete

This button deletes connect identifier and listener objects under the Directory or Local > Service Naming and Listeners folders.

Verify Connectivity

This button verifies the connectivity of a selected connect identifier to an Oracle database service. During a connectivity test, a connection to a database service is made by using connect descriptor information stored in a directory server or a tnsnames.ora file.

Help

The Help button opens the Oracle Net Manager online help.

Menus

You use Oracle Net Manager menus to perform actions, such as testing connectivity to an Oracle database, and to open wizards and dialog boxes. The following list describes the items available under each menu.

File Menu

Table 5-2  File Menu Contents
Option Description
Open Network Configuration
Opens the local configuration files
Save Network Configuration
Saves the current configuration settings to the default location
Save As
Saves the current configuration settings to a nondefault location
Revert to Saved Configuration
Does not save any of the current configuration settings. Instead, retrieves the last saved configuration
Exit
Closes the Oracle Net Manager

Edit Menu

Table 5-3  Edit Menu Contents
Option Description
Create
Creates new connect identifiers, listeners, and Oracle Names servers objects under the Directory or Local > Service Naming, Listeners, and Oracle Names Servers folders.
Delete
Deletes connect identifier and listener objects under the Directory or Local > Service Naming and Listeners folders.
Rename
Renames a network object

 netca (Listener Configuration for Oracle 11g Database

Sometimes you need to run netca manually to configure Listener for your database. In Oracle 11g i found this message as a warning when selecting Database Control Configuration.

So planned to document this and of course this is one of the part of Oracle 11g Installation.
1. Open a terminal as a Oracle user and run netca.
Select -> Listener Configuration
2. Select Add, as we are going to create a LISTENER for a new setup. If we have any existing listener running on the Server, remain options will be highlight like "delete" "re-configure" etc.
3. Listener Name, or you can leave the existing one.
4. TCP is selected as default.
5. Select the Port here (or) you can leave the default port.










Starting up and shutting down the oracle listener is a routine task for a database administrator. However a Linux system administrator or programmer may end-up doing some basic DBA operations on development database. It is critical for non-DBAs to understand the basic database admin activities.

In this article, let us review how to start, stop, check status of an oracle listener using Oracle listener control utility LSNRCTL
.


How To Start, Stop and Restart Oracle Listener

Oracle Listener Status

Before starting, stopping or restarting make sure to execute lsnrctl status command to check the oracle listener status as shown below. Apart from letting us know whether the listener is up or down, you can also find the following valuable information from the lsnrctl status command output.
  • Listner Start Date and Time.
  • Uptime of listner – How long the listener has been up and running.
  • Listener Parameter File – Location of the listener.ora file. Typically located under $ORACLE_HOME/network/admin
  • Listener Log File – Location of the listener log file. i.e log.xml

If the Oracle listener is not running, you’ll get the following message.
$ lsnrctl status

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:39

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory

If the Oracle listener is running, you’ll get the following message.
$ lsnrctl status

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:02

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date                29-APR-2009 18:43:13
Uptime                    6 days 21 hr. 43 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.1.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "devdb" has 1 instance(s).
  Instance "devdb", status UNKNOWN, has 1 handler(s) for this service...
Service "devdb.thegeekstuff.com" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devdbXDB.thegeekstuff.com" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devdb_XPT.thegeekstuff.com" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
The command completed successfully

2. Start Oracle Listener

If the Oracle listener is not running, start the listener as shown below. This will start all the listeners. If you want to start a specific listener, specify the listener name next to start. i.e lsnrctl start [listener-name]

$ lsnrctl start

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:42

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.1.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.1.0.6.0 - Production
System parameter file is /u01/app/oracle/product/11.1.0/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date                04-APR-2009 16:27:42
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.1.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "devdb" has 1 instance(s).
  Instance "devdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

3. Stop Oracle Listener

If the Oracle listener is running, stop the listener as shown below. This will stop all the listeners. If you want to stop a specific listener, specify the listener name next to stop. i.e lsnrctl stop [listener-name]

$ lsnrctl stop

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:37

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
The command completed successfully

4. Restart Oracle Listener

To restart the listener use lsnrctl reload as shown below instead of lsnrctl stop and lsnrctl start. realod will read the listener.ora file for new setting without stop and start of the Oracle listener.

$ lsnrctl reload

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 17:03:31

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
The command completed successfully

Available Listener Commands

lsnrctl help command will display all available listener commands. In Oracle 11g following are the available listener commands.
  • start - Start the Oracle listener
  • stop - Stop the Oracle listener
  • status - Display the current status of the Oracle listener
  • services - Retrieve the listener services information
  • version - Display the oracle listener version information
  • reload - This will reload the oracle listener SID and parameter files. This is equivalent to lsnrctl stop and lsnrctl start.
  • save_config – This will save the current settings to the listener.ora file and also take a backup of the listener.ora file before overwriting it. If there are no changes, it will display the message “No changes to save for LISTENER”
  • trace - Enable the tracing at the listener level. The available options are ‘trace OFF’, ‘trace USER’, ‘trace ADMIN’ or ‘trace SUPPORT’
  • spawn - Spawns a new with the program with the spawn_alias mentioned in the listener.ora file
  • change_password – Set the new password to the oracle listener (or) change the existing listener password.
  • show - Display log files and other relevant listener information.
$ lsnrctl help

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:12:09

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

The following operations are available
An asterisk (*) denotes a modifier or extended command:

start               stop                status
services            version             reload
save_config         trace               spawn
change_password     quit                exit
set*                show*
 Get More help on Specific Listener Command You can get detailed help on a specific oracle listener command as shown below. In the following example, it gives all the available arguments/parameters that can be passed to the lsnrctl show command.

$ lsnrctl help show

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:22:28

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

The following operations are available after show
An asterisk (*) denotes a modifier or extended command:

rawmode                     displaymode
rules                       trc_file
trc_directory               trc_level
log_file                    log_directory
log_status                  current_listener
inbound_connect_timeout     startup_waittime
snmp_visible                save_config_on_stop
dynamic_registration
 
 
 
 
 

ERROR 1396 (HY000): Operation ALTER USER failed for 'Mysql'@'%'

 This MySQL error — ERROR 1396 (HY000): Operation ALTER USER failed for 'Mysql'@'%' — means that MySQL cannot find the user ...