Home> Database> Oracle> body text

How to view oracle logs

PHPz
Release: 2023-04-17 09:54:35
Original
14202 people have browsed it

Oracle is a widely used database system. When a failure occurs, you need to check the logs to help solve the problem. This article will introduce how to view Oracle logs to check database problems.

  1. View the database log file location

First you need to determine the database log file location. Oracle has three types of log files: Control Files, Log Files and Data Files. Log files are divided into online log files and archived log files. Online log files record running transactions, while archive log files record completed transactions.

You can view the locations of control files, log files and data files through the following commands:

SQL> SELECT name FROM v$controlfile; SQL> SELECT member FROM v$logfile; SQL> SELECT name FROM v$datafile;
Copy after login
  1. View log files

You can use SQL statements or logs File management tool to view Oracle log files.

View online log files

Online log files include the current log file and all unarchived log files. You can use the following command to view online log files:

SQL> SELECT * FROM v$log;
Copy after login

This command will display all current online log files and their related information.

View archive log files

You can use the following command to view archive log files:

SQL> SELECT * FROM v$archived_log;
Copy after login

This command will display the name, path, start time and end time of the archive log file, etc. information.

View the contents of the log file

You can use the following commands to view the contents of the log file:

SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> ALTER SYSTEM ARCHIVE LOG ALL; SQL> SELECT * FROM v$log_history;
Copy after login

The first command is used to switch log files, and the second command is used for archiving Log files, the third command is used to view the history of archived log files.

  1. View log files through Oracle Enterprise Manager

Oracle Enterprise Manager is a set of integrated tools for managing Oracle databases, which can easily view database log information. In the log management page, you can view log files, archived logs, and all error and warning messages. You can use the following steps to view database log information in Oracle Enterprise Manager:

  1. Enter the main page of Oracle Enterprise Manager
  2. Select the database instance and click the "Log" tab
  3. In the log management page, you can view log files, archive logs, and error and warning messages
  4. Use LogMiner to view logs

LogMiner is a set of data provided by Oracle based on log files Mining tool to view database log information. You can use the following command to use LogMiner to view database log information:

  1. Enter SQL*Plus
  2. Open LogMiner:
SQL> EXECUTE DBMS_LOGMNR.START_LOGMNR(options =>DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG);
Copy after login
  1. Analyze the log file And output the result:
SQL> SELECT timestamp, sql_redo FROM v$logmnr_contents;
Copy after login

Through the above methods, you can check the log information of the database and the running status of the database program, which is important for locating and solving database problems.

The above is the detailed content of How to view oracle logs. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!