get_ob_ash_report
Generate an OceanBase Active Session History (ASH) report to analyze system performance. Capture session details, SQL IDs, wait events, and module actions for precise diagnostics.
Instructions
Get OceanBase Active Session History report.
ASH can sample the status of all Active Sessions in the system at 1-second intervals, including:
Current executing SQL ID
Current wait events (if any)
Wait time and wait parameters
The module where the SESSION is located during sampling (PARSE, EXECUTE, PL, etc.)
SESSION status records, such as SESSION MODULE, ACTION, CLIENT ID
This will be very useful when you perform performance analysis.RetryClaude can make mistakes. Please double-check responses.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_time | Yes | ||
| start_time | Yes | ||
| tenant_id | No |
Implementation Reference
- The handler function for the 'get_ob_ash_report' tool, decorated with @app.tool() which also registers it with the MCP server. It constructs and executes a SQL call to DBMS_WORKLOAD_REPOSITORY.ASH_REPORT using the provided start_time, end_time, and optional tenant_id, returning the result or error.@app.tool() def get_ob_ash_report( start_time: str, end_time: str, tenant_id: Optional[int] = None, ) -> str: """ Get OceanBase Active Session History report. ASH can sample the status of all Active Sessions in the system at 1-second intervals, including: Current executing SQL ID Current wait events (if any) Wait time and wait parameters The module where the SESSION is located during sampling (PARSE, EXECUTE, PL, etc.) SESSION status records, such as SESSION MODULE, ACTION, CLIENT ID This will be very useful when you perform performance analysis.RetryClaude can make mistakes. Please double-check responses. Args: start_time: Sample Start Time,Format: yyyy-MM-dd HH:mm:ss. end_time: Sample End Time,Format: yyyy-MM-dd HH:mm:ss. tenant_id: Used to specify the tenant ID for generating the ASH Report. Leaving this field blank or setting it to NULL indicates no restriction on the TENANT_ID. """ logger.info( f"Calling tool: get_ob_ash_report with arguments: {start_time}, {end_time}, {tenant_id}" ) # Construct the SQL query sql_query = f""" CALL DBMS_WORKLOAD_REPOSITORY.ASH_REPORT('{start_time}','{end_time}', NULL, NULL, NULL, 'TEXT', NULL, NULL, {tenant_id if tenant_id is not None else "NULL"}); """ try: return execute_sql(sql_query) except Error as e: logger.error(f"Error get ASH report,executing SQL '{sql_query}': {e}") return f"Error get ASH report,{str(e)}"
- src/oceanbase_mcp_server/oceanbase_mcp/server.py:188-188 (registration)The @app.tool() decorator registers the get_ob_ash_report function as an MCP tool.@app.tool()