Home  >  Article  >  Database  >  How to query historical sql in oracle

How to query historical sql in oracle

WBOY
WBOYOriginal
2022-06-13 10:29:2419690browse

Method: 1. Use "select * from v$sqlarea t where t.SQL_table name like'...' order by..." statement to query the historical sql of the specified table; 2. Use " select * from v$sqlarea t where t.PARSING_SCHEMA_NAME in ('user name') AND SQL_table name like'...'" statement queries the user's historical sql for the table.

How to query historical sql in oracle

The operating environment of this tutorial: Windows 10 system, Oracle version 12c, Dell G3 computer.

How to query historical sql in oracle

oracle monitoring, you can view the executed SQL statements

SELECT SQL_TEXT, LAST_ACTIVE_TIME,SQL_FULLTEXT FROM v$sql 
ORDER BY LAST_ACTIVE_TIME DESCsql

In addition, Ctrl E in PL/SQL Developer can re-call historical SQL records. The history file is saved in AppData\Roaming\PLSQL Developer\PLSRecall.dat by default. If you clear the PLSRecall.dat file and press ctrl e, the following window interface will be brought up.

The example is as follows:

Example 1: Query the historical sql query for the TEST table

How to query historical sql in oracle

Example 2: Query the user TRUI pair Historical sql for updating the TEST table

How to query historical sql in oracle

##Extension

Query user TRUI for TEST after 2021/6/28 Historical sql for table deletion

How to query historical sql in oracle

Recommended tutorial: "

Oracle Video Tutorial"

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

Statement:
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