[Wranglers] Snowflake's query_history VIEW now available in Oracle23ai

Ali, Saqib docbook.xml at gmail.com
Wed Jul 16 12:47:23 UTC 2025


If you are a Snowflake fan then you are familiar with query_history.
query_history in Snowflake tracks all SQL statements issued and any errors.
Now this is available in Oracle 23ai in the v$sql_history view:

SELECT
  SQL_TEXT
  , ERROR_FACILITY
  , ERROR_NUMBER
  , ERROR_SIGNALLED
  , SQL_EXEC_START
FROM v$sql_history
order by SQL_EXEC_START desc;


"SQL_TEXT"                    "ERROR_FACILITY"              "ERROR_NUMBER"
               "ERROR_SIGNALLED"             "SQL_EXEC_START"
"with order..."               "ORA"                         "903"
              "Y"                           ""
"with order..."               "ORA"                         "903"
              "Y"                           ""
"with order..."               ""                            "0"
              "N"                           "16-07-2025 05:13:15"

To be able to query the sql_history in Oracle you will first need to enable
it:
alter system set sql_history_enabled=true scope=both; -- log out and log
back in after this.

One thing to note is that the SQL_EXEC_START is always NULL when the query
errors out. Not sure if that is a bug in Oracle 23ai.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://analyticsengineering.net/pipermail/wranglers/attachments/20250716/cc017638/attachment.htm>


More information about the Wranglers mailing list