Logging | Tracing   « Prev  Next »

Lesson 7 Identify the location of log and trace files on any Oracle server
ObjectiveFind the location of log and trace files on an Oracle server

Identify location of log trace files

To find the location of log and trace files on an Oracle server in Oracle Database 13c, you can utilize various methods and system views. Here are the tentative steps to help you locate these files:
  1. Finding the Location of Log Files: Oracle Database 13c maintains several types of log files, including alert logs, redo logs, and archived redo logs.
    Here's how to find their locations:
    • Alert Log:
      • The alert log contains important information about the database's status and activities. You can find its location by querying the `V$DIAG_INFO` view as follows:
        SELECT value
        FROM V$DIAG_INFO
        WHERE name = 'Diag Trace';
        
      • The `value` column will display the path to the directory containing the alert log file.
    • Redo Log Files:
      • To determine the location of online redo log files, you can query the `V$LOG` view:
        SELECT group#, member
        FROM V$LOG;
        
      • The `member` column will display the full path of each online redo log file.
    • Archived Redo Log Files:
      • Archived redo log files are typically stored in a designated archive log directory. To identify this directory, you can query the `V$ARCHIVE_DEST` view:
        SELECT destination
        FROM V$ARCHIVE_DEST
        WHERE status = 'VALID';
        
      • The `destination` column will provide the path to the archive log directory.
  2. Finding the Location of Trace Files: Trace files are generated by Oracle processes and are used for diagnosing issues, performance tuning, and debugging. You can locate these trace files using the following methods:
    • Background Process Trace Files:
      • To find trace files generated by specific background processes (e.g., PMON, SMON), you can use the `USER_DUMP_DEST` and `BACKGROUND_DUMP_DEST` initialization parameters:
        SELECT name, value
        FROM V$PARAMETER
        WHERE name IN ('user_dump_dest', 'background_dump_dest');
        
      • The `value` column will display the directory paths for user and background process trace files.
    • Session Trace Files:
      • Oracle can generate trace files for individual sessions or specific SQL statements. To locate these trace files, you can query the `V$SESSION` view and use the `TRACEFILE` column:
        SELECT username, sid, serial#, tracefile
        FROM V$SESSION
        WHERE username IS NOT NULL;
        
      • The `tracefile` column will display the full path of the trace file associated with each session.
    • SQL Trace for Statements:
      • To enable SQL trace for specific SQL statements, you can use the `ALTER SESSION` command with the `TRACEFILE_IDENTIFIER` option. The trace file generated will include the identifier in its name, making it easier to locate.
    • Initialization Parameter:
      • You can also determine the location of trace files using the `TRACE_DUMP_DEST` initialization parameter:
        SELECT name, value
        FROM V$PARAMETER
        WHERE name = 'trace_dump_dest';
        
      • The `value` column will display the directory path for general trace files.

By following these tentative steps and querying the relevant system views and initialization parameters, you can find the locations of both log files and trace files on your Oracle Database 13c server, which is crucial for troubleshooting and monitoring database activities.

Find location of server-side log | Legacy

The easiest way to see the location of server-side log and trace files is to issue the listener control status command. View the Code below to see an example. Here you see the specific directory and file Oracle has located for the listener log file.
dilbert > lsnrctl stat

LSNRCTL for IBM/AIX RISC System/6000: Version 2.3.3.0.0 - Production on 05-APR-9
9 15:42:31

Copyright (c) Oracle Corporation 1994.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=IPC)(KEY=fred))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for IBM/AIX RISC System/6000: Version 2.3.3.0.
0 - Production
Start Date                22-MAR-99 14:40:16
Uptime                    14 days 0 hr. 0 min. 15 sec
Trace Level               off
Security                  OFF
SNMP                      ON
Listener Parameter File   /etc/listener.ora
Listener Log File         /ora8/home/8.0.5/network/log/listener.log
Services Summary...
  lamp          has 1 service handler(s)
  i8itall       has 1 service handler(s)

To view client parameters, you must display the local sqlnet.ora file to see the locations of the log and trace files.
Now that you understand the basic files locations and purposes, let’s look at the uses of these files.

Log Location Trace Files - Exercise

Before moving on to the next lesson, click the Exercise button to evaluate a situation requiring the use of the log and trace parameters.
Log Location Trace Files - Exercise

SEMrush Software