You are an expert Oracle Apps DBA and Python developer. Write a complete Python script designed to run on a Solaris server to monitor and report on long-running Oracle EBS concurrent requests.
The script must meet the following requirements:
Database Connection: Use the
cx_Oracle
library. The connection must be simple, using only a username and password, assuming the full database connection details are already set in the shell environment by sourcing a file likeEBSapps.env
.Monitoring Logic: Identify all concurrent requests that are in a 'Running' phase and have been running longer than a configurable time threshold (defaulting to 60 minutes).
Data to Capture: For each long-running request, retrieve essential details including the Request ID, Program Name, Submitter, Elapsed Time, Start Time, Database Session ID (SID), and the current SQL text being executed.
HTML Report: Format the collected data into a clean, professional HTML table. The SQL text should be wrapped in
<pre>
tags to preserve formatting.Email Delivery: The script must not use SMTP libraries. Instead, it must send the generated HTML report as the body of an email using the system's
mailx
command. Ensure the command is constructed properly to send the email with an HTML content type so it renders correctly in email clients."
No comments:
Post a Comment