FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(ivorysql_ora): add Oracle-compatible DBMS_MONITOR package by elephone-184 · Pull Request #2294 · IvorySQL/IvorySQL · GitHub

Repository navigation

feat(ivorysql_ora): add Oracle-compatible DBMS_MONITOR package - #2294

Open
elephone-184 wants to merge 1 commit into
IvorySQL:masterfrom
elephone-184:pr-20-dbms-monitor
Open

elephone-184 wants to merge 1 commit into
IvorySQL:masterfrom
elephone-184:pr-20-dbms-monitor

Conversation

Copy link
Copy Markdown

Summary

Implement the Oracle-compatible DBMS_MONITOR package in the ivorysql_ora extension. DBMS_MONITOR allows database administrators to control end-to-end application tracing, gather metrics by client identifier, and manage diagnostic tracing for sessions and database instances.

Key Features

  • Monitoring Catalog Tables:
    • sys.monitored_client_ids: tracks monitored client identifiers and their statistics/tracing states.
    • sys.monitored_sessions: stores session tracing configuration, wait/bind flag settings, and plan stats.
  • Procedures:
    • CLIENT_ID_STAT_ENABLE(client_id) / CLIENT_ID_STAT_DISABLE(client_id): enables or disables metric collection by client ID.
    • CLIENT_ID_TRACE_ENABLE(client_id, waits, binds, plan_stat) / CLIENT_ID_TRACE_DISABLE(client_id): toggles cross-session trace for client ID.
    • SESSION_TRACE_ENABLE(session_id, serial_num, waits, binds, plan_stat) / SESSION_TRACE_DISABLE(session_id, serial_num): toggles tracing on specific sessions.
    • DATABASE_TRACE_ENABLE(waits, binds, plan_stat) / DATABASE_TRACE_DISABLE(): toggles instance-wide SQL tracing.

Security & Governance

  • Security compliance: internal resolver functions in sys revoke execute permissions from PUBLIC (CWE-862).
  • Pure backend C implementation using SPI.
  • Integrated into contrib/ivorysql_ora/Makefile, contrib/ivorysql_ora/meson.build, and contrib/ivorysql_ora/ivorysql_ora_merge_sqls.
  • Comprehensive regression test suite sql/dbms_monitor.sql and expected/dbms_monitor.out (>640 lines added) covering client_id statistics, client_id tracing, session tracing, database-wide tracing, parameter validation, and catalog ACL checks.

Test plan

  • Pure backend C implementation using SPI.
  • PL/iSQL package specification and body with default arguments.
  • Catalog tables created under sys.
  • Build configuration: registered in Makefile, meson.build, and ivorysql_ora_merge_sqls.
  • Full regression test coverage matching ORA_REGRESS:
    • CLIENT_ID_STAT_ENABLE and CLIENT_ID_STAT_DISABLE.
    • CLIENT_ID_TRACE_ENABLE and CLIENT_ID_TRACE_DISABLE.
    • SESSION_TRACE_ENABLE and SESSION_TRACE_DISABLE.
    • DATABASE_TRACE_ENABLE and DATABASE_TRACE_DISABLE.
    • NULL parameter error checks.
    • Catalog ACL checks verifying revocation from PUBLIC.

Implement the Oracle-compatible DBMS_MONITOR package in ivorysql_ora.

The package provides subprograms for end-to-end application tracing, workload
monitoring, and database diagnostics:
- CLIENT_ID_STAT_ENABLE / CLIENT_ID_STAT_DISABLE: enables and disables
  statistics collection for a specific client_id.
- CLIENT_ID_TRACE_ENABLE / CLIENT_ID_TRACE_DISABLE: enables and disables SQL
  tracing across sessions for a specific client_id.
- SESSION_TRACE_ENABLE / SESSION_TRACE_DISABLE: toggles session SQL tracing
  with wait and bind variable instrumentation.
- DATABASE_TRACE_ENABLE / DATABASE_TRACE_DISABLE: enables and disables
  instance-wide SQL tracing.
- Monitoring catalog tables: sys.monitored_client_ids and
  sys.monitored_sessions.

Security & compliance:
- Revoke execute privilege on internal sys.dbms_monitor_* functions from
  PUBLIC to prevent authorization bypass (CWE-862).
- Pure backend C implementation using SPI.
- Wired into Makefile, meson.build, and ivorysql_ora_merge_sqls.
- Comprehensive regression tests covering client_id statistics, client_id
  tracing, session tracing, database-wide tracing, and catalog ACL checks.

Copy link
Copy Markdown
Collaborator

Thanks for contributing to IvorySQL! Could you please disclose whether AI was used for this contribution? If so, please include the approximate percentage and the model(s) used.

Copy link
Copy Markdown
Collaborator

Thanks for your contribution. According to the community rules, every PR must be linked to a corresponding issue (either an existing one or a new one created alongside this PR). Please add the issue associated with your PR.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL