Overview
TheOMNI_TRACER_API package is the core PL/SQL component that OmniView deploys to Oracle databases. It provides functionality for:
- Tracing messages from PL/SQL processes
- Managing Oracle Advanced Queuing (AQ) for asynchronous message delivery
- Subscriber registration and management
- Bulk message dequeuing for efficient processing
The package is automatically deployed by OmniView’s TracerService when a connection is established to a new database.
Package Structure
The package consists of several components:Database Objects
- OMNI_TRACER_ID_SEQ: Sequence for generating unique message IDs
- OMNI_TRACER_PAYLOAD_TYPE: Object type containing JSON message data (BLOB)
- OMNI_TRACER_PAYLOAD_ARRAY: Table of payload objects
- OMNI_TRACER_RAW_ARRAY: Table of RAW(16) message IDs
- OMNI_TRACER_QUEUE: Sharded queue for message distribution
Core Procedures and Functions
Initialize
Set up the queue infrastructure
Trace_Message
Send trace messages to the queue
Register_Subscriber
Register a new subscriber to the queue
Dequeue_Array_Events
Bulk dequeue messages for processing
Package Specification
Omni_Tracer.sql:98-117
Initialize
TheInitialize procedure sets up the Oracle Advanced Queue infrastructure required for message tracing.
Functionality
- Creates a sharded queue with multiple consumers enabled
- Configures 4 shards for parallel message processing
- Uses autonomous transaction to ensure queue creation is committed independently
- Handles race conditions when multiple instances try to initialize simultaneously
Queue Configuration
OMNI_TRACER_QUEUE
TRUE - Allows named subscribers to receive messages
OMNI_TRACER_PAYLOAD_TYPE - Custom object type containing BLOB JSON data
4 - Number of shards for parallel processing (can be adjusted based on load)
Usage
OmniView automatically calls
Initialize during the deployment process. You typically don’t need to call this manually.Error Handling
The procedure handles the following scenarios:- Queue already exists: Silently succeeds (idempotent operation)
- Race condition (ORA-24001): Commits and returns successfully
- Other errors: Rolls back and raises the exception
Deployment
TheOMNI_TRACER_API package is deployed by OmniView’s TracerService using the following workflow:
Deployment Process
Check package existence
TracerService queries
user_objects to determine if OMNI_TRACER_API is already deployed and valid.tracer_service.go:125
Deploy SQL file
If the package doesn’t exist, TracerService reads the embedded
Omni_Tracer.sql file and deploys it to the database.tracer_service.go:136-142
Deployment Execution Order
The SQL file is deployed in the following order:- Sequences:
OMNI_TRACER_ID_SEQfor message ID generation - Types:
OMNI_TRACER_PAYLOAD_TYPE,OMNI_TRACER_PAYLOAD_ARRAY,OMNI_TRACER_RAW_ARRAY - Package Specification: Public interface definition
- Package Body: Implementation of all procedures and functions
Message Format
Messages in the queue follow this JSON structure:Unique identifier from OMNI_TRACER_ID_SEQ
Name of the calling process (default: “OMNI_TRACER_API”)
Severity level: INFO, WARNING, ERROR, DEBUG
The actual message content (CLOB)
ISO 8601 timestamp with timezone
Related Topics
Trace_Message
Learn how to send trace messages from PL/SQL
Subscriber Management
Understand subscriber registration and message dequeuing